/
/ajax-login.php
 1 <?php
 2 
 3 if ('authenticate' === $_SERVER['PHP_AUTH_USER'] &&
 4     'successfully' === $_SERVER['PHP_AUTH_PW']) {
 5   header('HTTP/1.1 200 OK');
 6   header('WWW-Authenticate: Basic Realm="Form-Based HTTP Auth Test"', false, 200);
 7 } elseif ($_SERVER['PHP_AUTH_USER'] || $_SERVER['PHP_AUTH_PW']) {
 8   /* Suppress the browser's login UI */
 9   header('HTTP/1.1 403 Invalid Credentials');
10   header('WWW-Authenticate: Basic Realm="Form-Based HTTP Auth Test"', false, 403);
11 } else {
12   header('HTTP/1.1 401 Log In, Bitches');
13   header('WWW-Authenticate: Basic Realm="Form-Based HTTP Auth Test"', false, 401);
14 }
15 
16 /* no caching */
17 header('Pragma: no-cache');
18 header('Cache-Control: no-cache');