Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   PHP (http://www.programmingforums.org/forum29.html)
-   -   Sessions (http://www.programmingforums.org/showthread.php?t=220)

TerraNerd Jul 24th, 2004 11:39 PM

I just need someone to, in a simple way, describe sessions.

kurifu Jul 25th, 2004 3:50 PM

Everytime someone connect to your web browser to be served data, your system can automagically and or manually create a session. What this does is assigns a unique session ID that your browser will pass to the webserver through HTTP1.1 headers, or through cookie headers (depending on what your browser supports).

This unique ID links directly to a file in a temporary directory on the server which is used to store variables and objects on the server between pages. The session is not destroyed until the users times out from the server (inactive browsing for a definite period of time, or you manually destroy the session).

If a user logs into a webmail system, you would have to have the client constantly pass the password and username back into the server for every page reload, this is obviously very insecure, so instead you can store this data in the session ($_SESSION superglobal) which will allow the data to be used on different page view/scripts without passing the value back and forth between client and server.

Also if they are purchasing items from your website, instead of storing the shopping cart, including full prices of the purchase on the client end (where they could modify it and rip you off) you would store it in the local session preventing the user from being able to do anything more then reference that session (with the session ID).

Hopefully that clears things up for you...

Pizentios Jul 26th, 2004 9:33 AM

sessions are handy.

kurifu Jul 27th, 2004 6:17 PM

Actually I try to keep as much data away fromt he client and in the SESSION data as much as possible, in theory this could help to prevent unseen bugs related to malformed request data... which happens all too often if you ask me.


All times are GMT -5. The time now is 3:29 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC