This is a discussion on Cookie Expiry within the PHP Programming forums, part of the Web Development category; Problem Short expiry cookies depend on users having their system clocks set correctly. Solution Don't depend on the users ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| Problem Short expiry cookies depend on users having their system clocks set correctly. Solution Don't depend on the users having their clocks set right. Embed the timeout based on your server's clock in the cookie. <?php $value = time()+3600 . ':' . $variable; SetCookie('Cookie_Name',$value); ?> Then when you receive the cookie, decode it and determine if it is still valid. <?php list($ts,$variable) = explode(':',$Cookie_Name,2); if($ts < time()) { ... } else { SetCookie('Cookie_Name',''); } ?>
__________________ J.Vijayanand |
| Sponsored Links |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to Retrieve a Cookie Value? | sundarraja | PHP Programming | 4 | 04-02-2008 07:00 AM |
| How to set time for cookie in ASP.NET? | jeyaprakash.c | ASP and ASP.NET Programming | 9 | 01-16-2008 10:52 PM |
| What Is a Persistent Cookie? | Sabari | PHP Programming | 19 | 09-21-2007 08:29 AM |
| How can I set a cookie in JSP? | anbuchezhians | Java Server Pages (JSP) | 1 | 07-27-2007 03:02 AM |
| How do I set a cookie from JavaScript? | oxygen | HTML, CSS and Javascript Coding Techniques | 1 | 07-26-2007 02:57 AM |