Re: echo SESSION var doesn't work if unset after echo
| From: | Ashley Sheridan | Date: | Tue, 09 Dec 2008 20:12:29 +0000 |
| Subject: | Re: echo SESSION var doesn't work if unset after echo | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-284376@lists.php.net to get a copy of this message | ||
On Tue, 2008-12-09 at 19:11 +0000, ceo@l-i-e.com wrote:
> Fire up Live HTTP Headers in Firefox.
>
>
>
> My theory is that the browser is RE-requesting the data because of the private,
> must-revalidate.
>
>
>
> So it goes like this:
>
>
>
> Browser -> GET -> Ecomm: fooie ; unset Ecomm
>
> Browser -> GET -> Ecomm: [not set]
>
>
>
> If you are using Ajax and JS and whatnot, the probability of this being the culprit increases.
> :-)
>
>
>
If the php is executed because of a GET request, i.e. from a link, then
the page could well be requested twice. I've seen this happen before,
where I was adding entries to a database when a user navigated to a
certain page from a link. The way I solved it was to add a timestamp and
check to see if an exact duplicate entry had been made within the last n
seconds before adding it. You could add a time value to the session and
check against this before unsetting the session?
Ash
www.ashleysheridan.co.uk