Page 1 of 1

Writing IP as Numbers Only

Posted: Thu Sep 08, 2005 8:44 am
by blacksnday
If I wanted to log user's IP addy's using

Code: Select all

$_SERVER['REMOTE_ADDR'];
How can I make it write WITHOUT the . showing?

23.555.55.55
write and save as
235555555

Posted: Thu Sep 08, 2005 8:46 am
by s.dot

Code: Select all

$ip = str_replace(".","",$_SERVER['remote_addr']);

Posted: Thu Sep 08, 2005 9:08 am
by feyd
that's kinda dangerous to do.... convert it to a 32bit value, at least then, you can preserve where each dot should go ;)

ip2long()