authentication problem
hi
i have got this code in php , but i can't undetstand few things in it. maybe anyone of you can help me out ... i don't understand if a user is prompted for a password , which one should i type to and where are the vules are checked from .. PHP_AUTH_USER <? function authenticate() { header("WWW-Authenticate: Basic realm=\":-!\""); header("HTTP/1.0 401 Unauthorized"); print("You must enter a valid login username and password to access this resource.\n"); exit; } if(!isset($PHP_AUTH_USER)){ authenticate(); } else { $c=mysql_pconnect("server.name","user","password"); mysql_select_db("dbname",$c); $q=sprintf("SELECT username,password FROM authenticateTable WHERE username='%s' AND password=PASSWORD('%s') AND ipaddress='%s'", $PHP_AUTH_USER,$PHP_AUTH_PW,$REMOTE_ADDR); $q=mysql_query($q); if(mysql_num_rows($q)==0){ authenticate(); } } ?> |
Moved to the Programming forum
|
All times are GMT -5. The time now is 12:08 AM. |