[nycphp-talk] preventing randomized session variable from changing when page is refreshed
John Campbell
jcampbell1 at gmail.com
Wed Aug 20 17:27:04 EDT 2008
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.
More information about the talk
mailing list