RE: [PHP] Re: Cookie error after 4.2.3 upgrade
| From: | Ford, Mike [LSS] | Date: | Fri, 08 Nov 2002 12:08:38 +0000 |
| Subject: | RE: [PHP] Re: Cookie error after 4.2.3 upgrade | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-123355@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Erwin [mailto:erwin@isiz.com]
> Sent: 08 November 2002 08:55
>
> Jack Sasportas wrote:
> > I get the following error when using a previously working cookie
> > function: expects parameter 3 to be long
> >
> > Code is below... I just don't see the difference then the
> way the doc
> > uses: time() - 3600
> >
> > -vs- the way I did it below...
> >
> > Thanks !
> >
> > function
> > f_put_cookie($user_name,$user_email,$account_type,$company_name) {
> >
> > global $HTTP_COOKIE_VARS;
> > global $s_c_url;
> >
> > $l_url = ".".$s_c_url;
> > $l_cookie_expireN = date('r', time() - 4000 );
> > $l_cookie_expire = date('r', time() + 400 );
> > $l_cookie_expire2 = date('r', time() + 400*30*12 );
>
> time() - 3600 returns an integer. The date function returns a
> string. The
> function setcookie expects an integer (or long) as parameter
> 3. There's your
> problem, change your code to:
>
> $l_cookie_expireN = (int) date('r', time() - 4000 );
> $l_cookie_expire = (int) date('r', time() + 400 );
> $l_cookie_expire2 = (int) date('r', time() + 400*30*12 );
No, that's even worse!! Try this:
$l_cookie_expireN = time() - 4000;
$l_cookie_expire = time() + 400;
$l_cookie_expire2 = time() + 400*30*12;
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211