Re: Losing Sessions

From: Date: Wed, 16 Jun 2004 05:11:20 +0000
Subject: Re: Losing Sessions
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-188370@lists.php.net to get a copy of this message
Curt, Thanks for the reply. I am going to go ahead and change all my session variables to use the methods you described. Because I am using the session_register method, could this be the cause of my problem? That it works 90% of the time, but a couple times throughout the day the sessions just get lost? Thanks, Paul "Curt Zirzow" <php-general@zirzow.dyndns.org> wrote in message news:20040616045707.GW80292@bagend.shire... > * Thus wrote Paul Liebrand (pliebrand@imaxa.com): > > I am hosting a web site on tierranet and throughout the day sessions get > > lost. If I take the exact same code and run it on my Windows machine, I can > > run it for a week straight without any problems. I have not been able to > > figure out the problem and was wondering if anyone can provide any > > assistance or feedback. > > > > At the top of most of my pages I have the following piece of code: > > > > if (!session_is_registered("valid_user")) { > > header ("location: logon.php"); > > } > > using sesion_is_registered() depends on a couple things: > 1. register_globals is on > 2. you are using a super old method of using sessions. > > 1. if you're relying on register_global to be on that is usually > frowned upon. The best method to do sessions is usually with > $_SESSION, if you're not using an archaic versionn of php. > > // start session > session_start() > > // set a session var > $_SESSION['var'] = 'a value'; > > // check session existence > if (isset($_SESSION['var']) ) ... > > // unset session var > unset($_SESSION['var']); > > > 2. read http://php.net/session a couple of time's to > verify correct > usage. and *do* take not of the "warning" sections. > > > > Curt > -- > First, let me assure you that this is not one of those shady pyramid schemes > you've been hearing about. No, sir. Our model is the trapezoid! --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.705 / Virus Database: 461 - Release Date: 6/12/2004

« previous php.general (#188370) next »