Re: [PHP] session lost when back button hit?

2002-08-17 Thread Justin French

on 17/08/02 4:01 PM, Jean-Christian Imbeault ([EMAIL PROTECTED])
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


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] session lost when back button hit?

2002-08-16 Thread Jean-Christian Imbeault

I have two pages, page one links to page two via a form button. The 
browser does not accept cookies.

On page two I create a session variable with:

$_SESSION[id] = 1;

But if I hit the back button to go back to page one $_SESSION[id] is 
not set. If I hit the reload button on page one it is still not set.

How can I get a session var to stay set when someone hits the back button?

Jc

PS I have session.auto_start ON and enabled trans-sid


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] session lost when back button hit?

2002-08-16 Thread Daniel Masson


HI

make ser youre using session_start() before performing any action on
sessions, also make sure you´re registering properly the variables.


-Mensaje original-
De: Jean-Christian Imbeault [mailto:[EMAIL PROTECTED]] 
Enviado el: viernes, 16 de agosto de 2002 9:43
Para: [EMAIL PROTECTED]
Asunto: [PHP] session lost when back button hit?


I have two pages, page one links to page two via a form button. The 
browser does not accept cookies.

On page two I create a session variable with:

$_SESSION[id] = 1;

But if I hit the back button to go back to page one $_SESSION[id] is 
not set. If I hit the reload button on page one it is still not set.

How can I get a session var to stay set when someone hits the back
button?

Jc

PS I have session.auto_start ON and enabled trans-sid


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] session lost when back button hit?

2002-08-16 Thread Jean-Christian Imbeault

Daniel Masson wrote:
 
 make ser youre using session_start() before performing any action on
 sessions, also make sure you´re registering properly the variables.

Did you see my PS at the end of my question?

 PS I have session.auto_start ON and enabled trans-sid

I don't need seesion_start() and I don't need to register the variable 
since I am setting it directly with $_SESSION[id] = 1

If I am wrong about this please correct me, I'm still new to sessions.

Jc


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] session lost when back button hit?

2002-08-16 Thread Alok K. Dhir


By any chance, is page one the entrance page to your application?
I.e. is there a session id in either the query string of the page URL or
was there one passed to it via a POST?

Without cookies enabled, there is no way to allow users to use the back
button to go back to the entrance page while maintaining the session.

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.

Good luck.

 -Original Message-
 From: 
 [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED]
 .net] On Behalf Of Jean-Christian Imbeault
 Sent: Friday, August 16, 2002 10:43 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] session lost when back button hit?
 
 
 I have two pages, page one links to page two via a form button. The 
 browser does not accept cookies.
 
 On page two I create a session variable with:
 
 $_SESSION[id] = 1;
 
 But if I hit the back button to go back to page one 
 $_SESSION[id] is 
 not set. If I hit the reload button on page one it is still not set.
 
 How can I get a session var to stay set when someone hits the 
 back button?
 
 Jc
 
 PS I have session.auto_start ON and enabled trans-sid
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] session lost when back button hit?

2002-08-16 Thread Jean-Christian Imbeault

Alok K. Dhir wrote:

 By any chance, is page one the entrance page to your application?

Yes.

 I.e. is there a session id in either the query string of the page URL or
 was there one passed to it via a POST?

Nope. Is the is the entrance so there is no nothing passed to it. Users 
just enter the URL in the location bar, for example, and come in.

 Without cookies enabled, there is no way to allow users to use the back
 button to go back to the entrance page while maintaining the session.

Really? I just turned cookies and javascript off and then visited 
Amazon.com. I added an item to my cart, hit the back buttonall way back 
to the entrance and then checked my cart ... lo-and-behold the item was 
in my cart still. How did they do that?

 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.

Thanks for the info!

Jc


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php