Grab the users IP address, handy to add to login scripts if you want to tighten security… Or to just keep track…
$Users_IP_address = $_SERVER["REMOTE_ADDR"];
If the user is operating via a proxy server, the above code may not work. In this case use this simple function:
<?php
function VisitorIP(){
if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])){
$TheIp=$_SERVER['HTTP_X_FORWARDED_FOR'];
}
else {
$TheIp=$_SERVER['REMOTE_ADDR'];
}
return trim($TheIp);
}
?>
Snippet from http://wiki.jumba.com.au/wiki/PHP_Get_user_IP_Address
Related posts:
![Get a users IP Address Grab the users IP address, handy to add to login scripts if you want to tighten security… Or to just keep track… $Users_IP_address = $_SERVER["REMOTE_ADDR"]; If the user is operating...](http://www.jonmoore.co.uk/wp-content/uploads/2011/03/Brakes-930x375.jpg)