Web Analytics Made Easy -
StatCounter setcooking(), expires never - how? - CodingForum

Announcement

Collapse
No announcement yet.

setcooking(), expires never - how?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • setcooking(), expires never - how?

    How would you make cookies to never expire? If you set it to 0 it will destroy after the session is gone. And negative values don't work?
    PHP 5 & MySQL 5 (Y)

  • #2
    PHP Code:
    setcookie ("TestCookie"""time() + 60*60*24*365*100); 
    will make the cookie expire after 100 years.
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

    Comment


    • #3
      I set my cookie to expire in one year. Thanks for reply, I were looking for unlimited expiration, but seems it's impossible. Anyways, most browsers would have deleted the old cookies anyway...
      PHP 5 & MySQL 5 (Y)

      Comment


      • #4
        "unlimited expiration" as such is, afaik, not possible and probably not usefull. but you can achieve the same by setting the expirationdate unrealistically far in the future.
        Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

        Comment


        • #5
          There is no guarantee that the cookie won't expire after the user ends his session. He may have just set them to expire anyway (usefull for public computers).
          I'm not sure if this was any help, but I hope it didn't make you stupider.

          Experience is something you get just after you really need it.
          PHP Installation Guide Feedback welcome.

          Comment


          • #6
            there's even no guarantee that the cookie will ever be realy set because he can adjust his clock and set it a few years in the future... or he can just refuse cookies altogether...
            Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

            Comment


            • #7
              reguler cookie deleters do exist :P

              Comment


              • #8
                You can check if an user accepts cookies by checking if it's set on the next page. You just have no guarantee that they will be set as long as you want.
                I'm not sure if this was any help, but I hope it didn't make you stupider.

                Experience is something you get just after you really need it.
                PHP Installation Guide Feedback welcome.

                Comment


                • #9
                  i think this thread is getting a bit silly.

                  the answer to the original question is long reached --> you can only set the expiredate way in the future.
                  Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

                  Comment


                  • #10
                    You're right. No reason I should care if nobody else does.
                    I'm not sure if this was any help, but I hope it didn't make you stupider.

                    Experience is something you get just after you really need it.
                    PHP Installation Guide Feedback welcome.

                    Comment

                    Working...
                    X