
<?php
session_start();
include 'db.php'; // Must define $conn = new mysqli(...)

$message = "";
 
// --- LOGIN ---
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['login'])) {
   

    $stmt = $conn->prepare("SELECT id, fullname FROM usermaster WHERE username=? OR mobile=?");
    $stmt->bind_param("ss", $username, $username);
    $stmt->execute();
    $res = $stmt->get_result();

    if ($res->num_rows > 0) {
        $user = $res->fetch_assoc();
        if (password_verify($password, $user['password'])) {
            $_SESSION['userid'] = $user['id'];
            $_SESSION['fullname'] = $user['fullname'];  
            header("Location:https://us06web.zoom.us/j/87346766913?pwd=3ggO3lJfOoI2ju3p0aCj93pIYK8XVX.1");
            exit;
        } else {
            $message = "<div class='alert alert-danger'>Invalid password.</div>";
        }
    } else {
        $message = "<div class='alert alert-danger'>User not found.</div>";
    }
}

?>
 