Jump to content

Recommended Posts

Hi, I have been searching around for a solution for how to not lose my session values when changing directories and it seems to have to do with the location in which the session information is stored... From what I can tell, when I change to a different directory, I need to somehow tell it the proper location. e.g. As long as I stay in the main directory, e.g. www/somepage.php, everything works fine, but as soon as I go to another directory, e.g. www/another_directory/somepage.php, I no longer have any session values... However, if I return to the main directory, there they are again, still in tact.

 

EDIT: I just discovered that, it only loses the values on the navigation menu, which is located in the main directory, being called by the page that is in the different directory, not in the page that is located in the different directory.

Link to comment
https://forums.phpfreaks.com/topic/55461-change-directory-lose-session-values/
Share on other sites

I think you can do this:

 

When you set the session variables upon login or where do the following:

 

session_set_cookie_params(0,"/","domain.com");

$_SESSION['session.cookie_domain'] = "domain.com";

 

That makes the sessions available on all subdomains and such.  You can look up the parameters to make them more catered to what you need.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.