bofett Posted June 1, 2009 Share Posted June 1, 2009 I have a site which has identical sub sites but for different regions. For example... www.site.com/us/ca/sitea www.site.com/us/az/siteb www.site.com/us/nv/sitec Each site has a different name and DB, most likely different users. My problem is that if a user logs into sitea and then goes to siteb (without logging off), the system gets confused and may see them as a different user. Its like the session is being set for the main url of www.site.com. This allows access to the wrong user information. Is there a way to assign an additional value (like ca or nv) to session_start(); for each site? Or can you have the session set with more url info like www.site.com/us/ca/? Thanks for the help. Link to comment https://forums.phpfreaks.com/topic/160512-solved-session_start-problem/ Share on other sites More sharing options...
PFMaBiSmAd Posted June 1, 2009 Share Posted June 1, 2009 You need to set the session cookie path to / ref: http://us.php.net/manual/en/session.configuration.php#ini.session.cookie-path Link to comment https://forums.phpfreaks.com/topic/160512-solved-session_start-problem/#findComment-847153 Share on other sites More sharing options...
bofett Posted June 1, 2009 Author Share Posted June 1, 2009 You need to set the session cookie path to / ref: http://us.php.net/manual/en/session.configuration.php#ini.session.cookie-path Thank you for your reply. Should I set this in my php file before session_start(); by using ini_set( 'session.cookie_path', '/' ); or in php.ini with session.cookie_path = /? Also, can or should I use a variable which showes which url like us/ca or us/nv? I am asking because I have been trying it different ways and it is still not working. Thanks again. Link to comment https://forums.phpfreaks.com/topic/160512-solved-session_start-problem/#findComment-847329 Share on other sites More sharing options...
bofett Posted June 2, 2009 Author Share Posted June 2, 2009 I have been able to make it work in Firefox with this code but IE8 doesent seem to be setting a cookie so its not working in IE8? include("config.php"); ini_set('session.cookie_path', '/'.$sitest.'/'); session_start(); config code... $sitest = "us/ca"; I appreciate any help on this. Link to comment https://forums.phpfreaks.com/topic/160512-solved-session_start-problem/#findComment-847899 Share on other sites More sharing options...
bofett Posted June 2, 2009 Author Share Posted June 2, 2009 Problem solved! I had to add ini_set('session.cookie_path', '/'.$sitest.'/'); to my logout.php file as well Thanks for your help. Link to comment https://forums.phpfreaks.com/topic/160512-solved-session_start-problem/#findComment-847959 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.