get_results("ALTER TABLE ".$wpdb->statzhist." ORDER BY date ASC");
$results = $wpdb->get_results("SELECT DAY(date) as days, visitors FROM ".$wpdb->statzhist." WHERE date >= NOW() - INTERVAL 31 DAY");
print "
Besucher: Die letzten 30 Tage
";
print "";
if (empty($results)) {
print "... noch keine Einträge
";
return;
}
foreach ($results as $result) {
$visitors[] = $result->visitors;
$days[] = $result->days;
}
$maxvalue = max($visitors);
$daylabels = implode('|', $days);
print "";
print "
";
print "
";
print "";
print "
";
}
### HISTORY Monatsgrafik GOOGLE-API
function sem_drawAllMonthGoo() {
global $wpdb;
$nummonths = $wpdb->get_var("SELECT MONTH(date) FROM ".$wpdb->statzhist);
$results = $wpdb->get_results("SELECT MONTH(date) as months, SUM(visitors) as visitors FROM ".$wpdb->statzhist." GROUP BY months ORDER BY date ASC");
print "Besucher: Die letzten ".$nummonths." Monate
";
print "";
if (empty($results)) {
print "... noch keine Einträge
";
return;
}
foreach ($results as $result) {
$visitors[] = $result->visitors;
$months[] = $result->months;
}
$maxvalue = max($visitors);
$monthlabels = implode('|', $months);
print "";
print "
";
print "
";
print "";
print "
";
}
### HISTORY ALLE historischen Tage
function sem_drawAllDaysGoo() {
global $wpdb;
$numdays = $wpdb->get_var("SELECT COUNT(date) FROM ".$wpdb->statzhist);
$results = $wpdb->get_results("SELECT referers, visitors, hits, substring(date,1,10) AS date
FROM ".$wpdb->statzhist." GROUP BY date ORDER BY date ASC");
$visitors=$totaldays->visitors;
print "Besucher: ".$numdays." Tage zurück
";
print "";
if (empty($results)) {
print "... noch keine Einträge
";
return;
}
foreach($results as $result) {
$visitors[] = $result->visitors;
$hits[] = $result->hits;
$referers[] = $result->referers;
}
$maxvalue = max($visitors);
print "";
print "
";
print "
";
print "";
print "
";
}
function sem_showAllDaysInNumbers() {
global $wpdb;
$numdays = $wpdb->get_var("SELECT COUNT(date) as num FROM $wpdb->statzhist");
$results = $wpdb->get_results("SELECT referers, visitors, hits, substring(date,1,10) AS date
FROM ".$wpdb->statzhist." GROUP BY date ORDER BY date DESC");
print "Die letzten ".$numdays." Tage
";
if (empty($results)) {
print "... noch keine Einträge";
return;
}
print "";
print "";
print "";
print "Datum | ";
print "Besucher | ";
print "Hits | ";
print "Referer | ";
print " | ";
print "
";
print "";
print "";
foreach($results as $key=>$result) {
$date = mysql2date('d.m.Y',$result->date);
$visitors = $result->visitors; $sum_visitors += $visitors;
$hits = $result->hits; $sum_hits += $hits;
$referers = $result->referers; $sum_referers += $referers;
print "";
print "".$date." | ";
print "".$visitors." | ";
print "".$hits." | ";
print "".$referers." | ";
print " | ";
print "
";
}
print " |
";
print "";
print "Gesamt | ";
print "".$sum_visitors." | ";
print "".$sum_hits." | ";
print "".$sum_referers." | ";
print "
";
print "";
print "Durchschnitt | ";
print "".ceil($sum_visitors / $numdays)." | ";
print "".ceil($sum_hits / $numdays)." | ";
print "".ceil($sum_referers / $numdays)." | ";
print "
";
print "";
print "
";
print "
";
}
### ANZEIGE HISTORY
print "";
print "
";
print "
Semmelstatz › Historie
";
sem_drawLast30DaysGoo();
sem_drawAllMonthGoo();
sem_drawAllDaysGoo();
sem_showAllDaysInNumbers();
sem_showCopyright();
print "
";
?>