Re: Cookie problem
| From: | Chris Lee | Date: | Mon, 26 Mar 2001 15:39:04 +0000 |
| Subject: | Re: Cookie problem | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-45628@lists.php.net to get a copy of this message | ||
I have to agree Nuno, sessions are alot easier/simpler.
--
Chris Lee
lee@mediawaveonline.com
"Nuno Silva" <nuno_silva@websolut.net> wrote in message news:3ABE9E01.1070902@websolut.net...
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.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net