Re: A setcookie related question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Tony,

In most cases you do not need to use the domain parameter. Try to simplify
the function call to 

setcookie("auth", "1", 0, "/"); // Not this cookie has already expired

setcookie("auth", "1", time() + 3600, "/"); // Not this cookie will expire
in 1 hour

or even to 

setcookie("auth", "1"); // Note this wil be a session cookie that wil
expire when the browsr window is closed.

- Frank

> Hi There,
> 
>  
> 
> I am a beginner PHP developer and I have a very simple, perhaps silly,
> question:
> 
>  
> 
> I am trying to use the setcookie function in a PHP script and I seem to
be
> struggling with the "domain" parameter.  Here is situation:
> 
>  
> 
> //set authorization cookie
> 
> setcookie("auth", "1", 0, "/", "yourdomain.com", 0);
> 
>  
> 
> Instead of the "yourdomain.com" string in this function call I am
suppose to
> use my own domain name, but I do not have a WEB site yet.  As a result I
am
> using localhost at the moment.  I have tried several values with no
success.
> Since I am running these scripts on my local PC using "i.e. localhost",
what
> should I set this value to?  
> 
>  
> 
> I have tried the following combinations with no avail:
> 
> setcookie("auth", "1", 0, "/", "localhost", 0);
> 
> setcookie("auth", "1", 0, "/", "localhost:8080", 0); (I a running
Apache
> HTTP Server 2.0.54 on port 8080)
> 
> setcookie("auth", "1", 0, "/", "127.0.0.1", 0);
> 
> setcookie("auth", "1", 0, "/", ".oc.cox.net", 0); (this is what my
IPCONFIG
> returns as my "connection-specific DNS Suffix".) 
> 
>  
> 
> Any help would be greatly appreciated.
> 
>  
> 
> Regards,
> 
> Tony Aldemir
> 
>  
> 
> 

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux