MOON
Server: Apache
System: Linux server30c.hostingraja.org 3.10.0-962.3.2.lve1.5.63.el7.x86_64 #1 SMP Fri Oct 8 12:03:35 UTC 2021 x86_64
User: jibhires (1887)
PHP: 8.1.30
Disabled: show_source, system, shell_exec, passthru, exec, popen, proc_open, allow_url_fopen, symlink, escapeshellcmd, pcntl_exec
Upload Files
File: //home/jibhires/brightsolutionsindia.com/images/login_process.php
<?php
session_start();
include 'db_connect.php';  // Include the database connection

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $username = $_POST['username'];
    $password = $_POST['password'];

    // Check the database for the user
    $stmt = $pdo->prepare("SELECT * FROM users WHERE username = ?");
    $stmt->execute([$username]);
    $user = $stmt->fetch();

    // Verify password and set session if successful
    if ($user && password_verify($password, $user['password'])) {
        $_SESSION['user_id'] = $user['id'];   // Store user ID in session
        $_SESSION['role'] = $user['role'];    // Store user role in session
        header('Location: dashboard.php');    // Redirect to dashboard
    } else {
        echo "Invalid login credentials.";
    }
}
?>