Assist with session persistance
| From: | Terry Romine | Date: | Tue, 23 Dec 2003 17:01:02 +0000 |
| Subject: | Assist with session persistance | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-173255@lists.php.net to get a copy of this message | ||
I have a site that is using $_SESSION['variablename'] for many variables that are loaded when the user first enters the site (index.php), and then referenced on each page (display.php):
ex: index.php
session_start();
$agencyID=9;
$agencyName="fremont";
$_SESSION['agencyID'] = $agencyID;
$_SESSION['agencyName'] = $agencyName;
ex: display.php
session_start();
$agencyID=$_SESSION['agencyID'];
$agencyName=$_SESSION['agencyName'];
But after awhile, the session seems to fail and I end up back at the index page because the $agencyID gets voided. Is there a timeout on sessions other than closing the browser? If so, is there a way to set timeout if one doesn't have server admin access? Should I be doing something like:
ex: display.php
session_start();
$agencyID=$_SESSION['agencyID'];
$agencyName=$_SESSION['agencyName'];
$_SESSION['agencyID'] = $agencyID;
$_SESSION['agencyName'] = $agencyName;
to update the session variables with each page?
Terry