Sinisterly
Geo IP Locator - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/Forum-Coding)
+--- Forum: PHP (https://sinister.ly/Forum-PHP)
+--- Thread: Geo IP Locator (/Thread-Geo-IP-Locator)

Pages: 1 2


Geo IP Locator - The Alchemist - 07-16-2013

Hello Hack Community,
Here is a simple Geo IP Locator I just coded.
PHP Code:
<?php set_time_limit(0); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <head> <title>Geo IP Locator</title> <style type="text/css"> body { color: #ffffff; text-shadow: 2px 2px #000000; background-color: #282828; font-family: Arial, Helvetica, sans-serif; } pre { background-color: #353535; border: solid 1px #505050; } input { font-family: Arial, Helvetica, sans-serif; } .Button { padding: 5px 10px; background: #303030; border: solid #101010 1px; color: #fff; cursor: pointer; font-weight: bold; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; text-shadow: 1px 1px #000; } .Input { border: solid #101010 1px; color: white; font-weight: bold; padding: 3px; background-color: #252525; } </style> </head> <body> <div align="center"> <pre> ________ ._____________ .____ __ / _____/ ____ ____ | \______ \ | | ____ ____ _____ _/ |_ ___________ / \ ____/ __ \/ _ \ | || ___/ | | / _ \_/ ___\\__ \\ __\/ _ \_ __ \ \ \_\ \ ___( <_> ) | || | | |__( <_> ) \___ / __ \| | ( <_> ) | \/ \______ /\___ >____/ |___||____| |_______ \____/ \___ >____ /__| \____/|__| \/ \/ \/ \/ \/ Coded By The Alchemist www.HackCommunity.com </pre> <form method="post" action=""> IP : <input type="text" class="Input" placeholder="IP here" name="ip" value="<?php if(!empty($_POST['ip'])){echo $_POST['ip'];}?>"/> <input type="submit" class="Button" name="submit" value="Locate"/></p> </form> <table> <?php if(empty($_POST['ip']) || !filter_var($_POST['ip'],FILTER_VALIDATE_IP)){ exit(); } $ip = $_POST['ip']; if($tags = @get_meta_tags("http://www.geobytes.com/IpLocator.htm?GetLocation&template=php3.txt&IpAddress={$ip}")){ foreach($tags as $key => $val){ echo "<tr><td><span style=\"color: yellow\">".$key; echo " = </span></td><td><span style=\"color: #33CCCC\">".$val."</span></td></tr>"; } } else { echo "<span style=\"color: yellow\">Something went wrong!!</span>"; } ?> </table> </div> </body> </html>

You can also view it from my site : http://www.scriptings.tk/paste/51e54b0e11652

Enjoy!!


RE: Geo IP Locator - The Real Slim Shady - 07-16-2013

Well, the code is fine... but the engine you use is way off. about the only thing it got right was the country. the state and city were not even close however Smile


RE: Geo IP Locator - The Real Slim Shady - 07-16-2013

Well, the code is fine... but the engine you use is way off. about the only thing it got right was the country. the state and city were not even close however Smile


RE: Geo IP Locator - The Alchemist - 07-16-2013

(07-16-2013, 03:56 PM)Geoff Wrote: Well, the code is fine... but the engine you use is way off. about the only thing it got right was the country. the state and city were not even close however Smile
These APIs arent very efficient.
All the IP address locating services that I've seen till today have led me to the wrong city and state.
Sometimes, they get the state correct. But they never get the city correct unless you are in the capital city of the state. Smile
This my personal experience though.


RE: Geo IP Locator - The Alchemist - 07-16-2013

(07-16-2013, 03:56 PM)Geoff Wrote: Well, the code is fine... but the engine you use is way off. about the only thing it got right was the country. the state and city were not even close however Smile
These APIs arent very efficient.
All the IP address locating services that I've seen till today have led me to the wrong city and state.
Sometimes, they get the state correct. But they never get the city correct unless you are in the capital city of the state. Smile
This my personal experience though.


RE: Geo IP Locator - The Real Slim Shady - 07-16-2013

(07-16-2013, 04:53 PM)The Alchemist Wrote: But they never get the city correct unless you are in the capital city of the state. Smile

Well, I am in the largest city in the state, and the 3rd largest in the country. And its telling me im in the largest city in the country lol.


RE: Geo IP Locator - The Real Slim Shady - 07-16-2013

(07-16-2013, 04:53 PM)The Alchemist Wrote: But they never get the city correct unless you are in the capital city of the state. Smile

Well, I am in the largest city in the state, and the 3rd largest in the country. And its telling me im in the largest city in the country lol.


RE: Geo IP Locator - 1234hotmaster - 07-16-2013

Thanks for the share, though I wish it had a flag.jpg included for each IP Smile


RE: Geo IP Locator - 1234hotmaster - 07-16-2013

Thanks for the share, though I wish it had a flag.jpg included for each IP Smile


RE: Geo IP Locator - The Alchemist - 07-17-2013

(07-16-2013, 10:57 PM)Geoff Wrote: Well, I am in the largest city in the state, and the 3rd largest in the country. And its telling me im in the largest city in the country lol.

This is what happens when you use these APIs LOL... Smile
(07-16-2013, 10:59 PM)1234hotmaster Wrote: Thanks for the share, though I wish it had a flag.jpg included for each IP Smile
I think I should have looked for another API where they also show a flag.jpg Smile