Page 1 of 1

A problem with sessions ("Session expired")

Posted: Tue Aug 13, 2002 2:54 pm
by Pretender
I work with PHP 4.0.6 for Windows
If I turn session.auto_start on (session.auto_start=1) always, when I click "Back" button on my web-browser, "Session Expired" message appear. Is this normal or not? Furthermore, if I start session with session_start() function, it doesn't works??? That's my code:

file 1.php:
<FORM ACTION="2.php">
............
<?php
session_start();
session_register("x");
if (session_is_registered("x")) ....... - this doesn't work
?>

file 2.php:
..........
<?php
if (session_is_registered("x")) ....... - this doesn't work too
?>

Posted: Tue Aug 13, 2002 4:33 pm
by twigletmac
When you are using sessions, session_start() should be at the very top of any file in which you set or try and use session variables. By at the very top I mean before anything else, HTML, PHP whatever. I know you're using 4.0.6 but could register_globals be off in your php.ini?

Mac