Login page vs. htpasswd - Which is more secure?
snippet in htaccess
Login page vs. htpasswd - Which is more secure?
user5077
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="MY REALM"');
header('HTTP/1.0 401 Unauthorized');
echo 'Please Contact us if you are having problems logging in';
exit;
} else {
//not their first time through
//check their username and password here
$username = trim($_SERVER['PHP_AUTH_USER']);
$password = trim($_SERVER['PHP_AUTH_PW']);
//do login
}