3 include("plotconf.inc");
7 $user = get_record("user", "id", $user);
8 $fullname = fullname($user, true);
9 $username = "<b>$fullname</b> [$user->city, $user->country] : ";
15 if (isset($HTTP_GET_VARS["lastquery"])) {
16 $HTTP_GET_VARS["lastquery"] = clean_param($HTTP_GET_VARS["lastquery"], PARAM_HOST
);
19 // check if it is the user's ip, or another host
21 if(!isset($HTTP_GET_VARS["address"]) ||
($HTTP_GET_VARS["address"] == "")) {
22 $address = $HTTP_SERVER_VARS['REMOTE_ADDR'];
25 $HTTP_GET_VARS["address"] = clean_param($HTTP_GET_VARS["address"], PARAM_HOST
);
26 $address = $HTTP_GET_VARS["address"];
30 // this is the most important function, gets lat/lon and description of location
31 $values = getstuff($address, $local) or die("Error in plot.inc");
33 if(isset($logging) && is_writable("plotlog.txt")) {
34 $log = @fopen
("plotlog.txt", "a") or print "";
35 @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 print "";
39 if(isset($HTTP_COOKIE_VARS["atlasprefs"]) && validcookie($HTTP_COOKIE_VARS["atlasprefs"])) {
40 list( , , , $imagething) = split(":", $HTTP_COOKIE_VARS["atlasprefs"]);
41 $imagething = clean_param($imagething, PARAM_FILE
);
42 $earthimage = isvalidimage($imagething, $earthimages, $defaultimage);
44 $earthimage = $earthimages[$defaultimage];
47 if(strstr($earthimage, ":")) {
48 list($earthimage, , , ) = split(":", $earthimage);
51 // check if we need to run it in css mode
52 if(!shouldrun($HTTP_SERVER_VARS['HTTP_USER_AGENT'])) {
54 list($width, $height) = getimagecoords($earthimages, $earthimage);
56 // make sure some coords were found
57 if($values["lat"] == "" ||
$values["lon"] == "") {
64 list($x, $y) = getlocationcoords($values["lat"], $values["lon"], $width, $height);
66 if(isset($HTTP_COOKIE_VARS["atlasprefs"])) {
67 list( , , , , $dotname) = split(":", $HTTP_COOKIE_VARS["atlasprefs"]);
68 $dotname = clean_param($dotname, PARAM_FILE
);
69 list($thedot, $dotwidth, $dotheight) = finddot($dotname, $cssdots, $defaultdot);
71 $dotname = $cssdots[$defaultdot];
72 list($dotname, , , ) = split(":", $dotname);
73 $dotname = clean_param($dotname, PARAM_FILE
);
74 list($thedot, $dotwidth, $dotheight) = finddot($dotname, $cssdots, $defaultdot);
77 // magical formula for placing the css dot
78 $x = ($x - floor($dotwidth / 2));
79 $y = ($y - floor($dotheight / 2));
82 #dotDiv { padding-left:$x; padding-top:$y; }
84 $display = "<div id=\"dotDiv\"><img width=\"$dotwidth\" height=\"$dotheight\" src=\"$thedot\">";
92 list($width, $height) = getimagecoords($earthimages, $earthimage) or die("Unable to find width/height for image $earthimage in config file");
94 $display = "<img src=\"plotimage.php?lat=$values[lat]&lon=$values[lon]\" width=\"$width\" height=\"$height\" alt=\"\" />";
102 <html><head><title>'.t("Plotting").' '.$values["address"].'</title>
105 <!-- your head tags here -->
106 <link rel="Stylesheet" href="ip-atlas.css">
107 </head><body bgcolor="#FFFFFF">
112 <table valign="top" cellpadding=0 cellspacing=0 border=0 background="'.$earthimage.'" width="'.$width.'" height="'.$height.'"><tr><td valign="top">'.$display.'</td></tr></table>
118 if(isset($address)) {
119 print "$username $values[desc]";
122 $PHP_SELF = 'plot.php';
126 <form method="GET" action="'.$PHP_SELF.'#map">
127 <table width="100%"><tr><td nowrap align="left">
128 '.t("IP/Hostname:").' <input value="'.$values["address"].'" type="text" size="30" name="address" /><input type="Submit" value="'.t("Submit").'" /></td><td align="right" width="100%">
129 [ <a href="ip-atlas_prefs.php?lastquery='?
><?php
if(isset($HTTP_GET_VARS["address"])) { echo $HTTP_GET_VARS["address"]; } ?
><?php
echo '">'.t("preferences").'</a> ]
130 [ <a href="'."$PHP_SELF".'">'.t("locate me").'</a> ]
135 include("footer.inc");
137 print "</body></html>";