[nycphp-talk] preventing randomized session variable from changing when page is refreshed
Kristina Anderson
ka at kacomputerconsulting.com
Wed Aug 20 17:38:31 EDT 2008
John -- store the cart items in the $_SESSION array and only write to
the database when they check out?
I am using PHP session but this variable is being passed in, as a
unique identifier for that session/cart.
> On Wed, Aug 20, 2008 at 3:24 PM, Kristina Anderson
> <ka at kacomputerconsulting.com> wrote:
>
> > 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.
>
> You are trying to re-implement the concept of a session, poorly. Just
> use plain 'ol php sessions. There is no reason to generate your own
> session id. Forcing users to a homepage to generate a session_id is a
> really bad idea. Run session_start() on all pages, and just store the
> cart (or a key reference to the cart) in $_SESSION.
>
> -John C.
> _______________________________________________
> 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