Writing IP as Numbers Only

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
blacksnday
Forum Contributor
Posts: 252
Joined: Sat Jul 30, 2005 6:11 am
Location: bfe Ohio :(

Writing IP as Numbers Only

Post 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
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

Code: Select all

$ip = str_replace(".","",$_SERVER['remote_addr']);
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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()
Post Reply