title: validating sessions and mysql time
body: <p>I have created sessions table for login system and when user login successfully, then a random session key is generated and associated with the user id of logged in user and, in sessions table i added a expirytime column whose default value is timestamp of current + one hour later , i.e if time is 17:10:32 then in that column time will be 18:10:32. All this is added in database. upon login the session key is checked and this time is checked by this command:
  <code>"SELECT * FROM active_sessions where session_key = :asession and expirytime &gt; NOW()"</code></p>
  
  <p>My question is that in a case when session is expired (i.e expirytime column's time is expired), then is it possible that if someone changes his computer time then my query above will become true, and expired session will be used.</p>
  
  <p>And secondly is there anyway through which a session works only from the device through which it is created, (to prevent stealing of cookies and using them in other device). Thank You</p>