Re: [PHP] Re: Cookie error after 4.2.3 upgrade
>> 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; You're right of course, let's say that it was very early when I wrote that answer ;-)) Grtz Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Cookie error after 4.2.3 upgrade
> -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: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Cookie error after 4.2.3 upgrade
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 ); HTH Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php