Results 1 to 6 of 6

Thread: Cookies

  1. #1

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256

    Cookies

    How can I make it so my cookie never expires? If that's not possible, what's the maximum time I can set it to?

    My cookies always expire too soon and I have to login again in the middle of stuff.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  2. #2

  3. #3

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    What would be the value for year? I see that "time()+3600" gives an hour.

    So would "time()+31536000" give a year? Or something else?
    My evil laugh has a squeak in it.

    kristopherwilson.com

  4. #4
    I would imagine, if that's 60 * 60 * 25 * 365...I think that's how I programmed the TT cookies *looks at source*

  5. #5
    Here's my setcookie.php, nice little page I wrote:
    PHP Code:
    <?
    if ($delete)
    {
        setcookie($name, '', time() - 3600); // Setting to the past deletes
    }
    else
    {
        setcookie($name, '', mktime(12, 0, 0, 1, 1, 2005));
    }
    header("Location: $returnto");
    exit;
    ?>

  6. #6
    scoutt
    Guest
    PHP Code:
    setcookie("myCookie""Any Value"Time() + 7*24*60*60); 
    // a week lasts 7 days, a day lasts 24 hours, a hour lasts 60 minutes, a minute lasts 60 seconds 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width