Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-26-2013, 08:13 PM   PM User | #1
XAOS-Eric
New to the CF scene

 
Join Date: Feb 2013
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
XAOS-Eric is an unknown quantity at this point
PHP Multisite Login

Hello,

I have been trying to get a multisite login system working. For example, a user goes to site1.com, logs in using login.site1.com, and is logged in on site2.com as well. I have tried cookies, but site2.com cant access site1.com cookies. I'm stuck with sessions, which I can't figure out, when I pass the session id through the url, I get a session id too long error. I've read that you can use mysql to do that, but how would you do that?
XAOS-Eric is offline   Reply With Quote
Old 02-26-2013, 08:35 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Sessions won't help you either, at least not by themselves.

The only thing you can do for multisite logins is to have ownership of both sites, and either share a database or have one site query another for information through something like soap or rest or whatever. Cookies cannot be shared between two sites (although they can be shared with subdomains). When the request is received which will need to use the GET for the phpsessid, than it should process it per normal on either site. If they share the same filesystem or database, then you can use the session information on either site.
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
Fou-Lu is offline   Reply With Quote
Old 02-26-2013, 11:14 PM   PM User | #3
Arcticwarrio
Regular Coder

 
Arcticwarrio's Avatar
 
Join Date: May 2012
Location: UK
Posts: 575
Thanks: 15
Thanked 64 Times in 64 Posts
Arcticwarrio is on a distinguished road
you need to use a database that both sites could access

a bit of ajax should sort out the cross site bit
__________________
There are 10 types of people on CodingForums,
Those who understand Binary and those who dont.
Arcticwarrio is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:58 PM.


Advertisement
Log in to turn off these ads.