Here is a very simple example that doesn't check anything against a database.
PHP Code:
if(ini_get('register_globals') == false) {
extract($HTTP_SERVER_VARS);
}
if(!isset($PHP_AUTH_USER, $PHP_AUTH_PW) or $PHP_AUTH_USER != 'username' or $PHP_AUTH_PW != 'seekrit') {
header("HTTP/1.0 401 Authorization Required");
header('WWW-Authenticate: Basic realm="please login"');
die('You entered an incorrect username/password combination.');
}
Username/User ID is 'username'
Password is 'seekrit'