when I put a authentication script, a dialog box pops up and keeps asking for name/pw, ANYTHING I put (correct or wrong) it keeps asking, and after 3-4 tries it says "requires authorisation", I copied the code from php.net and from other sites, still doesnt work, do I need to "enable" this from my browser or something?
This piece of code, keeps asking me for name/pw.. even tho it doesnt even validate them.
or this:Code:<?php // File Name: auth01.php // Check to see if $PHP_AUTH_USER already contains info if (!isset($PHP_AUTH_USER)) { // If empty, send header causing dialog box to appear header('WWW-Authenticate: Basic realm="My Private Stuff"'); header('HTTP/1.0 401 Unauthorized'); echo 'Authorization Required.'; exit; } // If not empty, display values for variables else { echo " <P>You have entered this username: $PHP_AUTH_USER<br> You have entered this password: $PHP_AUTH_PW<br> The authorization type is: $PHP_AUTH_TYPE</p> "; } ?>
Code:<?php header("WWW-Authenticate: Basic realm=\"System Information\""); header("HTTP/1.0 401 Unauthorized"); print $_SERVER['REMOTE_USER']; if ( (!isset($_SERVER['$PHP_AUTH_USER'])) || (!isset($_SERVER['$PHP_AUTH_PW'])) ) { header('WWW-Authenticate: Basic realm="Private Area"'); header("HTTP/1.1 401 Unauthorized"); print "This page requires authorisation."; print $_SERVER['$PHP_AUTH_USER']; print $_SERVER['$PHP_AUTH_PW']; exit(); } else { print "You're through to the secret page, was the effort worth it?"; } ?> <html> <head> <title> .:Header password ****:. </title> </head> <body> </body> </html>




Reply With Quote