For security reasons and to prevent spam it is always recommended to log visitor/client IP address in your database atleast for important transactions like posting a comment, registration, etc. However it is important that we store the real IP of the visitor.

Visitor/Client is not using proxy

In almost all cases i.e. when the visitor/client is not behind the proxy we can get the real IP address of the visitor/client using

Visitor/Client is behind a proxy server

In some cases the visitor/client could be behind a proxy server. In that case we can get the real IP using

However using some tools one can easily pretend to be behind a proxy server. In that case we cannot get the real IP using above method

Also we cannot be sure if the visitor/client is using a proxy or not.

So it is best to store both the values in different fields in your database.

Leave a Reply

Your email address will not be published. Required fields are marked *