title: How often should I update login cookies?
body: <p>I haven’t written the code yet, as I am new to using cookies and trying to wrap my mind around the concept of coding cookies.  I’m going to be combing the use of cookies and session data for my login system.</p>
  
  <p><em>Because there is a time limit set in my cookies, I would think this would need to be updated periodically to keep the cookie active.</em></p>
  
  <p><strong>My plan:</strong></p>
  
  <ol>
  <li><p>User Logs in </p></li>
  <li><p>Cookies are set for user ID, a random token, and a random serial key, and IP address (should I include the IP?)</p></li>
  <li><p>Cookie data is stored in a database for when cookie is retrieved to validate the information.</p></li>
  </ol>
  
  <p><strong><em>I’m setting cookies to be valid for 1 month.</em></strong></p>
  
  <hr>
  
  <p><strong>How often should cookie data be updated and when would you recommend updating it?</strong>  </p>
  
  <ul>
  <li>Should I update every time the server checks to see if user is logged
  in or should it be sparatic?  Should it only be updated if a session
  isn’t found and it checks for cookie validity?</li>
  </ul>
  
  <p><strong><em>I’m new to this, so any info would be helpful before I start writing this code.</em></strong></p>