How to correctly get visitor/client IP address

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 [crayon-59c1019647f81497221705/] 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 [crayon-59c1019647f8b549400146/] 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....
Read More