Jump to content


Photo

Setting cookies for 2 different domain extensions


  • Please log in to reply
3 replies to this topic

#1 trafix

trafix
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 28 August 2006 - 04:28 AM

Hi there,

Need help! ....

I have 2 domains 

xxxx.com
xxxx.com.au is parked in the above server.

when a user logs into one of them i need to be able to set the cookie(s) so the user is logged into both.

Currently if they log into one and go the the other extension, they are not logged in and it is driving my members batty .....

Can you assist me?

Trafix

#2 radar

radar
  • Members
  • PipPipPip
  • Advanced Member
  • 645 posts
  • LocationSLC

Posted 28 August 2006 - 05:07 AM

If i have 2 sites on different servers or with different extensions -- I generally don't set the domain...  This way there is no chance of coding error...

Another option you could have is to just add another cookie for the other domain by setting it at login, deleting it at logout, etc.. and basically just doing the same thing twice for every instance of calling the cookie...  Either way -- its your choice.. 

#3 trafix

trafix
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 28 August 2006 - 05:23 AM

i changed th code to ............

		$lognameaa=strtolower($logname);
		$userinfoaa[username]=strtolower($userinfo[username]);
		
        if ($lognameaa==$userinfoaa[username]) 
        {
            if ($logpass==$userinfo[password])
            {
                $exptime=time()+60*60*24*3;
                setcookie("usercookie",$logname,$exptime);
                setcookie("passcookie",$logpass,$exptime);
                header ("Location: index.php");
            }
            else
            {
            }
        }
        else
        {
        }

no change ... logs in on one domain but not the other

#4 trafix

trafix
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 28 August 2006 - 05:27 AM

another solution

I was reading about canonical URL's. would it be better for me to create a .htaccess file to insure everyone uses the .com.au  regardless of which one they type in




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users