Click to See Complete Forum and Search --> : Question about reliability of sessions


damon2003
11-13-2003, 05:08 AM
Hi,
I am using textfields and a hidden field to pass information from one page to the next. On the next page I store all the passed info into individual sessions. Then the user goes to a new page where the information is mailed somewhere.

This works fine the vast majority of the time.
However, every so often an email is received and the session information is not there. Are sessions 100% reliable??
The user has to enter the information in the first place because there is validation on the textfields. What about if the user left the browser static for too long? I am using 'GET' as the submit method by the way,
thanks

Khalid Ali
11-13-2003, 06:43 AM
My Personal point of view could be drastically wrong..;)

No I will not trust PHP sessions for persistence,Id rather store values in a Database and then retrieve them.
But thats coud only be me..

pyro
11-13-2003, 07:05 AM
Unless you pass the sessions manually (http://us2.php.net/manual/en/ref.session.php#session.idpassing), they rely on cookies. Perhaps that is the problem? You might also want to look at http://us2.php.net/manual/en/function.session-cache-expire.php.

damon2003
11-13-2003, 10:00 AM
what do you mean by pass the sessions manually?

pyro
11-13-2003, 10:14 AM
Did you take a look at the first link I posted? Basically you just need to pass it through the URL paramater. So, you'd rewrite your links to look something like this:

<?PHP
session_start(); # put at the top of the page
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Example</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<p><a href="somepage.php?PHPSESS=<?PHP echo session_id(); ?>">link</a></p>

requestcode
11-13-2003, 02:03 PM
Isn't there a time limit on sessions that is determined by a setting in the PHP.ini file? I ran into the same problem a while ago and I believe I had to adjust it there. It has been a while so I am not sure.

Edit:
Sorry pyro I should have look at the links you posted. I see you already pointed that out.

pyro
11-13-2003, 02:18 PM
No problem... If you wouldn't have visited the link, you'd have no idea what I was talking about. I probably could have specified where that was taking them, eh? ;)