Jump to content

set cookie function for both www.domain.com and domain.com


mozunk

Recommended Posts

I searched but couldn't find a clear answer so I'm sorry if this is a repeat.  If you point me in the right direction, I'll go :)

When I set a cookie, it only sets it on my domain without the www. (so if someone uses www.domain.com, the cookie doesn't work).

 

Here's what I have:

setcookie("matewan_login",$joined,time()+62899200);

 

Suggestions?

 

I appreciate everyone's time...

Just specify your domain with a dot in front (and if you want the cookie to work in all directories of you domain, use a slash as below):

 

<?php
setcookie('matewan_login', $joined, time()+62899200, '/', '.domain.com');
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.