PHP Authenticate

From: Date: Sun, 04 Feb 2001 17:19:23 +0000
Subject: PHP Authenticate
Groups: php.general 
Request: Send a blank email to php-general+get-38114@lists.php.net to get a copy of this message
Hi... I have a problem with PHP Authenticate.... ...if I enter user/pw wrong the first time it stops and I have to close/open browser.! I've tried to unset $PHP_AUTH_USER but then it just loops... if(!isset($PHP_AUTH_USER)) { Header("WWW-Authenticate: Basic realm=\".: Privat område :.\""); Header("HTTP/1.0 401 Unauthorized"); echo "<br><font face=\"arial, helvetica, sans-serif\" size=\"2\" color=\"#0060CF\">Secured Area!</font>"; exit; } else { $PHP_AUTH_PW_ENCRYPTED = crypt("$PHP_AUTH_PW", "wP"); $connect = mysql_connect($hostname,$username,$password) or die ("Klarer ikke koble til MqSQL db..."); $query = "SELECT * FROM forfatter"; $query .= " where id = $PHP_AUTH_USER"; $result = mysql_db_query($db, $query); while($row = mysql_fetch_array($result)) { $id = $row["id"]; $navn = $row["navn"]; $pw = $row["pw"]; } if (($id == $PHP_AUTH_USER) AND ($pw == $PHP_AUTH_PW_ENCRYPTED)) $bruker_ok = true; } else exit; } } --------------------------------- Fredrik A. Takle fredrik@takle.net

« previous php.general (#38114) next »