Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Feb 2013
    Thanked 0 Times in 0 Posts

    PHP Multisite Login


    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?

  2. #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Saskatoon, Saskatchewan
    Thanked 2,668 Times in 2,637 Posts
    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.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  3. #3
    Regular Coder Arcticwarrio's Avatar
    Join Date
    May 2012
    Thanked 100 Times in 100 Posts
    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.
    Get Cloud Hosting now from only£59 / month


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts