How Sessions Work in PHP

chinmay.sahoo

New member
Good session support takes care of the following two things:

✦ Session tracking (that is, detecting whether two separate script invocations are, in fact,part of the same user session).
✦ Storing information in association with a session.


Obviously, you need the first capability before you can hope to have the second.

PHP session tracking works by a combination of the hidden-variables method and the cookie method described in the preceding section. Because of the advantages of cookies, PHP will use them when the user’s browser supports them and, otherwise, will have recourse to stashing the session ID in GET and POST arguments. Fortunately, though, the session functions themselves operate at a more abstract level and take care of checking for cookie support all by themselves. If your version of PHP5 has been appropriately configured for sessions, you should be able to use the session functions without worrying which method is being used.
 
Back
Top