query('SELECT * FROM Users WHERE email="'.$_POST['email'].'";'); if($res->num_rows <= 0) { header("Location: /Log In.php?error=INVALID_EMAIL"); exit(); } $res = $res->fetch_assoc(); $pswd = $res['password']; if($_POST['password'] != $pswd) { header("Location: /Log In.php?error=INVALID_PASSWORD"); exit(); } $_SESSION['email'] = $_POST['email']; $_SESSION['user_ID'] = $res['user_ID']; $_SESSION['is_admin'] = $res['is_admin']; if($res['is_admin']) { header("Location: ./AdminDashboard.php"); } else { header("Location: ./Home.php"); } ?>