View Full Version : How to get Client IP address
diwanmh
12-28-2007, 05:16 AM
How to get Client IP address
codeexploiter
12-28-2007, 05:31 AM
In PHP use the following line. The client ip will be in $ip variable
$ip = $_SERVER['REMOTE_ADDR'];
in ASP.NET use the following in the following order - first check the first option if it returns empty then use the second one
Request.ServerVariables("HTTP_X_FORWARDED_FOR");
Request.ServerVariables("REMOTE_ADDR");
Checking for $_SERVER['HTTP_X_FORWARDED_FOR'] would be good practice in PHP too.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.