NYCPHP Meetup

NYPHP.org

[nycphp-talk] preventing randomized session variable from changing when page is refreshed

Bruce Martin bmartin at mac.com
Wed Aug 20 16:10:20 EDT 2008


I think you could do that as well as set a cookie and check that as  
well. That way if the user has cookies turned off you still can track  
the session.
Bruce Martin
The Martin Solution
bruce at martinsolution.com
http://www.martinsolution.com
http://externals.martinsolution.com

On Aug 20, 2008, at 3:56 PM, Kristina Anderson wrote:

> That's what I want to do, but I need to prevent the value of session  
> id
> from changing if for some reason they revisit or refresh the index.php
> page...as that is where the value is created.
>
> I've seen discussions on here about populating a hidden field and then
> testing that to see if it's not empty as a way to handle this, I  
> think.
>
>> On Wed, Aug 20, 2008 at 3:24 PM, Kristina Anderson
>> <ka at kacomputerconsulting.com> wrote:
>>> Hi all --
>>>
>>> When visitors initially arrive on the site, a randomized session id
> is
>>> generated to track items they add to their cart.  The only problem
> is
>>> that when/if they return to/refresh the homepage during their visit,
>>> the session id changes and this will obviously result in unwanted
>>> issues.
>>>
>>> How can I prevent this from happening?  Is index.php the proper
> place
>>> to instantiate the session id?
>>
>> Use session_id() as the key for your cart. That should not change for
>> the duration of their visit.
>>
>> Mike
>>
>> -- 
>> Michael B Allen
>> PHP Active Directory SPNEGO SSO
>> http://www.ioplex.com/
>> _______________________________________________
>> New York PHP Community Talk Mailing List
>> http://lists.nyphp.org/mailman/listinfo/talk
>>
>> NYPHPCon 2006 Presentations Online
>> http://www.nyphpcon.com
>>
>> Show Your Participation in New York PHP
>> http://www.nyphp.org/show_participation.php
>>
>>
>
>
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20080820/77330244/attachment.html>


More information about the talk mailing list