Results 1 to 3 of 3

Thread: best way to "update" cookies

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    best way to "update" cookies

    Ok, I've never used cookies a whole lot, but I want to make a neat login for some blogging software I'm writing and not have to have the user re-enter information every time they go to the site, well, unless they want to. So, basically, I'm going to have an option; use cookies on login, or don't, and use a session instead. Now, I've never used sessions at all, but aside from that, I want to know what the best way to update a cookie is.. After a user is logged in, I want them to have their login information stay stored in an active cookie as long as they are active on the site, and this will make them never re-login if they are visiting every day. I know many message boards do this; phpBB, vBulletin and Invision for example, as I haven't actually logged into this board for over 3 months. I'm thinking of having an include that just sets a cookie for every visit, and include it in a header that will be included in every page.. but I think that'd be overkill. I'm thinking of it as it will make a new cookie every time it's executed, rather than update the current cookie if there is one.

    Not sure if I made myself clear; but any help is appreciated.
    Like Archer? Check out some Sterling Archer quotes.

  2. #2
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    As far as I know if you try and set a cookie and the name is already being used it will overwrite the old cookie so effectively updating it .
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  3. #3
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256

    Re: best way to "update" cookies

    Originally posted by kows
    I'm thinking of having an include that just sets a cookie for every visit, and include it in a header that will be included in every page.
    That's exactly how I do it in my programs.
    My evil laugh has a squeak in it.

    kristopherwilson.com

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