Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function verify_credentials() {
- <?php
- session_start();
- //Connect to database.
- include("connect.php");
- $email = $_POST["email"];
- $password = $_POST["password"];
- $admin = $_POST["admin"];
- //Query the database for login details.
- $query = "SELECT * FROM CSC2043_users WHERE email='$email' AND password='$password'";
- $verify = mysqli_query($conn, $query) or die(myqli_error($conn));
- //If there is a match in the database.
- if(mysqli_num_rows($verify) > 0) {
- //Create a session for the user.
- $_SESSION['user'] = $email;
- header("Location: profile.php");
- } else {
- //Invalid input. Enter details again.
- header("Location: login.php");
- }
- mysqli_close($conn);
- ?>
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement