RE: [PHP] PHP: User Authentication Script

From: Date: Tue, 27 Aug 2002 01:40:11 +0000
Subject: RE: [PHP] PHP: User Authentication Script
Groups: php.general 
Request: Send a blank email to php-general+get-114208@lists.php.net to get a copy of this message
Was this before supplying the password or after? I believe this log entry may be normal when authentication fails. I also believe the message you got on your browser means that the 401 error page is missing from your apache installation. http://www.php.net/manual/en/features.http-auth.php also mentions that http auth does not work when running php as a CGI, which may also give these symptoms. Warren Vail Tools, Metrics & Quality Processes -----Original Message----- From: Anthony Ritter [mailto:tony@gonefishingguideservice.com] Sent: Monday, August 26, 2002 7:27 PM To: php-general@lists.php.net Subject: Re: [PHP] PHP: User Authentication Script Thanks for the reply Warren. It says... [Mon Aug 26 20:46:13 2002] [error] [client 127.0.0.1] malformed header from script. Bad header=HTTP/1.0 401 Unauthorized: c:/php4/php.exe ........................... ----- Original Message ----- From: Vail, Warren <Warren.Vail@schwab.com> To: 'Anthony Ritter' <tony@gonefishingguideservice.com>; <php-general@lists.php.net> Sent: Monday, August 26, 2002 7:49 PM Subject: RE: [PHP] PHP: User Authentication Script > What does your apache server log say? > > > Warren Vail > Tools, Metrics & Quality Processes > (415) 667-7814 > Pager (877) 774-9891 > 215 Fremont 02-658 ................................. > -----Original Message----- > From: Anthony Ritter [mailto:tony@gonefishingguideservice.com] > Sent: Monday, August 26, 2002 6:51 PM > To: php-general@lists.php.net > Subject: [PHP] PHP: User Authentication Script > > > Using Apache / Windows 98 / PHP / mySQL > > The following script is from Julie Meloni's book "PHP Essentials" > (PrimaTech) on page 138. > > I've copied the script from her site and tried to run it and get the > following: > > Internal Server Error > The server encountered an internal error or misconfiguration and was unable > to complete your request. > Please contact the server administrator, blah@blah.com and inform them of > the time the error occurred, and anything you might have done that may have > caused the error. > > More information about this error may be available in the server error log. > > ---------------------------------------------------------- > > Apache/1.3.12 Server at localhost Port 80 > ----------------------------------------------------------- > > The following is the script: > > <? > > if (!isset($PHP_AUTH_USER)) > > > header('WWW-Authenticate: Basic realm="My Private Stuff"'); > header('HTTP/1.0 401 Unauthorized'); > echo 'Authorization Required.'; > exit; > > } else > > > if (($PHP_AUTH_USER == "jane") && ($PHP_AUTH_PW == > "mypassword")) > > > echo "<P>You have entered this username: $PHP_AUTH_USER<br>"; > echo "You have entered this password: $PHP_AUTH_PW<br>"; > echo "The authorization type is: $PHP_AUTH_TYPE.</p>"; > > } else > > > echo "You are not authorized!"; > > } > > } > > ?> Warren Vail <Warren.Vail@schwab.com> wrote in message news:A252B2CDF6D2D4119DAB0002A51326DE09A993B0@n1028smx.nt.schwab.com... > What does your apache server log say? > > > Warren Vail > Tools, Metrics & Quality Processes > (415) 667-7814 > Pager (877) 774-9891 > 215 Fremont 02-658 > > > -----Original Message----- > From: Anthony Ritter [mailto:tony@gonefishingguideservice.com] > Sent: Monday, August 26, 2002 6:51 PM > To: php-general@lists.php.net > Subject: [PHP] PHP: User Authentication Script > > > Using Apache / Windows 98 / PHP / mySQL > > The following script is from Julie Meloni's book "PHP Essentials" > (PrimaTech) on page 138. > > I've copied the script from her site and tried to run it and get the > following: > > Internal Server Error > The server encountered an internal error or misconfiguration and was unable > to complete your request. > Please contact the server administrator, blah@blah.com and inform them of > the time the error occurred, and anything you might have done that may have > caused the error. > > More information about this error may be available in the server error log. > > ---------------------------------------------------------- > > Apache/1.3.12 Server at localhost Port 80 > ----------------------------------------------------------- > > The following is the script: > > <? > > if (!isset($PHP_AUTH_USER)) > > > header('WWW-Authenticate: Basic realm="My Private Stuff"'); > header('HTTP/1.0 401 Unauthorized'); > echo 'Authorization Required.'; > exit; > > } else > > > if (($PHP_AUTH_USER == "jane") && ($PHP_AUTH_PW == > "mypassword")) > > > echo "<P>You have entered this username: $PHP_AUTH_USER<br>"; > echo "You have entered this password: $PHP_AUTH_PW<br>"; > echo "The authorization type is: $PHP_AUTH_TYPE.</p>"; > > } else > > > echo "You are not authorized!"; > > } > > } > > ?> > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#114208) next »