function vc_read_stat_sum_per_day($path = "%", $sortBy, $sort, $type = "all", $limit) { $config = vc_get_config(); if (!isset($sortBy)) { $sortBy = $config["sortBy"]; } if (!isset($sort)) { $sort = $config["sortOrder"]; } if (!isset($limit)) { $limit = $config["top_max"]; } $db = vc_do_db_connect(); if ($type == "all") { $sth = $db->prepare(" SELECT day, count( visitor) as counter FROM vc_statistics WHERE day LIKE :day GROUP BY day ORDER by {$sortBy} {$sort} "); } elseif ($type == "top") { $sth = $db->prepare(" SELECT day, count(visitor) as counter FROM vc_statistics WHERE day LIKE :day GROUP BY day ORDER by {$sortBy} {$sort} LIMIT 0 , :max "); $sth->bindParam(':max', $limit, PDO::PARAM_INT); } if ($sth) { $generic_day = ""; if ($day == "%") { $generic_day = "%"; } else { $generic_day = $day . '%'; } $sth->bindParam(':day', $generic_day); if (!$sth->execute()) { print_r($sth->errorInfo()); die("Error executing statement "); } $result = $sth->fetchAll(); # Tidy array up, I only want named keys foreach ($result as &$line) { unset($line[0]); unset($line[1]); $date_arr = date_parse($line['day'] . " 00:00:00"); $line['day'] = date("F j, Y", mktime(0, 0, 0, $date_arr['month'], $date_arr['day'], $date_arr['year'])); } return $result; } else { print_r($db->errorInfo()); die("\n no valid statement could be found"); } }
The HTML output is based on a file pointed in "vc.conf.php" to. That file lays on librarybox in the content folder http://librarybox.us/content/.... which is in reality on the USB stick. That file can simply exchanged without the need of touching the logic behind. Currently I don't have the path filter programmed in that. script CHANGELOG: 0.1 RELEASE ********************************************/ require_once "vc.conf.php"; include "vc.func.php"; $config = vc_get_config(); $sort = $config["sortOrder"]; $sortBy = $config["sortBy"]; $top_max = $config["top_max"]; $output_type = $config["output_type"]; $list_type = $config["list_type"]; if (isset($_GET['sortOrder'])) { if ($_GET['sortOrder'] == 'ASC') { $sort = 'ASC'; } else { $sort = 'DESC'; } } if (isset($_GET['sortBy'])) { if ($_GET["sortBy"] == "url") { $sortBy = "url";