tekrscom Posted June 13, 2007 Share Posted June 13, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/55461-change-directory-lose-session-values/ Share on other sites More sharing options...
Link Posted June 13, 2007 Share Posted June 13, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/55461-change-directory-lose-session-values/#findComment-274149 Share on other sites More sharing options...
tekrscom Posted June 13, 2007 Author Share Posted June 13, 2007 I just tried it, it didn't work. Quote Link to comment https://forums.phpfreaks.com/topic/55461-change-directory-lose-session-values/#findComment-274184 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.