Re: session lost when back button hit?

From: Date: Sat, 17 Aug 2002 06:27:59 +0000
Subject: Re: session lost when back button hit?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-113061@lists.php.net to get a copy of this message
on 17/08/02 4:01 PM, Jean-Christian Imbeault (jean_christian@myrealbox.com) wrote: >> One (hackish) solution to this is to cause the entrance page to >> immediately redirect to itself using either PHP's header function, or a >> meta refresh. Your goal here is to make it so that hitting back from a >> secondary page would take you to the post-refreshed entrance page which >> has the session ID. > > Ok. Can you explain this in more detail? I understand the concept you > are suggesting but I can't picture how to do this in PHP. Something like: If there isn't a session, start one and redirect to the same page WITH the session id, otherwise just continue the session. In theory, you should always get a session ID in the URL of startpage.php. But I can't stress enough, this is all theory -- the code hasn't been tested at all... nor particularly thought through :) startpage.php: <? // untested code if(!isset(session_id())) { session_start(); header("Location: startpage.php?PHPSESSID=".session_id()) } else { session_start(); } ?> <HTML> ... </HTML> Justin French

« previous php.general (#113061) next »