1

Example:

<?php
setcookie('test_cookie', '1', time()+3600, '/', $_SERVER['SERVER_NAME']);
echo $_SERVER['SERVER_NAME'];  // outputs: entwicklung.hausfux

enter image description here

Afaik the dot is a wildcard selector.

This causes login problems if you are trying to login into subdomain websites.

Black
  • 18,150
  • 39
  • 158
  • 271

2 Answers2

0

There are the two example for this.

n1.example.com and .n1.example.com

n1.example.com using for domain and .n1.example.com for subdomain. subdomain set dot value. it just use for subdomains as inherit cookies from their parent domain.

Nilesh
  • 97
  • 5
0

I figured out that if you ommit the cookie domain parameter in the setcookie function, then it sets the current domain name without a dot at the start.

setcookie('test_cookie', '1', time()+3600, '/');
Black
  • 18,150
  • 39
  • 158
  • 271