ratcateme Posted August 1, 2008 Share Posted August 1, 2008 i am trying to implement HTTP authentication this is what i have so far $users = array("scott:".md5(a)); function authenticate($test) { header('WWW-Authenticate: Basic realm="Auth"'); header('HTTP/1.0 401 Unauthorized'); echo "You must enter a valid login ID and password to access this resource{$test}\n"; exit; } $auth = false; if (!isset($_SERVER['PHP_AUTH_USER']) && !isset($_SERVER['PHP_AUTH_PW'])) { authenticate(print_r($_SERVER,true)); } elseif (in_array("{$_SERVER['PHP_AUTH_USER']}:".md5($_SERVER['PHP_AUTH_PW']),$users)) { $auth = true; } if (!$auth) authenticate(); after i enter a user and password $_SERVER has no PHP_AUTH_USER or PHP_AUTH_PW what am i doing wrong Scott. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.