NYCPHP Meetup

NYPHP.org

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

John Campbell jcampbell1 at gmail.com
Wed Aug 20 18:01:21 EDT 2008


On Wed, Aug 20, 2008 at 5:38 PM, Kristina Anderson
<ka at kacomputerconsulting.com> wrote:
> John -- store the cart items in the $_SESSION array and only write to
> the database when they check out?

Or store the cart in the database, and just store a key in the session
such as $_SESSION['cart_id']

> I am using PHP session but this variable is being passed in, as a
> unique identifier for that session/cart.

As a GET variable?  Why would you do this?  Cookies/sessions were
invented to making shopping carts work.

Your code to generate a session_id is pointless... ditch the
session_id code and just call session_start() on every page.  What do
you think is wrong with the default session_id generation?

-John C.



More information about the talk mailing list