You are here: Re: Session « PHP Programming Language « IT news, forums, messages
Re: Session

Posted by Dikkie Dik on 03/17/06 21:49

>> I m newbie in PHP . I m not able to know what exactly the use of
>> session is. How can one keep the track of users using Session..


The comparison is not 100% valid, but I usually compare a session to a
shopping cart or a wardrobe.

When you enter a site, you get some space assigned to you. But usually
without the site knowing who you are. The site does not need to know who
you are exactly, the site just needs to distinguish the users.
This could be done like in a theater wardrobe: you get a token (a
ticket) that you have to hand back to access the space that is assigned
to you and holds your coat, bag or umbrella. While in the theater, you
can have access any time by just handing over the ticket. You might even
leave the theater for a few minutes and be able to access "your" private
space.
The comparison with a shopping cart comes from the fact that it is
usually the site's stuff you put in your private space. Like IDs of
items you ordered, your UserID if you are known to the site, etc.

The main difference to the above analogies is that you do not remain
with your cart. Well, in the theater, you do not stay at the wardrobe
counter either. You come in and deposit your cloak, during the coffee
break you decide to get your handkerchief out of your pocket, and you
recollect your coat after the show. The only times that you are at
"your" assigned space is when you get or hand over the wardrobe ticket.

It is like that when you visit a website that remembers the state
between pages. Most often, this is done by giving you a cookie (the
wardrobe ticket) that serves no other purpose than to bind some server
space to a visitor. Your browser hands over the cookie when you visit
the site, so your state can be retrieved by the server. But if you wait
to long, this (session) cookie will be expired and the space is given
free for other users.
The session itself is just data storage: a file or a part of a database.

Best regards

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация