Donovon
Donovon

Reputation: 21

Joomla persistent user sessions across fake subdomains and primary domain

Can someone please help me to find a solution to maintaining the session across subdomains.

The site uses fake subdomains for users, eg. (thisuser.mysite.com/). All the fake subdomains map to the main site (mysite.com) so there's a common database for everything.

The subdomains are used only for a couple of components(com_xxx) on the site. for other components the user is redirected to the main site via htaaccess.

The problem is when a user is redirected to mysite.com from thisuser.mysite.com and vice versa. Their session is not maintained. The user has to login back again.

I have tried updating the cookie domain in php.ini to '.mysite.com' but it doesnt seem to help.

Is it possible that the site may have auto-logins across all subdomains and main domain without any core hacks, assuming the solution lies in making cookies readable from all subdomains, irrespective of from where it's being set?

Thanks all, for your time and suggestions !

Upvotes: 2

Views: 1161

Answers (3)

grinat
grinat

Reputation: 95

1. It is also recommended that you use the same joomla "secret" configuration value in the different websites as it is used to check the data exchanged between the different domains. 2. taht cookie domain is set to '.mysite.com' gets the job done

Upvotes: 0

Donovon
Donovon

Reputation: 21

okay, this was easy, I was testing on the local machine and it seems if domain doesnt have the dot, then the cookies are not handled well.

Just ensuring taht cookie domain is set to '.mysite.com' gets the job done

Upvotes: 0

StiGMaT
StiGMaT

Reputation: 760

I'm not sure how you could do this....

Here is just an idea, it would rely on javascript...

WHen a user logs in using your login form... a hidden iframe would exist and javascript would post your login data to the login page of each domaine for your site. chaining them...

i dont feel its a safe thing tho... maybe im wrong...

u could use joomla's mootool framework to send an ajax requests to each domain...

Otherwise might want to check how joomla creates a session row in the database for each user on the site. maybe you can just create them for each domaine with 1 login. im gona check my mysql....

are you using joomla 1.5 or 2.5 ?

Otherwise i found this document for you:

http://docs.joomla.org/Multiple_Domains_and_Web_Sites_in_a_single_Joomla!_installation

Upvotes: 0

Related Questions