echo '<meta charset="UTF-8" />'; echo "</head><body><h1>Ajto log graph</h1>"; $mysqli = new mysqli("localhost", "kovi", "", "ajto"); if ($mysqli->connect_errno) { echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error; } //echo $mysqli->host_info . "\n"; echo "<div style='padding-bottom:10px;'><a href='?'>[hours]</a> <a href='?type=daily'>[days]</a></div>"; if (isset($_GET["type"]) && $_GET["type"] == "daily") { echo '<div style="margin-left:10px; margin-right:20px;">'; RenderTimeTable(); $dayLimit = 14; for ($i = 0; $i < $dayLimit; $i++) { RenderNap($mysqli, $i); } echo '</div>'; } else { $all = QueryStatSimple($mysqli); $weekdays = QueryStatSimple($mysqli, "weekdays"); $weekend = QueryStatSimple($mysqli, "weekend"); $weekdays = FillUntil($weekdays, "hour", 23); $weekend = FillUntil($weekend, "hour", 23); $graph = new Graph(); echo "<h2>Minden nap</h2>"; echo $graph->Render($all); echo "<h2>Hétköznap</h2>"; echo $graph->Render($weekdays); echo "<h2>Hétvége</h2>"; echo $graph->Render($weekend); echo "</body></html>"; }