- if(isset($_POST['submit']) && $_POST['mnumber']!="") {
- $db->query("UPDATE students SET blackboard=blackboard+1 WHERE mnumber=" . trim($_POST['mnumber']));
- block("lightgreen", "added blackboard");
+ if($_GET['mnumber']!="" &&
+ $db->query("SELECT COUNT(*) FROM students WHERE mnumber=" . trim($_GET['mnumber']) . " AND lastblackboard=" . trim($_GET['tstamp']))->fetch(PDO::FETCH_NUM)[0] == 0) {
+
+ if( $_GET['sign'] == 0 ) {
+ $db->query("UPDATE students SET blackboard=blackboard+1, lastblackboard=" . $_GET['tstamp'] . " WHERE mnumber=" . trim($_GET['mnumber']));
+ }
+ else {
+ $db->query("UPDATE students SET blackboard=blackboard-1, lastblackboard=" . $_GET['tstamp'] . " WHERE mnumber=" . trim($_GET['mnumber']));
+ }