Ok, here goes...
In stats.php, add this:
Code:
echo "<option value=\"views\">Thread Views</option>\n";
right after this code:
Code:
echo "<option value=\"thread\">Threads</option>\n";
Now replace this:
Code:
if ($type == "thread") {
$table = "thread";
$field = "dateline";
} elseif ($type == "post") {
$table = "post";
$field = "dateline";
} elseif ($type == "user") {
$table = "user";
$field = "joindate";
}
with this:
Code:
if ($type == "thread") {
$table = "thread";
$field = "dateline";
$countsql = "COUNT(*)";
} elseif ($type == "views") {
$table = "thread";
$field = "dateline";
$countsql = "SUM(views)";
} elseif ($type == "post") {
$table = "post";
$field = "dateline";
$countsql = "COUNT(*)";
} elseif ($type == "user") {
$table = "user";
$field = "joindate";
$countsql = "COUNT(*)";
}
And last, replace this:
Code:
$stats = $DB_site->query("SELECT COUNT(*), DATE_FORMAT(FROM_UNIXTIME($field),'$sqlformat') AS timeframe, MAX($field) FROM $table WHERE $field > '$from' AND $field < '$to' GROUP BY timeframe ORDER BY $field $sort");
with this:
Code:
$stats = $DB_site->query("SELECT $countsql , DATE_FORMAT(FROM_UNIXTIME($field),'$sqlformat') AS timeframe, MAX($field) FROM $table WHERE $field > '$from' AND $field < '$to' GROUP BY timeframe ORDER BY $field $sort");
Not tested, but should work.