Simple function returning visitor's IP address. PHP allows you to collect vistors' data such as operation system that website was accessed in, version of an internet browser, proxy servers or a real IP address underneath proxies.

You can get the IP using following function: (* - no parameteres required)

function get_ip() {

if (!empty($_SERVER['REMOTE_ADDR'])) {
$ip = $_SERVER['REMOTE_ADDR'];
}

return $ip;
}

Tagged: web programming  php script  security  IP address