2 require 'include/head.inc';
3 require 'include/db.inc';
4 require 'include/common.inc';
6 if($_GET['mnumber']!="" &&
7 $db->query("SELECT COUNT(*) FROM students WHERE mnumber=" . trim($_GET['mnumber']) . " AND lastblackboard=" . trim($_GET['tstamp']))->fetch(PDO::FETCH_NUM)[0] == 0) {
9 if( $_GET['sign'] == 0 ) {
10 $db->query("UPDATE students SET blackboard=blackboard+1, lastblackboard=" . $_GET['tstamp'] . " WHERE mnumber=" . trim($_GET['mnumber']));
13 $db->query("UPDATE students SET blackboard=blackboard-1, lastblackboard=" . $_GET['tstamp'] . " WHERE mnumber=" . trim($_GET['mnumber']));
17 if ($db->query("SELECT COUNT(*) FROM students")->fetch(PDO::FETCH_NUM)[0] == 0) {
18 block("red", "no students registered");
25 block("black", "blackboard overview");
27 $result=$db->query("SELECT firstname, lastname, mnumber, blackboard FROM students ORDER BY LOWER(lastname)");
30 while ($student = $result->fetch(PDO::FETCH_ASSOC)) {
32 print "<td>" . $student['firstname'] . " </td>";
33 print "<td>" . $student['lastname'] . " </td>";
34 print "<td>" . $student['mnumber'] . " </td>";
35 print "<td>" . $student['blackboard'] . " </td>";
36 print "<td>" . "<a href='blackboard.php?mnumber=" . $student['mnumber'] . "&tstamp=" . time() . "&sign=0'>+1" . "</a></td>";
37 print "<td>" . "<a href='blackboard.php?mnumber=" . $student['mnumber'] . "&tstamp=" . time() . "&sign=1'>-1" . "</a></td>";