Update of /cvsroot/phplib/php-lib-stable/pages
In directory usw-pr-cvs1:/tmp/cvs-serv24312
Modified Files:
defauth.php3
Log Message:
fix a long-standing problem that prevented the demo "relogin" from working as expected.
Index: defauth.php3
===================================================================
RCS file: /cvsroot/phplib/php-lib-stable/pages/defauth.php3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** defauth.php3 2000/04/17 16:40:06 1.1.1.1
--- defauth.php3 2001/08/18 09:41:19 1.2
***************
*** 18,21 ****
--- 18,32 ----
// NOTE: We are using Example_Default_Auth here...
page_open(array("sess" => "Example_Session", "auth" => "Example_Default_Auth", "perm" => "Example_Perm", "user" => "Example_User"));
+
+ // Remove the "again=yes" from QUERY_STRING. This is required
+ // because the login form will be submitted to the URL of this
+ // page. This URL is constructed from $PHP_SELF and $QUERY_STRING.
+ // So, we need to remove this parameter from QUERY_STRING or else
+ // after the user submits a username and password, we will unauth
+ // them before they even get logged in!
+ $QUERY_STRING = ereg_replace(
+ "(^|&)again=yes(&|$)",
+ "\\1", $QUERY_STRING);
+
$auth->login_if($again); // relogin, if this was requested...
$user->register("u"); // register our user variable...
|