note 20522 deleted from function.setcookie by sniper

From: Date: Wed, 11 Dec 2002 07:17:46 +0000
Subject: note 20522 deleted from function.setcookie by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-40729@lists.php.net to get a copy of this message
I want to use cookies to store login information for my site, so I used setcookie("loginid","$id"). It works fine, as long as I do not close my browser. Whenever I come back to the Site, all informations are lost. Then I tested around with the comments here, and finaly I realized that it is important to send your domain. It is also important that you send your real domain, I'm using Apache with various Virtual Hosts, I had to send the Virtual Host Domain, even if you have a redirect. Now I'm using setcookie("loginid","$id",time()+3600,"/","someone.no-ip.com") Also, it't not working if im adding a 1 for secure at the end.

« previous php.notes (#40729) next »