i know the dates are all client side.. so how can you create a cookie, set a value to 1 inside it, and check (server side) if the cookie has expired?

    you can use setcookie() function to set the cookie.
    example:

    setcookie("cookiename",$valueassigned,time()+60);
    

    and then use isset() to check whether it has expired.

      Most likely, the browser will keep the session until the browser is closed, or 60 seconds from when the cookie is set (whichever is larger).

        Or you could store the server time in the cookie, and see when it was set.

        Of course, someone could fake the time stored in the cookie; but then, the browser is under no obligation to respect the expiry date you send it.

        So you can store a random string in the cookie, and store on the server both the string and the (server) time the cookie was set. Look at the string, look up (on the server) the time it was set, and figure out if it's more than a minute old.

        It depends on how critical it is that the information in question expires after a minute. (Assuming of course that the gap between the minute's expiry and the browser's next request to the server (when the server will deem the cookie to have "expired") is unimportant.)

          Write a Reply...