Jump to content

PHP - Cookies & Sessions


hackalive

Recommended Posts

I assume you are referring to setting the session.cookie_domain setting and the setcookie() domain parameter to be: .yourdomain.com to get it to match all variations of yourdomain.com

 

You would need to use a different session_name for that one sub-domain (let all the others use the default session_name.) This would cause a different session id cookie name to be used for that one sub-domain.

 

As far as regular cookies, to cause that one sub-domain to ignore the other cookies and only use the ones intended for it, the only thing that comes to mind would be to create unique cookie names (similar to what using a different session name does.) Setup a defined constant that you prepend to the cookie name. You would set this defined constant to a unique value (perhaps the sub-domain name itself) that would create a unique set of cookie names just for that sub-domain. All the setcookie() and $_COOKIE references would use that defined constant when forming the name of the cookie to set or reference.

 

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.