2 require 'include/head.inc';
3 require 'include/db.inc';
4 require 'include/common.inc';
6 if($_GET['mnumber']!="") {
7 // would be better to store timestamp in blackboard db!
8 if( time()-$_GET['tstamp'] < 5 ) {
9 $db->query("UPDATE students SET blackboard=blackboard+1 WHERE mnumber=" . trim($_GET['mnumber']));
10 block("lightgreen", "added blackboard");
14 if ($db->query("SELECT COUNT(*) FROM students")->fetch(PDO::FETCH_NUM)[0] == 0) {
15 block("red", "no students registered");
22 block("black", "blackboard overview");
24 $result=$db->query("SELECT firstname, lastname, mnumber, blackboard FROM students");
27 while ($student = $result->fetch(PDO::FETCH_ASSOC)) {
29 print "<td>" . $student['firstname'] . " </td>";
30 print "<td>" . $student['lastname'] . " </td>";
31 print "<td>" . $student['mnumber'] . " </td>";
32 print "<td>" . $student['blackboard'] . " </td>";
33 print "<td>" . "<a href='blackboard.php?mnumber=" . $student['mnumber'] . "&tstamp=" . time() . "'>+1" . "</a></td>";