Getting IP Address

They have: 218 posts

Joined: Apr 2001

Any tips on column setup for storing an IP address, and host? (not hidden by a proxy). And maybe a corresponding PHP script which gets the IP, and perhaps also evaluates what country that user is from.

This is for use on my Flash MX message board.

Cheers,

TonyMontana

Renegade's picture

He has: 3,022 posts

Joined: Oct 2002

There's an IP logging script on http://www.phplounge.com you might find it useful Laughing out loud

They have: 218 posts

Joined: Apr 2001

Yea, that helped somewhat, although I'm now storing user IP as mediumtext as opposed to int(255).

I'm looking to grab the geographical location of the user, and their hostname, any scripts out there to do this?

Cheers,

TonyMontana

They have: 601 posts

Joined: Nov 2001

You looking for something spookey like this? Smiling

http://snoop.anonymizer.com/cgi-bin/get_geography.cgi

He has: 296 posts

Joined: May 2002

HA! I don't live in Suwanne! They got the city wrong Sticking out tongue

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

Well, they nailed me righ to the city.

They have: 18 posts

Joined: Nov 2002

They got country correct and the state. But I didn't know there was a town in NJ named madison.

He has: 296 posts

Joined: May 2002

I believe they give the city where your ISP is located.

They have: 218 posts

Joined: Apr 2001

Well, they got the city wrong, but fairly close. Total accuracy would be better. And I'm looking for the script to be PHP/SQL.

TonyMontana

They have: 28 posts

Joined: Feb 2003

Quote: Originally posted by TonyMontana
Well, they got the city wrong, but fairly close. Total accuracy would be better. And I'm looking for the script to be PHP/SQL.

I expect total acuracy is presently impossible for reasons suggested above... any location script that hones in on the IP will be finding (at best) the location of your ISP. That's a good thing, privacy wise.

I suspect a bare bones locator script would work like this....

<?php
$mgrHOST
= gethostbyaddr($_SERVER['REMOTE_ADDR']);
// make assesment based upon country code
// or...
// perform whois, look at location
?>

No whois built into PHP (to my knowlege) so you'd have to launch a whois application to get that info.

dk01's picture

He has: 516 posts

Joined: Mar 2002

If you check in the php.net manual notes at the bottom of each page. You might find a prewritten locator script. I can remember seeing one there but cant find it at the moment.
-dk

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.