note 5953 modified in function.setcookie by john

From: Date: Sat, 30 Nov 2002 16:14:01 +0000
Subject: note 5953 modified in function.setcookie by john
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-40151@lists.php.net to get a copy of this message
We generally use like this. setcookie("admin_ck", $login_id); This is ok.... But... If suppose you setcookie on /a/b/c.phtml then you use this cookie on /a/b and a/b's sub-directory only. So, I recommend below form without special reason. setcookie("admin_ck", $login_id, time()*3600, "/~saram/", "www.saram.com"); [Editor's Note: if you are having problems sharing a cookie between sub-directories, simply set the path attribute to "/". this will give that cookie reign over the whole web tree. this will allow you to set a value in one directory, and then read it in another.] --was-- We generally use like this. setcookie("admin_ck", $login_id); This is ok.... But... If suppose you setcookie on /a/b/c.phtml then you use this cookie on /a/b and a/b's sub-directory only. So, I recommend below form without special reason. setcookie("admin_ck", $login_id, time()*3600, "/~saram/", "www.saram.com"); http://www.php.net/manual/en/function.setcookie.php

« previous php.notes (#40151) next »