Rev 121 | Blame | Last modification | View Log | RSS feed
<?phpinclude_once ($_SERVER['DOCUMENT_ROOT'] . '/php/hosting.php');$minDate = 20190101;$maxDate = date("Ymd");$unique = false;$plottype = "bars";$startTS = 0;$endTS = 0;if (!empty($_GET['start']) && filter_var($_GET['start'], FILTER_VALIDATE_INT, array("options" => array("min_range"=>$minDate, "max_range"=>$maxDate)))) {$date = $_GET['start'] . " 00:00:00 UTC";$dateTime = new DateTime($date);$startTS = $dateTime->format('U');}if (!empty($_GET['end']) && filter_var($_GET['end'], FILTER_VALIDATE_INT, array("options" => array("min_range"=>$minDate, "max_range"=>$maxDate)))) {$date = $_GET['end'] . " 23:59:59 UTC";$dateTime = new DateTime($date);$endTS = $dateTime->format('U');}if (!empty($_GET['unique']) && ($_GET['unique'] == '0' || $_GET['unique'] == '1')) {$unique = ($_GET['unique'] == '1');}$plottypes = array("area","bars","linepoints","lines","pie","points","squared","squaredarea","stackedarea","stackedbars","stackedsquaredarea","thinbarline");if (!empty($_GET['type']) && in_array($_GET['type'], $plottypes)) {$plottype = $_GET['type'];}$height = 1024;if (!empty($_GET['height']) && $_GET['height'] > 0) {$height = $_GET['height'];}$width = 768;if (!empty($_GET['width']) && $_GET['width'] > 0) {$width = $_GET['width'];}include_once ($_SERVER['DOCUMENT_ROOT'] . '/php/constants.php');include_once ($_SERVER['DOCUMENT_ROOT'] . '/php/sessions_db.php');include_once ($_SERVER['DOCUMENT_ROOT'] . '/php/cryptor.php');require_once $_SERVER['DOCUMENT_ROOT'] . '/php/phplot.php';$configFile = parse_ini_file(FCM_CONFIGFILE, true);$crypt = Cryptor::getInstance($configFile['cryptor']);$tmpSessionTab = (isset($_POST["sessionTab"]) && $_POST["sessionTab"] > 0 ? $_POST["sessionTab"] : null);$handler = MySessionHandler::getInstance($tmpSessionTab, $configFile['mysqli']);unset($configFile);session_set_cookie_params(604800, '/', '.findcheapmusic.com', true, true);session_set_save_handler($handler, true);if (!empty($_COOKIE['PHPSESSID'])) {session_id($_COOKIE['PHPSESSID']);}@session_start();$_sess_db = MySessionHandler::getDBSessionId();$countSql = ($unique ? "count(distinct(ip))" : "count(*)");$whereSql = "";if ($startTS > 0 && $endTS > 0) {$whereSql .= " where access between " . $startTS . " and " . $endTS;} else if ($startTS > 0) {$whereSql .= " where access >= " . $startTS;} else if ($endTS > 0) {$whereSql .= " where access <= " . $endTS;}$searches = [];$sql = "select from_unixtime(access, '%m/%d/%Y') as day, " . $countSql . " as count from searches";$sql .= $whereSql;$sql .= " group by from_unixtime(access, '%m/%d/%Y') order by access";$result = mysqli_query($_sess_db, $sql);if (!$result) {error_log("Error: " . $sql . " | " . mysqli_error($_sess_db));} else {if (mysqli_num_rows($result) > 0) {while ($row = mysqli_fetch_assoc($result)) {$searches[] = array($row["day"], $row["count"]);}}}$transfers = [];$sql = "select from_unixtime(access, '%m/%d/%Y') as day, " . $countSql . " as count from transfers";$sql .= $whereSql;$sql .= " group by from_unixtime(access, '%m/%d/%Y') order by access";$result = mysqli_query($_sess_db, $sql);if (!$result) {error_log("Error: " . $sql . " | " . mysqli_error($_sess_db));} else {if (mysqli_num_rows($result) > 0) {while ($row = mysqli_fetch_assoc($result)) {$transfers += array($row["day"] => $row["count"]);}}}$data = [];foreach ($searches as list($k, $v)) {$t = (array_key_exists($k, $transfers) ? $transfers[$k] : 0);$data[] = array($k, $v, $t);}//echo"<pre>";print_r($data);echo "</pre>";$plot = new PHPlot($width, $height);$plot->SetImageBorderType('plain');$title = 'Find Cheap Music';if ($startTS || $endTS) {$title .= "\n";if ($startTS) {$title .= "from " . gmdate("m/d/y", $startTS);}if ($endTS) {$title .= " to " . gmdate("m/d/y", $endTS);}}$plot->SetTitle($title);$plot->SetPlotType($plottype);//$plot->SetShading(0);$plot->SetDataValues($data);$plot->SetLegend(array('Search', 'Transfer'));$plot->SetXDataLabelAngle(90);$plot->SetYTitle(($unique ? "Unique" : "All") . " Requests");$plot->SetYTickIncrement(1);$plot->DrawGraph();