本地如何使用http authentication
我在本地测试HTTP Authentication的时候无法登陆,放在买来的空间里却可以登录,请问本地如何使用authentication
我系统win 7
安装了apache 2.0 PHP 5.3 mysql 5.5
apache里的httpd.conf我也调用了AUTH,比如
LoadModule auth_module modules/mod_auth.so
LoadModule auth_anon_module modules/mod_auth_anon.so
LoadModule auth_dbm_module modules/mod_auth_dbm.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule autoindex_module modules/mod_autoindex.so
<br /> <?php<br /> $username = 'admin';<br /> $password = 'admin';<br /> if(isset($_SERVER['PHP_AUTH_USER']) &&<br /> isset($_SERVER['PHP_AUTH_PW']))<br /> {<br /> if($_SERVER['PHP_AUTH_USER'] == $username &&<br /> $_SERVER['PHP_AUTH_PW'] == $password)<br /> echo "You are now logged in";<br /> else die("Invalid username / password combination");<br /> }<br /> else<br /> {<br /> header('WWW-Authenticate: Basic realm = "Restricted Section"');<br /> header('HTTP/1.0 401 Unauthorized');<br /> die("Please enter your username and password");<br /> }<br />