Date: 11/21/00
- Next message: Philip Strnad: "[phplib] optional form fields"
- Previous message: Douglas Forrest: "[phplib] Using cookies with phplib to enable automatic login"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Code was correct but testing was wrong.
Cookie was being set properly but was not displayed until refresh.
Thanks.
----- Original Message -----
From: Douglas Forrest
To: phplib <email protected>
Sent: Tuesday, November 21, 2000 5:31 PM
Subject: Using cookies with phplib to enable automatic login
I want the main page of my site to recognize a returning user (like Amazon, etc.) without forcing them to re-login on every visit. There was a series of questions about this earlier this year (look up "permanent session") but the answers seemed to require abandoning phplib, which I do not want to do.
I am using phplib to require login and authentication on the user preferences page (functionality like Amazon does with account preferences) but session data expires when the browser is closed and user-specific data, with or without a "nobody" default, requires login as the appropriate user.
Using modifed versions of the examples classes, I am trying to use cookies like this:
<?php page_open(array("sess" => "my_Session", "auth" => "my_Challenge_Crypt_Auth", "user" => "my_User"));
$expiredate = mktime(0,0,0,1,1,2004);
SetCookie("MyCookie", $auth->auth["uid"], $expiredate,"/",".mydomain.com");
-- rest of page printed from templates here---
page_close()
?>
The problem is that the cookie is not set when the user logs in. It does get set if the page is refreshed via a submit button. How can I set the cookie immediately after the log-in? Or is there a better way to do this?
Thank you very much.
- Next message: Philip Strnad: "[phplib] optional form fields"
- Previous message: Douglas Forrest: "[phplib] Using cookies with phplib to enable automatic login"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

