LittleJoe Posted January 27, 2013 Share Posted January 27, 2013 If I have a website, say example.com, and I use PHP sessions to store the login details, can I then access the same session from my.example.com and another.example.com? I need a website with subdomains that have different purposes but the user should only have to log in once at the root domain. Link to comment Share on other sites More sharing options...
Krewe Posted January 28, 2013 Share Posted January 28, 2013 Just point the database connection to the same database. There should be no problem with that. Link to comment Share on other sites More sharing options...
birbal Posted January 28, 2013 Share Posted January 28, 2013 you need to use http://php.net/manual/en/function.session-set-cookie-params.php to set domain of your site and rest of your subdomain will have same same session. Apart from using this on each script you can also change corresponding field in php.ini to do the same thing. Link to comment Share on other sites More sharing options...
xhtmlchamps1 Posted January 28, 2013 Share Posted January 28, 2013 Hello friend, Sessions names must be same for all websites, then all of the websites must be opened in the same browser.then you can get succeeded in the above task. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now