Getting IP Address
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 posted this at 09:14 — 30th January 2003.
He has: 3,022 posts
Joined: Oct 2002
There's an IP logging script on http://www.phplounge.com you might find it useful
TonyMontana posted this at 02:01 — 4th February 2003.
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
Wil posted this at 11:22 — 4th February 2003.
They have: 601 posts
Joined: Nov 2001
You looking for something spookey like this?
http://snoop.anonymizer.com/cgi-bin/get_geography.cgi
necrotic posted this at 21:53 — 4th February 2003.
He has: 296 posts
Joined: May 2002
HA! I don't live in Suwanne! They got the city wrong
Mark Hensler posted this at 22:26 — 4th February 2003.
He has: 4,048 posts
Joined: Aug 2000
Well, they nailed me righ to the city.
Era posted this at 22:31 — 4th February 2003.
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.
necrotic posted this at 01:19 — 5th February 2003.
He has: 296 posts
Joined: May 2002
I believe they give the city where your ISP is located.
TonyMontana posted this at 03:03 — 5th February 2003.
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
samsm posted this at 17:55 — 19th February 2003.
They have: 28 posts
Joined: Feb 2003
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 posted this at 23:33 — 19th February 2003.
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.