RE: [PHP] Sessions

From: Date: Sat, 17 May 2003 15:19:44 +0000
Subject: RE: [PHP] Sessions
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-148024@lists.php.net to get a copy of this message
> I have searched google and have gotten too many results and most of them > too > advanced for me, can anyone of you recomend a good sessions totural? > > I did search the php old posts but they were all pretty old and as i > understand it there have been some changes in PHP sessions lately right? > > I am brand new to sessions and just about starting to get the hang of PHP. > > I dont examples from you guys, just a URL for a guy starting out with > sessions that is easy and pretty much in baby steps as looking at other > peoples session code has just gotten me confused. Sessions are a breeze if you have register globals OFF. Simply put session_start() on each page you want to use them. Then, just use the $_SESSION variable to store whatever you want. It's an array, so make a key and store anything... session_start() $_SESSION['foo'] = 'bar'; $_SESSION['my']['array'] = 'something'; if(isset($_SESSION['admin'])) { do_something(); } etc... If you're just talking about "using" sessions, that's all there is to it. Now anything you've assigned to $_SESSION will be available on any page with session_start(). Now, it can get more complex with custom session handlers, handling users who deny cookies, etc. The user comments in the manual provide some insight here. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/

« previous php.general (#148024) next »