-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpeng.php
More file actions
21 lines (20 loc) · 749 Bytes
/
peng.php
File metadata and controls
21 lines (20 loc) · 749 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: Basic realm="xxx.com Your password will be unencrypted"');
echo 'Authorization Required.';
exit;
} else {
// Validate the username and password here if needed
$username = $_SERVER['PHP_AUTH_USER'];
$password = $_SERVER['PHP_AUTH_PW'];
// Example of checking the credentials
// Replace this with your actual authentication logic
if ($username !== 'your_username' || $password !== 'your_password') {
header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: Basic realm="xxx.com Your password will be unencrypted"');
echo 'Invalid Credentials.';
exit;
}
}
?>