Recently want to add a simple user name verification mechanism in the Web page, because previously used Sina cloud HTTP authorization authentication method, as a single page verification naturally more appropriate.
In fact, the HTTP user authentication method is very simple, by judging $_server[' Php_auth_user ') and $_server[' PHP_AUTH_PW '] two values to post a simple example:
if (!isset($_SERVER['PHP_AUTH_USER'])) { header('WWW-Authenticate: Basic realm="My Realm"'); header('HTTP/1.0 401 Unauthorized'); echo'Text to send if user hits Cancel button'; exit;} else { echo"Hello {$_SERVER['PHP_AUTH_USER']}.
"; echo"You entered {$_SERVER['PHP_AUTH_PW']} as your password.
";}?>
In the else of the above code, determine if the user name and password are the same as specified.
'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
'). Text (i)); }; $numbering. FadeIn (1700); }); });
The above describes the HTTP authorization implementation of a simple Web user password verification, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.