AW: [PHP] non-expiring cookie
| From: | bemorph | Date: | Sat, 26 Aug 2000 11:01:08 +0000 |
| Subject: | AW: [PHP] non-expiring cookie | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-13785@lists.php.net to get a copy of this message | ||
I think you have to replace then '0' in your code.
setcookie ("TestCookie", $value, time()+3600);
will set a cookie for one hour.
> -----Ursprüngliche Nachricht-----
> Von: Wizaerd [mailto:wizaerd@wizaerd.com]
> Gesendet am: Samstag, 26. August 2000 08:49
> An: General PHP List
> Betreff: [PHP] non-expiring cookie
>
> How can I create a cookie that never expires? I'm using the
> following code:
>
> // initially set the cookies (non-expiring I hope)
> if( !isset( $c_Name )) { setcookie( "c_Name", "", 0 ); }
> if( !isset( $c_EMail )) { setcookie( "c_EMail", "", 0 ); }
> if( !isset( $c_WebURL )) { setcookie( "c_WebURL", "", 0 ); }
> if( !isset( $c_WebTitle )) { setcookie( "c_WebTitle", "", 0 ); }
>
> // if the form is being submitted, update cookie values
> if( isset( $frm_SaveThem )) {
> setcookie( "c_Name", $c_Name, 0 );
> setcookie( "c_EMail", $c_EMail, 0 );
> setcookie( "c_WebURL", $c_WebURL, 0 );
> setcookie( "c_WebTitle", $c_WebTitle, 0 );
> }
>
> However, they are only persistant during the browser session.
>
> The second problem I have is they do not seem to update with a
> new value if
> the contents of the variable changes... this code is stored in an
> application.php which gets prepended automatically, and does occur before
> any other output.
>
> Thanx!
>
> Joseph E. Sheble
> a.k.a. Wizaerd
> Wizaerd's Realm
> Canvas, 3D, Graphics, ColdFusion
> http://www.wizaerd.com
> =================================
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>