Re: Cookie problem
| From: | Nuno Silva | Date: | Mon, 26 Mar 2001 01:40:17 +0000 |
| Subject: | Re: Cookie problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-45573@lists.php.net to get a copy of this message | ||
Hello,
short:
try removing the third parameter to setcookie and if the errors go away you know it's a cookie problem :)
long:
you're setting auth based in the (server's) time + 600sec. If the client (or even the server) has a clock skew... well.... bad luck :)
removing the third parameter makes php create a "session cookie" that will stay there until the browser is closed (alll the windows).
If this is not a problem, let it be. I love session cookies!! :)
Anyway, the best method to get decent auth are sessions. Try php4's sessions or phplib or something.
Regards,
Nuno
Martin Skjöldebrand wrote:
I'm experiencing all kinds of problems with, what we suppose is the cookie setting. This is the code: if (isset($authentication)) { setcookie("status", $status, time()+600); setcookie("user", $user, time()+600); setcookie("group", $group, time()+600); setcookie("authentication", $authentication, time()+600); setcookie("laston", $laston, time()+600); } else { setcookie("status", "Logged In", time()+600); setcookie("user", $txtUsername, time()+600); setcookie("group", $row[4], time()+600); setcookie("authentication", "YES", time()+600); setcookie("laston", $row[6], time()+600); } (I have not coded this). What seems to happen is that - with alarming regularity - people are getting logged off when choosing item from a menu. Either they are thrown out into the log on-screen or (as has happened to me recently) the app simply states I'm not logged on even if I am in the middle of using it (and must have logged on). I'm not at all familiar with cookies (yet) but suspect that the timing of the critters could be a culprit. IS this correct? How do I solve the problem? M.