-2

During the login process on my internal webpage I use setcookie() to write a cookie.

setcookie("cookiewar",$loginname,time()+(3600*24*100));

On all pages (except one) var_dump($_COOKIE) shows me an array count of 2:

array(2) { ["cookievar"]=> string(37) "klaus" ["PHPSESSID"]=> string(26) "btmep2lk2l8thua18ibdbsa8b3" }

On the one (and only) page I only get:

array(1) { ["PHPSESSID"]=> string(26) "btmep2lk2l8thua18ibdbsa8b3" }

Does anyone have an idea why this could happen on this page?

Klaus
  • 25
  • 2
  • 6

1 Answers1

0

I found the source of the problem and the solution by myself. The one page was the only one located in a different folder than all others. The cookie was only valid in the folder the cookie was created. With

setcookie("cookiewar",$loginname,time()+(3600*24*100),"/");

I set the cookie the top level folder and this solved it.

Klaus
  • 25
  • 2
  • 6