| Index | Description |
|---|---|
| PHP_AUTH_USER | Returns the username from the authentication dialog box or a NULL value if the dialog box hasn’t been displayed. |
| PHP_AUTH_PW | Returns the password from the authentication dialog box or a NULL value if the dialog box hasn’t been displayed. |
util/valid_admin.php)
<?php
require_once('model/database.php');
require_once('model/admin_db.php');
$email = '';
$password = '';
if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) {
$email = $_SERVER['PHP_AUTH_USER'];
$password = $_SERVER['PHP_AUTH_PW'];
}
if (!is_valid_admin_login($email, $password)) {
header('WWW-Authenticate: Basic realm="Admin"');
header('HTTP/1.0 401 Unauthorized');
include('unauthorized.php');
exit();
}
?>
<?php
require_once('util/secure_conn.php'); // require a secure connection
require_once('util/valid_admin.php'); // require a valid admin user
?>
secure_conn.php file like the one shown on this page.valid_admin.php file like the one shown on this page.