]> git.treefish.org Git - banana.git/blob - include/usercheck.inc
...
[banana.git] / include / usercheck.inc
1 <?php
2
3   require 'db.inc';
4   require 'common.inc';
5
6   $mnumber = $_POST['mnumber'];
7   $password = $_POST['password'];
8
9   if(! is_numeric($mnumber)) {
10     block("red", "Matr.nummer has to be numeric!");
11     exit;
12   }
13
14   if($db->query("SELECT COUNT(*) FROM students WHERE mnumber = $mnumber")->fetch(PDO::FETCH_NUM)[0] == 0) {
15     print '<table bgcolor="red">';
16       print '<tr><th><b><font color="white">Mat.nummer not found</font></b></th><tr>';
17     print '</table>';
18     print "Mat.Nummer was not found. You have to register first!";
19     exit;
20   }
21
22   if($db->query("SELECT COUNT(*) FROM students WHERE mnumber = $mnumber AND password = \"$password\"")->fetch(PDO::FETCH_NUM)[0] == 0) {
23     print '<table bgcolor="red">';
24       print '<tr><th><b><font color="white">wrong password</font></b></th><tr>';
25     print '</table>';
26     exit;
27   }
28   
29 ?>