$value) { if ($header == "Accept") { $accept = $value; } } // Variable checks $allowed = isset($_GET['allowed']); if ($allowed && !$_GET['allowed'] == file_get_contents($passwdfile)) { die("Sorry, this needs a password now.
"); } $nocir = !isset($_GET['nocircles']); if (isset($_GET['count'])) { $count = intval($_GET['count']); } else { $count = 10; } // Getting data if (isset($_GET['date']) && intval($_GET['date']) != 0 && strlen($_GET['date']) == 8) { $date = intval($_GET['date']); $datarr = explode("\n", shell_exec("grep $date $logpath --color=never")); array_pop($datarr); } else { $datarr = explode("\n", shell_exec("tail -n$count $logpath")); } // Correcting for allowed data $last = str_getcsv(array_pop($datarr)); if (!$allowed) $last = array($last[0], substr($last[1],0,6), substr($last[2],0,6)); // Creating static image url $imageurl = "https://maps.googleapis.com/maps/api/staticmap?scale=2&format=jpg&zoom="; if ($allowed) $imageurl .= "18"; else $imageurl .= "15"; $imageurl .= "¢er=" . $last[1] . "," . $last[2]; if ($allowed) $imageurl .= "&markers=" . $last[1] . "," . $last[2]; // Json returning if (isset($_GET['json'])) { header("Content-Type: application/json"); $arr = array(); foreach ($datarr as $item) { $tmp = str_getcsv($item); if (!$allowed) $tmp = array($tmp[0], substr($tmp[1],0,6), substr($tmp[2],0,6), "1111"); $arr[] = $tmp; } echo json_encode(array("markers" => $arr, "imageurl" => $imageurl)); die(); } // Mobile support { require_once 'Mobile_Detect.php'; // http://mobiledetect.net/ remove this block if you don't need this functionality $detect = new Mobile_Detect; if (isset($_GET['mobile']) || $detect->isMobile()) { ?>