tags:

views:

52

answers:

3

Im setting a session variable on hypothetical page number 1. The user then clicks a link to go to a site off the server, and then comes back to page number 1. Problem is, the session variables i set on page one, are no longer set when the user comes back.

Is this a known issue with php, is there any work around?

I am starting the session on the page, and i am echoing the session variables after i set them to make sure they set and they are.

Not sure where to go with this.

+1  A: 

You need to store the session ID in a cookie, and then read that cookie when the user comes back.

Linus Sjögren
+1  A: 

it is possible that the session timeout has expired when the user comes back .. also i think the session has a feature to check for referrers , so u can check that too .. also make sure when the user comes back he lands on the exact same domain

Sabeen Malik
the last part of your comment, user leaves from http;//website,com but gets sent back to http;//www,website,com (punctuation changed intentionally)
Patrick
yeah thats the problem then .. the domain needs to be the exact same .. if this cant be helped .. look into session_set_cookie_params() and make it so that the domain becomes .website.com
Sabeen Malik
fixed, thank you so much, finally realize that im not crazy!
Patrick
i am glad u sorted it out :)
Sabeen Malik
+4  A: 

Are you sure you call session_start() in all the scripts that use the session variables?

Lex