I am not sure why you would want to convert the IP address to a long data type? Wouldn't you want to see it as xxx.xxx.xxx.xxx?
Regardless, the following should work
PHP Code:
$referrer_ip = getenv(REMOTE_ADDR);
$ip_address =ip2long($ip);
Or, if you are on versions of php earlier than 5.0:
PHP Code:
$remote_ip = getenv(REMOTE_ADDR);
$ip_extract = explode (".",$remote_ip);
$code=($ip_extract[0] * 16777216) + ($ip_extract[1] * 65536) + ($ip_extract[2] * 256) + ($ip_extract[3]);
If you want to see it as xxx.xxx.xxx.xxx, then:
PHP Code:
$referrer_ip = getenv(REMOTE_ADDR);
If you want to grab each octet of the IP address:
PHP Code:
$remote_ip = getenv(REMOTE_ADDR);
$ip_extract = explode (".",$remote_ip);
$octet1 = $ip_extract[0];
$octet2 = $ip_extract[2];
$octet3 = $ip_extract[3];
$octet4 = $ip_extract[4];
I hope that helps