"Matthew Sims" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > >> The $_SESSION['sid'] will follow from page to page. As long as the user > stays in the current session, all $_SESSION variables will follow from > page to page as long as session_start() is used. > > > > OK, but HOW do you manage that the user stays in the current session. > Usually this is made sure by passing the session id around. But > obviously > > you are not doing this, are you? > > > > Torsten > > > > As long as the user keeps his browser pointing at your site, then they'll > stay in the currect session. The moment they shut down the web browser, > the session is lost.
This does only work *with* using a cookie. > > When the user first comes to your site, assign the session_id to a > $_SESSION variable. Then as the user jumps from page to page, check the > $_SESSION variable with the session_id on that page. > > Try this, on the front page: > > session_start(); > $_SESSOIN['sid']=session_id(); > > On another page: > > if ($_SESSION['sid']==session_id()) { > continue browsing; > } else { > redirect to front page; > } > > or however you want it to be. The above isn't tested. Not sure if > session_id needs to be assigned to a variable. > > Is this what you're referring to or am I just misreading what you're asking? No, this is exactly what I wanted to know. But it would contradict everything I experienced with sessions until now - and it does. I just tested your code (with session_start() also at the top of page2). It does not work because there is absolutely no relation between page1 and page2 with your code. In this case a new session is being started on page two. You have got to pass the session id from one page to another (when not using a cookie) otherwise it won't work and rightly so. Maybe your memory played a trick on you ;) Don't mind. Regards, Torsten -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php