0

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
  • 1
    Maybe the session timed out or the session ID is not stored in a cookie. Commented Sep 26, 2009 at 8:22

3 Answers 3

4

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

Sign up to request clarification or add additional context in comments.

Comments

1

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

2 Comments

the last part of your comment, user leaves from http;//website,com but gets sent back to http;//www,website,com (punctuation changed intentionally)
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
1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.