-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
39 lines (36 loc) · 1.27 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
// Retrieve authentication credentials from environment
$valid_username = getenv('AUTH_USERNAME');
$valid_password = getenv('AUTH_PASSWORD');
// Check if the user is authenticated
if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']) ||
$_SERVER['PHP_AUTH_USER'] !== $valid_username || $_SERVER['PHP_AUTH_PW'] !== $valid_password) {
// If not, send authentication headers
header('WWW-Authenticate: Basic realm="Restricted Area"');
header('HTTP/1.0 401 Unauthorized');
echo 'Authentication required.';
exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>User Information Checker</title>
</head>
<body>
<h2>Check User by Account ID</h2>
<form action="check_user.php" method="POST">
<label for="account_id">Account ID:</label>
<input type="number" name="account_id" required>
<button type="submit">Check User</button>
</form>
<h2>Check IP Address for Shared Users</h2>
<form action="check_ip.php" method="POST">
<label for="ip_address">IP Address:</label>
<input type="text" name="ip_address" required>
<button type="submit">Check IP</button>
</form>
</body>
</html>