Page 1 of 1

I seem to have mutliple sessions.

Posted: Mon Jan 29, 2007 4:27 am
by impulse()
I have been hacking at a calendar all last week and it's come to the point now where I seem to have 2 sessions. When a user logs into the calendar it created a $_SESSION["login"] = <username> variable. But if I print_r the $_SESSION variable from another page then $_SESSION is empty. And if I assign a value to $_SESSION["test"] anywhere that <b>isn't</b> the login page then I can view it anywhere besides the login page. It's as if the login page and the rest of the calendar are seperate $_SESSION variables.

Has this problem been known before?

Regards,

Posted: Mon Jan 29, 2007 8:25 am
by feyd
It's not likely to be a problem with PHP, but your code or possibly your configuration choices. If you run phpinfo() what does the session section say during the login page and during another page? If you look at your cookie information regarding the session, what is the domain and path set to in each instance?

Posted: Mon Jan 29, 2007 8:30 am
by superdezign
Are you forgetting session_start() at the top of each page using the session?

Posted: Mon Jan 29, 2007 8:47 am
by impulse()
I found a function called

Code: Select all

session_name
in the code. Removing this seemed to sort the problem.

Posted: Mon Jan 29, 2007 8:50 am
by feyd
That can most certainly help create different sessions if you're not careful. ;)