You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$res = $db->Execute("select dayofyear(timestamp) as day, id from log where dayofyear(timestamp) = dayofyear(now()) group by id;");
header("OK", true, 200);
print$res->RecordCount();
} else {
header("Internal Server Error", true, 500);
print"Error inserting checkin to database";
}
} elseif(array_key_exists('report',$_GET)) {
switch( $_GET['report'] ) {
case'daily':
$res = $db->Execute("select date(timestamp) as day, id from log where dayofyear(timestamp) >= dayofyear(now()) - 30 group by dayofyear(timestamp), id;");
if( ! $res ) {
print$db->ErrorMsg();
die();
}
while( $row = $res->FetchRow() ) {
$data[$row['day']]++;
}
printjson_encode($data);
print"\n";
break;
case'last':
$res = $db->Execute("select id from log order by timestamp DESC limit 1;");