simple authentication not working

From: Date: Wed, 18 Oct 2000 12:58:51 +0000
Subject: simple authentication not working
Groups: php.general 
Request: Send a blank email to php-general+get-20884@lists.php.net to get a copy of this message
Hello, Thanks to everyone who have helped me so far. I'm trying to see if I can use PHP to authenticate users on my virtual server using http basic method (401). When I upload and run this script, the challenge dialog does come up, but it keeps repeating infinitely. My expected behavior is that it will run once and simply display the values entered. I would like to know if the script is wrong or my host's server isn't capable of this. The server runs Zeus 3.3 and is a sparc running Solaris. <?php // File Name: auth.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 { ?> <html> <head> <title>Auth Test</title> </head> <body> <?php 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> "; } ?> </body> </html>

Attachment: [application/x-pkcs7-signature] smime.p7s
« previous php.general (#20884) next »