Re: shopping cart remembers cart with COOKIES instead of SESSION?
| From: | Michael Kimsal | Date: | Sat, 02 Dec 2000 20:06:23 +0000 |
| Subject: | Re: shopping cart remembers cart with COOKIES instead of SESSION? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-28387@lists.php.net to get a copy of this message | ||
You would've had to do some *extra* work, I think, to get
PHP sessions to NOT use cookies - it seems they're the default
session mechanism. I don't know how you'd -
Oh! I get it. You want the actual contents of the shopping
cart to be in the cookie? That might not be a good idea for a couple
reasons.
1. Cart data could get quite big - I believe many browsers have a
4k limit on cookie size. Even if there's no limit, that cookie
data will get sent back with every request to your domain - even
graphic requests. A cookie with 3k of data of data, hitting a page
with 10 elements (html and graphics) can lead to 100s of thousands
of wasted transfer during a moderate shopping session.
2. Someone could look at the cookie and possibly modify it. If you're
trying to enforce purchasing limits, (only 2 of X if you purchase Y
or something like that) you'll run into problems.
Why not just make the session ID in a cookie and make the
cookie's expiration date months in the future?
Yes, not everyone accepts cookies. Nor does everyone accept
javascript. Not everyone uses the web. Cookies vs. no cookies?
It can be a tough call, but you've got to weigh the benefits
of development time vs. potential reduced audience. Only you can make
that call.
Derek Sivers wrote:
> Does anyone know a free PHP shopping cart out there that uses COOKIES to
> remember someone's cart contents?
>
> The cart I use now does it with PHP4 sessions, but that means if you close
> your browser and come back, all your items are gone.
>
> I'd like to keep my php4 cart, but move it to cookie-style, to keep those
> carts going for months. (As optional, for those who have cookies of course.)
>
> Any advice, URLs, recommendations, pointers, appreciated.
>
> Thanks!
--
==========================
Michael Kimsal
http://www.phphelpdesk.com/search/
PHP Training courses
http://www.tapinternet.com/php