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. Link to comment https://forums.phpfreaks.com/topic/117683-http-auth/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.