query($req_count_total) as $res)
{ $total = $res['counted']; }
foreach ($dbh->query($req_count_entertainment) as $res)
{ $entertainment = $res['counted']; }
foreach ($dbh->query($req_count_work) as $res)
{ $work = $res['counted']; }
foreach ($dbh->query($req_count_social) as $res)
{ $social = $res['counted']; }
$first_request = "[date unkown]";
# to define by getting the date of the first request
print "
Browsing since $first_request
\n";
$rest = $total - $entertainment + $social + $work;
print "
Distribution
$total = entertainment ($entertainment) + social ($social) + work ($work) + the rest.\n";
print "
";
if ( $rest > ($total / 4) )
print "Warning: more than a quarter of the total are not classified, patterns should be improved.
\n";
print "
Top 20 websites
\n";
print "\n";
print "Visits | Title (if missing, URL) | |
\n";
foreach ($dbh->query($top_request) as $row) {
if ($row['title']=="")
print "".$row['visit_count']." | ".$row['url']." | |
\n";
else
print "".$row['visit_count']." | ".$row['title']." | |
\n";
}
print "
\n";
/*** close the database connection ***/
$dbh = null;
}
catch(PDOException $e) {
echo $e->getMessage();
}
?>