Sessions in regard to domain - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Sessions in regard to domain

CveleCvele Posts: 96Member
Hi!

I got following problem.
My PHP session is not the same for [b]mysite.com[/b] and [b]www.mysite.com[/b]. Ie, when user logs in to [b]www.mysite.com[/b], he is not automatically logged in to [b]mysite.com[/b] and vice-versa.

I've tried using following code without any success:
[hr]
[italic]session_set_cookie_params(0 , '/', '.mysite.com');
session_start();[/italic]
[hr]

... as well as:
[hr]
[italic]ini_set('session.cookie_domain', '.mysite.com');
session_start();[/italic]
[hr]

... and as well as:
[hr]
[italic]ini_set('session.cookie_domain', (strpos($_SERVER['HTTP_HOST'],'.') !== false) ? $_SERVER['HTTP_HOST'] : '');
session_start();[/italic]
[hr]

So, after trying to convince my host company to deal with this in [italic]php.ini[/italic], I am left without options known to me.

How do I deal with this?
Sign In or Register to comment.