Re: password-protecting with PHP, help plz

From: Date: Mon, 20 Sep 2004 00:58:55 +0000
Subject: Re: password-protecting with PHP, help plz
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-197226@lists.php.net to get a copy of this message
Try this. Add it to the very beginning. <?php if(!isset($PHP_AUTH_USER)){ header( "WWW-Authenticate: Basic realm=\"Are you allowed?\""); header( "HTTP/1.0 401 Unauthorized"); echo "Consult your teacher to have a valid login ID and password to access this page!\n"; exit; }else{ if ( ( ($PHP_AUTH_USER == "john") && ( $PHP_AUTH_PW == "english" )) || ( ($PHP_AUTH_USER == "eric") && ( $PHP_AUTH_PW == "english" )) ) { # echo "you are in"; ?> AceZero2790@aol.com wrote: > You were right, my display_error function was turned off. I turned it on and > get this: > > Parse error: syntax error, unexpected T_IS_EQUAL in c:\TSW\pages\testing2.php > on line 3 > > So it isn't working. How do I get to let me make comparisons between the post > data and something else? I figure if I can get it so that this will work, > it'll be an easy way to password protect my pages... > > -Andrew -- John Taylor-Johnston ----------------------------------------------------------------------------- "If it's not open-source, it's Murphy's Law." ' ' ' Collège de Sherbrooke: ô¿ô http://www.collegesherbrooke.qc.ca/languesmodernes/ - 819-569-2064 °v° Bibliography of Comparative Studies in Canadian, Québec and Foreign Literatures /(_)\ Université de Sherbrooke ^ ^ http://compcanlit.ca/ T: 819.569.2064

« previous php.general (#197226) next »