Re: Sessions

From: Date: Sat, 17 May 2003 15:43:29 +0000
Subject: Re: Sessions
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-148025@lists.php.net to get a copy of this message
Thanks guys, All i want is basically to get the username/pass from a form and then pass it to my pages plus the page should expire in n minutes (using cookies i guess??? have not done that yet) Another reason I wanted to do this is coz i know sessions are important and i didnt have a clue about them, never used them before. Cheers. -Ryan > > 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 (#148025) next »