clear contents?

From: Date: Fri, 07 Sep 2001 15:55:27 +0000
Subject: clear contents?
Groups: php.general 
Request: Send a blank email to php-general+get-66423@lists.php.net to get a copy of this message
Hi everone... I'm having a little problem. The code below pops up a password dialog box where the user types in a username and a password to be able to proceed. However, if the user does not close the browser and goes back to the link, which they pops up the diolog box again and they don't have to type in there username and password again. They are remembered. I would like it so that the user has to type in there username and password any and every time that the diolog box is called on. Doe anyone know how to do this? I tried to clear the contents of PHP_AUTH_USER and PHP_AUTH_PW at the top of the page but that just messed things up. Can someone please help me? <? session_start(); session_register("PHP_AUTH_USER"); if (isset( $PHP_AUTH_USER ) && isset($PHP_AUTH_PW)) // Connect to MySQL mysql_connect( 'l', 'c', 'c' ) or die ( 'Unable to connect to server.' ); // Select database on MySQL server mysql_select_db( 'contact' ) or die ( 'Unable to select database.' ); // Formulate the query $sql = "SELECT * FROM users WHERE username = '$PHP_AUTH_USER' AND password = '$PHP_AUTH_PW'"; // Execute the query and put results in $result $result = mysql_query( $sql ) or die ( 'Unable to execute query.' ); // Get number of rows in $result. $num = mysql_numrows( $result ); if ( $num != 0 ) // A matching row was found - the user is authenticated. $auth = true; } } if ( ! $auth ) header( 'WWW-Authenticate: Basic realm="Private"' ); header( 'HTTP/1.0 401 Unauthorized' ); echo 'Authorization Required.'; exit; } else session_start(); } if ($valid != "yes") { header("Location: contact_menu.php"); exit; } ?>

« previous php.general (#66423) next »