RE: how could I solve the problem?

From: Date: Tue, 26 Sep 2000 10:22:46 +0000
Subject: RE: how could I solve the problem?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-17580@lists.php.net to get a copy of this message
<mysql trimmed> On 25-Sep-00 Wee Chua wrote: > Hi all, > How could I reset the value of $PHP_AUTH_USER and $PHP_AUTH_PW inside the > PHP authentication. The reason why I ask is because I want to let user to > reenter their username or password when they enter wrong at the first time. > But I don't how to do it, I tried to refresh the browser and the error page > remains the same, unless I open another new browser window to try it again. > I hope you understand my problem, any help will be appreciated. Thank you! > Here are the codes I user, > > <?php > if(!isset($PHP_AUTH_USER)) { > Header("WWW-authenticate: basic realm=\"Login Required\""); > Header("HTTP/1.0 401 Unauthorized"); > $title="Login screen"; > } > else { // Connect to server > blah....blah.... > > > } Send another authenticate 401 header .. function authuser($realm) { global $PHP_AUTH_USER, $PHP_AUTH_PW; if (! (isset($PHP_AUTH_USER)) ) { Header("WWW-authenticate: basic realm=\"$realm\""); Header("HTTP/1.0 401 Unauthorized"); echo "\n\n<META HTTP-EQUIV=\"Refresh\" CONTENT=\"1; URL=".SITEHOME."\">"; exit; } if (! (validlogin($realm, $PHP_AUTH_USER, $PHP_AUTH_PW)) ) { Header("WWW-authenticate: basic realm=\"$realm\""); Header("HTTP/1.0 401 Unauthorized"); echo "\n\n<META HTTP-EQUIV=\"Refresh\" CONTENT=\"1; URL=".SITEHOME."\">"; echo "Failed Login"; exit; } } Regards, -- Don Read dread@texas.net --- The problem with people who have no vices is that you can be sure they're going to have some pretty annoying virtues.

« previous php.general (#17580) next »