Re: looking for a class that handles cookies and sessions

From: Date: Wed, 27 Jun 2001 07:39:13 +0000
Subject: Re: looking for a class that handles cookies and sessions
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-55349@lists.php.net to get a copy of this message
> I need a class that can quickly help me set cookies and sessions, and check > up against them > > anyone have an idea where i can get one like this? If you can't find one in any of the umpteen PHP code archives linked from http://php.net/links.php, here's one I wrote for you: ----- session.inc ----- <?php if (isset($session_id)){ # Look up $session_id in your database for their data } else{ session_start(); $session_id = PHP_SESSID; # I probably the PHP_SESSID bit wrong... set_cookie('session_id', $session_id, time() + 2*365*24*60*60, '/'); # Insert default values with $session_id into your database. } ?> Simply require 'session.inc' at the tip-top of every page that needs session data. -- WARNING richard@zend.com address is an endangered species -- Use ceo@l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm

« previous php.general (#55349) next »