Re: session or cookie
| From: | Michael Kimsal | Date: | Fri, 10 Nov 2000 21:14:21 +0000 |
| Subject: | Re: session or cookie | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-24809@lists.php.net to get a copy of this message | ||
I'll throw my 2 cents in as well...
Some of the replies to this seemed to have missed some of the point -
or weren't speaking to the specific mechanics of 'session variables'.
Session variables (in PHP, and ASP, etc) are just collections of
variable data keyed to a specific unique indentifier. It's normally some
type of 'random unique string' type ID ("ADSSDLFNOKHSDFOWE" or
something like that).
The server program (ASP, PHP, whatever) says 'I'm going to associate
a bunch of variables with this identifier string'. When the program
detects an agent coming in which indentifies itself with this
identifier, it'll activate the variables' values to whatever
their most recent values were, and process the request.
What does this have to do with cookies? Not necessarily much, except
that most servers will automatically set a cookie on the user's browser
with the unique identifier. Then, every request that browser makes
back to the server will have that unique identifier, so the server will know
to associate the variables it needs to for that request.
However, some people don't like cookies (whole 'nother topic). So they
disable their use on their browser. If this happens, the browsers' requests
won't have the same unique identifier from request to request, and the
server program will think each request is from a different 'session' (or
user, or whatever terminilogy you want). To get around this, you need to
code your HTML pages to send that identifier in every page request back
to the server, whether it's in a hidden form field, or part of the GET
string.
If you're going to use the session variable features, it's easiest to
just let the system use a cookie and handle everything transparently.
Mark Lo wrote:
> Hi,
>
> I would like to know what is the difference between session and
> cookies.
>
> Thank you
>
> Mark lo
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
--
==========================
Michael Kimsal
http://www.tapinternet.com
734-480-9961