error_reporting(E_ALL);
include("plotconf.inc");
include("plot.inc");
// check if it is the user's ip, or another host
if(!isset($HTTP_GET_VARS["address"]) || ($HTTP_GET_VARS["address"] == "")) {
$address = $HTTP_SERVER_VARS['REMOTE_ADDR'];
$local = 1;
} else {
$address = $HTTP_GET_VARS["address"];
$local = 0;
}
// this is the most important function, gets lat/lon and description of location
$values = getstuff($address, $local) or die("Error in plot.inc");
if(isset($logging) && is_writable("plotlog.txt")) {
$log = fopen("plotlog.txt", "a") or die("Failed to write to logfile");
fputs($log, $HTTP_SERVER_VARS["REMOTE_ADDR"] ."\t". date("F j, Y, g:i a") . "\t$address\t$values[address]\t$values[lat]\t$values[lon]\n") or die("Failed to add line to logfile");
fclose($log);
}
if(isset($HTTP_COOKIE_VARS["atlasprefs"]) && validcookie($HTTP_COOKIE_VARS["atlasprefs"])) {
list( , , , $imagething) = split(":", $HTTP_COOKIE_VARS["atlasprefs"]);
$earthimage = isvalidimage($imagething, $earthimages, $defaultimage);
} else {
$earthimage = $earthimages[$defaultimage];
}
if(strstr($earthimage, ":")) {
list($earthimage, , , ) = split(":", $earthimage);
}
if(!shouldrun($HTTP_SERVER_VARS['HTTP_USER_AGENT'])) {
list($width, $height) = getimagecoords($earthimages, $earthimage);
list($x, $y) = getlocationcoords($values["lat"], $values["lon"], $width, $height);
if(isset($HTTP_COOKIE_VARS["atlasprefs"])) {
list( , , , , $dotname) = split(":", $HTTP_COOKIE_VARS["atlasprefs"]);
list($thedot, $dotwidth, $dotheight) = finddot($dotname, $cssdots, $defaultdot);
} else {
$dotname = $cssdots[$defaultdot];
list($dotname, , , ) = split(":", $dotname);
list($thedot, $dotwidth, $dotheight) = finddot($dotname, $cssdots, $defaultdot);
}
$x = ($x - floor($dotwidth / 2));
$y = ($y - floor($dotheight / 2));
$extracss = "";
$display = "
";
} else {
list($width, $height) = getimagecoords($earthimages, $earthimage) or die("Unable to find width/height for image $earthimage in config file");
$extracss = "";
$display = "
";
}
print <<
Plotting $values[address]
$extracss
END;
include("middlehtmlcode.inc");
print <<
END;
if(isset($address)) {
print "$values[desc]";
}
$PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF'];
print <<
END;
include("footer.inc");
print "