Why would I need to save IPs of my web site users?

Should I save this information in the database? For example when users sign up or log in?


  1. Rate Limiting (to protect your resources eg. API)
  2. Security (for auditing reasons - match IP with user credentials)
  3. Geolocation based services (if not now, maybe in the future?)
  4. Data for future load-balancing functionality

Unless you're tracking the users coming to your site, limitting access based on IP address, or providing geographical services (based on IP lookup)...then you don't need to save this information at all.

Some sites, like banks, will use this info as a security measure. If you try to sign in again from another IP address, you will be asked to confirm your identity.

If you were implementing an auto-sign on feature than you are likely to store this (alongside checking for data in a cookie) to attempt to verify that the computer is the correct one for the user, before auto-logging them on.

Most web servers already log this kind of information in their log file.

You may want to log the IP in order to match up the web logs with your user via the IP (and time).

This will not be 100% correct, as IP addresses can be shared (for example behind a NAT firewall).

Should you do this? It depends. Do you need this functionality? Depending on the answer to this question, you should make your decision.

IP bans for misbehavior. About the only solid reason for collecting the raw IP addresses (and not "cooked" data like geolocation or ISP). If you get several similar ban reasons for new accounts, check the IPs they logged in from, and if they are the same or very similar you may want to block on per-IP basis.

You should save IPs of users only when you have a poll or rating system where anyone can vote once. Also you could store IP data to check for multiple log in sessions so people can sign out other active sessions from your site, like in GMail.

We do a site where the "authorities" of our country often call in and what to have IP addresses from a specific user because of copyright infringements or other lawsuit reasons. This might be country specific but for us, this is a reason to keep some IP addresses of our users.

Need Your Help

how to create an object's array in javascript

javascript arrays

I recently encountered an problem where I am not creating an array correctly for objects.

ListPicker separate templates for Normal and Expanded states

windows-phone-7 listpicker

Is is possible to either subscribe to a ModeChanged event or to have a separate template for the Normal and Expanded states of the ListPicker control.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.