A problem with sessions ("Session expired")

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Pretender
Forum Newbie
Posts: 1
Joined: Tue Aug 13, 2002 2:54 pm

A problem with sessions ("Session expired")

Post 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
?>
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post 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
Post Reply