Code: Select all
if($_POST['remember']=='y') setcookie('remember',$data['userlevel'],time()+60*60*24*30,'/');What have I done wrong?
Moderator: General Moderators
Code: Select all
if($_POST['remember']=='y') setcookie('remember',$data['userlevel'],time()+60*60*24*30,'/');If the path for the cookie is 'dir/subdirA', your cookie won't be available for 'dir/subdirB' (which is '../fpdf/').andym01480 wrote:I have a simple remember my login used in a login script for /admin/ directory.
it is not holding for another directory which relative to the script setting it is ../fpdf/Code: Select all
if($_POST['remember']=='y') setcookie('remember',$data['userlevel'],time()+60*60*24*30,'/');
What have I done wrong?
So is there a bug in the manual or php?The path on the server in which the cookie will be available on. If set to '/', the cookie will be available within the entire domain. If set to '/foo/', the cookie will only be available within the /foo/ directory and all sub-directories such as /foo/bar/ of domain. The default value is the current directory that the cookie is being set in.
You got me. I now see that the path you have set in the cookie is root. So the cookie should be available in the whole domain. But aren't we mixing server directories and domain paths?andym01480 wrote:That's what I am experiencing. But the manual says...
So is there a bug in the manual or php?The path on the server in which the cookie will be available on. If set to '/', the cookie will be available within the entire domain. If set to '/foo/', the cookie will only be available within the /foo/ directory and all sub-directories such as /foo/bar/ of domain. The default value is the current directory that the cookie is being set in.
You got me. I now see that the path you have set in the cookie is root. So the cookie should be available in the whole domain. But aren't we mixing server directories and domain paths?andym01480 wrote:That's what I am experiencing. But the manual says...
So is there a bug in the manual or php?The path on the server in which the cookie will be available on. If set to '/', the cookie will be available within the entire domain. If set to '/foo/', the cookie will only be available within the /foo/ directory and all sub-directories such as /foo/bar/ of domain. The default value is the current directory that the cookie is being set in.