RE: [PHP] Re: cookies under php 4.06
| From: | Jennifer Goodie | Date: | Thu, 04 Sep 2003 22:32:19 +0000 |
| Subject: | RE: [PHP] Re: cookies under php 4.06 | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-161702@lists.php.net to get a copy of this message | ||
> > setcookie("UserName", $HTTP_POST_VARS['UserName'],
> time()+(60*10), "/",
> > $HTTP_SERVER_VARS['SERVER_NAME']);
> > setcookie("Password", $password, time()+(60*10), "/",
> > $HTTP_SERVER_VARS['SERVER_NAME']);
> > print "login - set cookie";
>
>
> sorry for kinda answering my own post... but anyway...
>
> setcookie("UserName", $HTTP_POST_VARS['UserName']);
> setcookie("Password", $password);
>
> solves my problem, although means i can't have a time limit on my
> cookies i
> guess... but can set a time limit with another cookie...
1.) I would not store the user's password in a cookie.
2.) As far as I know, set_cookie() has worked the same since PHP3, so your
problem is something else, not the PHP version. Are you sure
$HTTP_SERVER_VARS['SERVER_NAME'] is the same as what's in the location bar
in your browser. If the server name is set up as www.domain.com but the
user is just at http://domain.com the cookie won't set.