query("SELECT password, usertype FROM Users WHERE username='$submitted_username'"); $row = $result->fetch_row(); $stored_password = $row[0]; $stored_usertype = $row[1]; $mysqli->close(); // Set the session variables if the submitted password matches the stored password if ($submitted_password != "" && password_verify($submitted_password,$stored_password)) { $_SESSION['username'] = $submitted_username; $_SESSION['authenticated'] = true; // Set admin to true if the user type is admin if ($stored_usertype == 'admin') $_SESSION['admin'] = true; // Redirect to homepage header("Location: home.php"); die(); } else { $error = true; } } print_html_header("Login"); //print_login($error); print_login_bs($error); print_html_footer(); ?>