PC & IT SUPPORT MADE EASY FORUM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

PHP Script To Geo Locate With Lat & Lon

Go down

PHP Script To Geo Locate With Lat & Lon Empty PHP Script To Geo Locate With Lat & Lon

Post by jamied_uk 6th June 2016, 04:18

Geo locate By IP



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
jamied_uk
jamied_uk
Admin

Posts : 2965
Join date : 2010-05-09
Age : 41
Location : UK

https://jnet.sytes.net

Back to top Go down

PHP Script To Geo Locate With Lat & Lon Empty Re: PHP Script To Geo Locate With Lat & Lon

Post by jamied_uk 6th June 2016, 16:49

Find Directions Or Distance

jamied_uk
jamied_uk
Admin

Posts : 2965
Join date : 2010-05-09
Age : 41
Location : UK

https://jnet.sytes.net

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum