PDA

View Full Version : PHP sessions


sojic
29th September 2008, 22:38
I have ISPConfig for 1 domain (with subdomains).

I have login form on www.domain.com with form action https://secure.domain.com.

If logged OK, in secure.domain.com I set $_SESSION['logged']=true;

I use if (!$_SESSION['logged']) { show login form }

This work only in secure.domain.com, for www.domain.com there is another session.

How to set 1 session for entire server?

till
29th September 2008, 23:48
This has nothing to do with ISPConfig. Sessions in php are normally based on cookies and cookies are domain dependant. So if you use http://www.domain.com and https://www.domain.com, it will work. if you use http://www.domain.com and https://secure.domain.com, it will not work.

sojic
30th September 2008, 15:04
So... what to do? What do you suggest?

To use only http://www.domain.com and https://www.domain.com or to "do something" to "fix" problems with sessions?

Ben
30th September 2008, 18:38
For the cookie-thing see session_set_cookie_params (http://de.php.net/manual/en/function.session-set-cookie-params.php)


Cookie domain, for example 'www.php.net'. To make cookies visable on all subdomains then the domain must be prefixed with a dot like '.php.net'.