PHP Script To Geo Locate With Lat & Lon
Page 1 of 1
PHP Script To Geo Locate With Lat & Lon
Geo locate By IP
You will need the geo locate database
see this page
https://jnet.forumotion.com/t1224-linux-bash-lookup-geo-location-from-ip#1653
Code Update
https://app.box.com/s/q2h5yjtybtuf5fi2havbbz2po4p8dxdt
- Code:
<title>J~Net IP Geo Location Map</title>
<center>
<div style="clear:left; height:24px;"></div>
<div style="float:center; height:auto; width:580px;background:#EBEBEB; margin-left:25px; margin-right:5px; box-shadow: 1px 3px 4px #666;">
<p><br>
<?php
$ip = $_GET['ip'];
$process = shell_exec("geoiplookup -f /usr/share/GeoIP/GeoLiteCity.dat $ip");
$rem = array("GeoIP City Edition, Rev 1:", " N/A,");
$rep = "";
echo $process = str_replace($rem,$rep,$process);
echo "<p>";
$new = substr("$process",5,-7);
// print_r (explode(" ",$new)); // debugging
$test = (explode(" ",$new));
$dot_example = array('.');
echo "<p>";
if (strpos($test[0], '.') == true){
$out = $test[0];
$out .= $test[1];
} else
if (strpos($test[1], '.') == true){
$out = $test[1];
$out .= $test[2];
} else
if (strpos($test[2], '.') == true){
$out = $test[2];
$out .= $test[3];
} else
if (strpos($test[3], '.') == true){
$out = $test[3];
$out .= $test[4];
} else
if (strpos($test[4], '.') == true){
$out = $test[4];
$out .= $test[5];
} else
if (strpos($test[5], '.') == true){
$out = $test[5];
$out .= $test[6];
} else
if (strpos($test[6], '.') == true){
$out = $test[6];
$out .= $test[7];
} else
if (strpos($test[7], '.') == true){
$out = $test[7];
$out .= $test[8];
} else
if (strpos($test[8], '.') == true){
$out = $test[8];
$out .= $test[9];
}
if (strpos($test[9], '.') == true){
$out = $test[9];
$out .= $test[10];
}
$new = substr($out,0,-1);
echo '<p><br><a href="https://www.google.co.uk/maps/search/'.$new.'" target="_blank">Find On Map</a>';
echo "<p>";
?>
<p><br>
<div>
<STYLE TYPE="text/css">
BODY {
background-image: url('images/map.jpg');
}
</STYLE>
You will need the geo locate database
see this page
https://jnet.forumotion.com/t1224-linux-bash-lookup-geo-location-from-ip#1653
Code Update
https://app.box.com/s/q2h5yjtybtuf5fi2havbbz2po4p8dxdt
Similar topics
» Linux BASH Script Running Commands and Functions From Bash Script and saving to varables
» whois script
» error tracking script
» Clam AV For Linux Run Script
» Geo Location and isp info using ip script!
» whois script
» error tracking script
» Clam AV For Linux Run Script
» Geo Location and isp info using ip script!
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|