Re: Full-Bore Linear Panic
| From: | Jesse Swensen | Date: | Wed, 09 Aug 2000 00:50:23 +0000 |
| Subject: | Re: Full-Bore Linear Panic | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-10810@lists.php.net to get a copy of this message | ||
I believe this to be a cookie problem. I am sure there is a more technical
answer, but let me attempt to explain what my experience has been.
If you create a script that does the following:
set the cookie
check the cookie just set
I believe it will fail to find the cookie. My experience has shown the
cookie unavailable until the next page is built. So if you do the
following:
set cookie
display something
and then a new script is called:
check the cookie
it will be available.
There are several work arounds. PHPLib does what I think is a pretty good
way of handling this "problem". If the cookie is new it submits a redirect
to the same script that called it the first time and adds as a query string
the cookie values. If you dig into the Session.inc file and try to
understand what it does with the cookie, I think it would help you.
Of course, this may also be as clear as mud, but I gave it a shot...
--
Jesse Swensen
swensenj@bellsouth.net
> From: David VanHorn <dvanhorn@cedar.net>
> Date: Tue, 08 Aug 2000 15:07:15 -0500
> To: "php general" <php-general@lists.php.net>, <mysql@lists.mysql.com>
> Subject: [PHP] Full-Bore Linear Panic
>
>
> I just hit a large bug.
>
> As part of my authentication, I pass the browser a random cookie for use on
> the next page.
> I then get the cookie the browser sent me, and check the DB. If that cookie
> exists, then I write the new cookie for next time. If not, I do nothing,
> and the cookie I passed is not valid (since it didn't get written).
>
> That works fine..
>
> Later in some scripts, I use the cookie value to pull up the user information.
> Here, it fails, UNLESS: I add in sleep(1) before the cookie check.
>
> In the failed case, when I check the cookie value I was looking for, it IS
> present in the databaase, and a manual query through MySQL confirms this.
>
> I can absolutely trigger this problem by removing the sleep statement
> before the second cookie check.
>
> It seems that when I stored the cookie, it didn't happen in time for the
> next part of the script to check.
>
>
>
>
> --
> Where's dave? http://www.findu.com/cgi-bin/find.cgi?kc6ete-9
>
>
>
> --
> 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
>
>