]> git.treefish.org Git - banana.git/blobdiff - include/usercheck.inc
...
[banana.git] / include / usercheck.inc
diff --git a/include/usercheck.inc b/include/usercheck.inc
new file mode 100644 (file)
index 0000000..e6cab54
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+  require 'db.inc';
+
+  $mnumber = $_POST['mnumber'];
+  $password = $_POST['password'];
+
+  if($db->query("SELECT COUNT(*) FROM students WHERE mnumber = $mnumber")->fetch(PDO::FETCH_NUM)[0] == 0) {
+    print '<table bgcolor="red">';
+      print '<tr><th><b><font color="white">Mat.nummer not found</font></b></th><tr>';
+    print '</table>';
+    print "Mat.Nummer was not found. You have to register first!";
+    break;
+  }
+
+  if($db->query("SELECT COUNT(*) FROM students WHERE mnumber = $mnumber AND password = \"$password\"")->fetch(PDO::FETCH_NUM)[0] == 0) {
+    print '<table bgcolor="red">';
+      print '<tr><th><b><font color="white">wrong password</font></b></th><tr>';
+    print '</table>';
+    break;
+  }
+  
+?>
\ No newline at end of file