<!doctype html>
<html>
<head>
<title>Using Geoip Data Feed Information of http://www.telize.com/ (thanks) - RJM Programming - April, 2015</title>
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<link href='//www.rjmprogramming.com.au/PHP/emboss_h1.css' rel='stylesheet' type='text/css'>
<script type="text/javascript">
var firstgo = 1;
var selc = 0;
var latitude = 0;
var longitude = 0;
var llsuff = ""; // remember http://www.rjmprogramming.com.au/wordpress/?p=8961
var thislat = 0.0;
var thislong = 0.0;
var myurl = "";
var mydisturl = "";
var firstll = "";
var ispandme = "ISP%20and%20Me";
$(document).ready(function() {
$.getJSON("http://www.telize.com/geoip?callback=?",
function(json) {
getLocation();
var valis = "", countryis = "", regionis = "", cityis = "", latituderecis = "";
var aid = ["ip|https://who.is/whois-ip/ip-address/$##$", "country|https://www.google.com.au/maps?q=+++&bav=on.2,or.&bvm=bv.90491159,d.dGY&biw=1285&bih=671&dpr=1&um=1&ie=UTF-8&sa=X&ei=qDsqVaj7MsPYmgW5r4GQAw&ved=0CAYQ_AUoAQ", "country_code|http://geotags.com/iso3166/iso.%%.html", "country_code3|https://www.google.com.au/search?q=@@@&ie=utf-8&oe=utf-8&gws_rd=cr&ei=okEqVbOrFIXKmAXt5IHAAQ#q=###+country+code", "region_code|http://en.wikipedia.org/wiki/Telephone_numbers_in_!@!", "region|https://www.google.com.au/maps?q=+@+@+&bav=on.2,or.&bvm=bv.90491159,d.dGY&biw=1285&bih=671&dpr=1&um=1&ie=UTF-8&sa=X&ei=qDsqVaj7MsPYmgW5r4GQAw&ved=0CAYQ_AUoAQ", "city|https://www.google.com.au/maps?q=+@++@+&bav=on.2,or.&bvm=bv.90491159,d.dGY&biw=1285&bih=671&dpr=1&um=1&ie=UTF-8&sa=X&ei=qDsqVaj7MsPYmgW5r4GQAw&ved=0CAYQ_AUoAQ", "postal_code|https://www.google.com.au/search?q=@()@+postal+code&ie=utf-8&oe=utf-8&gws_rd=cr&ei=-EgqVYycN4LYmAW6q4HgDg", "continent_code|http://www.worldcitiesdb.com/continent/%%", "latitude|http://www.rjmprogramming.com.au/PHP/Map/map.php?title=@()@&label=[%27Lat%27,&value=%27Lon%27,%20%27Name%27]&data=,%20[@(lat)@,@(long)@,~@()@~]", "longitude|http://www.rjmprogramming.com.au/PHP/Map/map.php?title=@()@&label=[%27Lat%27,&value=%27Lon%27,%20%27Name%27]&data=,%20[@(lat)@,@(long)@,~@()@~]", "dma_code", "area_code", "asn|http://www.datacentermap.com/^^/$$$$.html", "isp|https://www.google.com.au/?gfe_rd=cr&ei=dC8qVeraKcyN8QfGi4CwDA&gws_rd=ssl#q=+++", "timezone|http://www.timeanddate.com/worldclock/1/2/"];
aid.forEach(function(bigentry) {
var entry = bigentry.split("|");
if (typeof(eval("json." + entry[0])) != "undefined") {
valis = eval("json." + entry[0]);
if (entry[0] == "country") countryis = valis;
if (entry[0] == "region") regionis = valis;
if (entry[0] == "city") cityis = valis;
//alert(entry[0] + " has value " + valis);
if (entry.length > 1) {
if (entry[0] == "longitude") {
entry[1] = latituderecis;
entry[1] = entry[1].replace("@(long)@", valis);
firstll = firstll.replace("@(long)@", valis);
} else if (entry[0] == "latitude") {
//alert(99);
entry[1] = entry[1].replace("@(lat)@", valis);
firstll = ",[" + valis + ",@(long)@,~" + cityis.replace(/ /g, "%20") + "," + regionis.replace(/ /g, "%20") + "," + countryis.replace(/ /g, "%20") + "~]";
entry[1] = entry[1].replace("@()@", cityis.replace(/ /g, "+") + "," + regionis.replace(/ /g, "+") + "," + countryis.replace(/ /g, "+")).replace("@()@", cityis.replace(/ /g, "+") + "," + regionis.replace(/ /g, "+") + "," + countryis.replace(/ /g, "+"));
//alert(98);
} else {
if (valis.length > 2) entry[1] = entry[1].replace("^^", (valis.substring(0,2)).toLowerCase()).replace("$$$$", valis.substring(2));
if (valis.length > 2) entry[1] = entry[1].replace("@@@", (valis.substring(0,3)).toUpperCase()).replace("###", (valis.substring(0,3)).toLowerCase());
entry[1] = entry[1].replace("!@!", countryis.replace(/ /g, "_"));
entry[1] = entry[1].replace("%%", (valis.substring(0,2)).toUpperCase());
entry[1] = entry[1].replace("@!@", valis.replace(/ /g, "%20"));
entry[1] = entry[1].replace("$##$", valis);
entry[1] = entry[1].replace("+++", valis.replace(/ /g, "+"));
entry[1] = entry[1].replace("@()@", cityis.replace(/ /g, "+") + "," + regionis.replace(/ /g, "+") + "," + countryis.replace(/ /g, "+")).replace("@()@", cityis.replace(/ /g, "+") + "," + regionis.replace(/ /g, "+") + "," + countryis.replace(/ /g, "+"));
entry[1] = entry[1].replace("+@+@+", valis.replace(/ /g, "+") + "," + countryis.replace(/ /g, "+"));
entry[1] = entry[1].replace("+@++@+", valis.replace(/ /g, "+") + "," + regionis.replace(/ /g, "+") + "," + countryis.replace(/ /g, "+"));
entry[1] = entry[1].replace("/1/2/", "/" + valis.toLowerCase() + "/");
}
if (entry[0] == "latitude") {
latituderecis = entry[1];
}
if (entry[1].indexOf("rjmprogramming.com.au") != -1) {
if (entry[0] == "latitude") {
thislat = valis;
document.getElementById(entry[0]).innerHTML = valis;
} else if (entry[0] == "longitude") {
thislong = valis;
document.getElementById(entry[0]).innerHTML = "<a target=_blank title='" + valis + "' href='" + entry[1] + "'>" + valis + "</a>";
document.getElementById('mydiv').innerHTML = "<br><br><table id='mytable'><tbody id='mytbody'><tr id='mytr'><td><iframe height=500 width=500 title='" + valis + "' src='" + entry[1] + "'></iframe></td></tr></tbody></table>";
} else {
document.getElementById(entry[0]).innerHTML = "<a target=_blank title='" + valis.replace(/'/g, " ") + "' href='" + entry[1] + "'>" + valis + "</a>";
}
} else {
document.getElementById(entry[0]).innerHTML = "<a target=_blank title='" + valis.replace(/'/g, " ") + "' href='" + entry[1] + "'>" + valis + "</a>";
}
} else {
document.getElementById(entry[0]).innerHTML = valis;
}
}
});
}
);
});
function great_circle_distance(talis, gnolis, latis, longis) {
var ourdist=0.0;
var rgnol=eval((gnolis) * Math.PI / 180.0);
var rtal=eval((talis) * Math.PI / 180.0);
var rlong=eval((longis) * Math.PI / 180.0);
var rlat=eval((latis) * Math.PI / 180.0);
var deltalong = Math.abs(eval(((gnolis)-(longis)) * Math.PI / 180.0));
var acof = eval(Math.sin(rtal) * Math.sin(rlat)) + (Math.cos(rtal) * Math.cos(rlat) * Math.cos(deltalong)); // via http://en.wikipedia.org/wiki/Great-circle_distance ... thanks
ourdist = eval(Math.round((Math.acos(acof) * 6371000.0) + 0.00001) * 100) / 100;
return ourdist;
}
function showLocation( position ) {
var cdate = new Date(); // thanks to http://stackoverflow.com/questions/10211145/getting-current-date-and-time-in-javascript
latitude = position.coords.latitude;
longitude = position.coords.longitude;
//llsuff = "&latitude=" + latitude + "&longitude=" + longitude + "&maxdist=" + document.getElementById('maxdist').value;
//document.getElementById('myh2').innerHTML = "Current Location is Latitude: " + latitude + " and Longitude: " + longitude + " at " + ("0" + cdate.getDate()).slice(-2) + "/" + ("0" + eval(1 + cdate.getMonth())).slice(-2) + "/" + cdate.getFullYear() + ":" + ("0" + cdate.getHours()).slice(-2) + ":" + ("0" + cdate.getMinutes()).slice(-2) + ":" + ("0" + cdate.getSeconds()).slice(-2);
if (firstgo == 1) {
firstgo = 0;
if (longitude < thislong) ispandme = "Me%20and%20ISP";
myurl = "http://www.rjmprogramming.com.au/PHP/Map/map.php?title=My%20position&label=[%27Lat%27,&value=%27Lon%27,%20%27Name%27]&data=,%20[" + latitude + "," + longitude + ",~My%20position~]";
mydisturl = myurl.replace("=My%20position", "=" + ispandme) + firstll;
document.getElementById('latitude').innerHTML += "<br><br>Vs<br><br>" + latitude.toFixed(5).replace(/0+$/, "");
document.getElementById('longitude').innerHTML += "<br><br>Vs<br><br><a target=_blank title='My position' href='" + myurl + "'>" + longitude.toFixed(5).replace(/0+$/, "") + "</a>";
document.getElementById('mytr').innerHTML += "<td><iframe height=500 width=450 title='My position' src='" + myurl + "'></iframe></td>";
document.getElementById('mytr').innerHTML += "<td><iframe height=500 width=450 title='" + ispandme.replace(/%20/g, " ") + "' src='" + mydisturl + "'></iframe></td>";
document.getElementById('myh1').innerHTML += " (<a target=_blank title='" + ispandme.replace(/%20/g, " ") + "' href='" + mydisturl + "'>" + eval(great_circle_distance(latitude, longitude, thislat, thislong) / 1000.0) + "</a> kilometres away from me)";
//alert("You are at " + latitude + ", " + longitude);
//setInterval(getLocation, 30000);
}
}
function errorHandler( err ) {
if (err.code == 1) {
// access is denied
alert("Access is denied");
}
}
function getLocation() {
if (selc == 0) {
var geolocation = navigator.geolocation;
geolocation.getCurrentPosition(showLocation, errorHandler,
{maximumAge: 75000});
}
}
</script>
</head>
<body style='background-color: #f0f0f0;'>
<h1 id='myh1' align="center">Where Does the Current ISP Say My IP Address Is <a target=_blank title='Thanks to Telize at http://www.telize.com/ and Gearside Creative at http://gearside.com/public-json-feeds/' href='http://www.telize.com/'>?</a></h1>
<!--h2 id='myh2'></h2><input type="text" id="maxdist" value="" /-->
<table cellpadding=5 cellspacing=5 style="border: 3px green solid;"><tr style='background-color: yellow; font-size:12px;'>
<th title="ip">ip (Visitor IP address, or IP address specified as parameter)
</th><th title="country_code">country_code (Two-letter ISO 3166-1 alpha-2 country code)
</th><th title="country_code3">country_code3 (Three-letter ISO 3166-1 alpha-3 country code)
</th><th title="country">country (Name of the country)
</th><th title="region_code">region_code (Two-letter ISO-3166-2 state / region code)
</th><th title="region">region (Name of the region)
</th><th title="city">city (Name of the city)
</th><th title="postal_code">postal_code (Postal code / Zip code)
</th><th title="continent_code">continent_code (Two-letter continent code)
</th><th title="latitude">latitude (Latitude)
</th><th title="longitude">longitude (Longitude)
</th><th title="dma_code">dma_code (DMA Code)
</th><th title="area_code">area_code (Area Code)
</th><th title="asn">asn (Autonomous System Number)
</th><th title="isp">isp (Internet service provider)
</th><th title="timezone">timezone (Time Zone)
</th></tr><tr style='background-color: lightblue; font-size:18px;'>
<td id="ip">ip (Visitor IP address, or IP address specified as parameter)
</td><td id="country_code">country_code (Two-letter ISO 3166-1 alpha-2 country code)
</td><td id="country_code3">country_code3 (Three-letter ISO 3166-1 alpha-3 country code)
</td><td id="country">country (Name of the country)
</td><td id="region_code">region_code (Two-letter ISO-3166-2 state / region code)
</td><td id="region">region (Name of the region)
</td><td id="city">city (Name of the city)
</td><td id="postal_code">postal_code (Postal code / Zip code)
</td><td id="continent_code">continent_code (Two-letter continent code)
</td><td id="latitude">latitude (Latitude)
</td><td id="longitude">longitude (Longitude)
</td><td id="dma_code">dma_code (DMA Code)
</td><td id="area_code">area_code (Area Code)
</td><td id="asn">asn (Autonomous System Number)
</td><td id="isp">isp (Internet service provider)
</td><td id="timezone">timezone (Time Zone)
</td></tr></table>
<div id='mydiv' align="center"></div>
</body>
</html>