title: Save IP in database
body: <p>When a user logs in I want to save their IP in the database. How would I do that? What type is best to use for the MySQL field? How would the PHP code to get IP look like?</p>
  
  <p>I'm thinking of using it as an extra security feature for the login/session stuff. I'm thinking of checking the IP the user logged in with from the DB with the IP the user have now as addition to checking the session. So that it first check the session, and then check if you have a valid IP.</p>
  
  <p>Is that a good extra feature? And what other things can I do to make it more secure?</p>