NYCPHP Meetup

NYPHP.org

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

Kristina Anderson ka at kacomputerconsulting.com
Wed Aug 20 15:56:19 EDT 2008


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
> 
> 





More information about the talk mailing list