Re: Re: [PHP3] Sessions - PHP Vs. ASP
| From: | Kris Dahl | Date: | Fri, 30 Jun 2000 20:09:43 +0000 |
| Subject: | Re: Re: [PHP3] Sessions - PHP Vs. ASP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-4132@lists.php.net to get a copy of this message | ||
on 6/30/00 12:50 PM, Richard Lynch at richard@zend.com wrote:
> In article <20000620162553.28725.qmail@web3706.mail.yahoo.com>,
> thomasedisonjr@yahoo.com ("Thomas Edison Jr.") wrote:
>
>> How different are PHP sessions from ASP sessions? How
>> do u really use sessions in PHP? I'm from an ASP
>> background and i always found sessions to be one of
>> the most usefull things in ASP.
>
> ASP sessions use cookies, and if the user refuses cookies, you're screwed,
> but Microsoft buries that fact 'way in their docs, and mostly refers to
> session variables as if they just always work by magic.
One thing I learned really quickly when I started developing web
applications that depended on remembering sessions is that cookies is not a
good idea. I mean its really convenient if everyone had a browser that
supported them and everyone has then enabled. But the truth is that in my
experience > 25-35% of the users have turned off cookies for some reason or
another.
I actually did some tracking of this for one site that we built.
After that site, I decided cookies excluded too many users. We use cookies
to add to the experience but the site can't rely on them.
We encode the sid's as Richard describes in the GET/POST query strings.
These sid's are necessary for shopping cart type functionality, etc. Most
if not all major e-commerce sites do it this way.
We also track individual users, so that we can customize content for them,
when they come back to the site, etc.. These features are cool, but not
necessary to be able to use the site. So we're okay with it not working for
everyone--and the only choice we have is to use cookies. So we set the
cookie for the uid/cid (user/customer) and if its there, then great, if not,
its their loss. Again, this is typically the way the major sites do it as
well.
-k