%PDF- %GIF98; %PNG; .
Cyber Programmer
Logo of a company Server : Apache
System : Linux sh00666.bluehost.com 5.14.0-687.26.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jul 14 16:32:02 EDT 2026 x86_64
User : ndkhermy ( 1200)
PHP Version : 8.5.12
Disable Function : NONE
Directory :  /home1/ndkhermy/public_html/website_6ca89795/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home1/ndkhermy/public_html/website_6ca89795/login.php
<?php
if (session_status() == PHP_SESSION_NONE) {
    session_start();
}
include('dbcon.php');
$error = "";
// ✅ LOGIN LOGIC (FIXED)
if (isset($_POST['login'])) {

    $loginInput = trim($_POST['uname']);
    $password = trim($_POST['pass']);

    $stmt = $conn->prepare("SELECT * FROM user WHERE (username = ? OR email = ?) AND password = ?");
    $stmt->bind_param("sss", $loginInput, $loginInput, $password);
    $stmt->execute();
    $result = $stmt->get_result();

    if ($result->num_rows > 0) {

        $row = $result->fetch_assoc();

        if ($row["usertype"] == "") {

            // ✅ IMPORTANT FIX
            $_SESSION["id"] = $row['id'];
            $_SESSION["username"] = $row['username'];

            echo "<script>window.location.href='user/dashboard.php';</script>";
            exit;

        } else {
            $error = "Invalid user type!";
        }

    } else {
        $error = "Username or password not match!!";
    }

    $stmt->close();
}
?>
<?php include('header.php');?>

<style>

.login-section{
    padding:80px 0;
    background:#f5f5f5;
    min-height:600px;
}

.login-card{
    background:#fff;
    border-radius:15px;
    box-shadow:0 5px 25px rgba(0,0,0,.10);
    padding:40px;
}

.login-title{
    text-align:center;
    margin-bottom:30px;
}

.login-title h2{
    font-size:38px;
    font-weight:700;
    color:#111;
}

.login-title p{
    color:#666;
    margin-top:10px;
}

.form-control{
    height:55px;
    border-radius:8px;
    border:1px solid #ddd;
}

.form-control:focus{
    border-color:#009245;
    box-shadow:none;
}

.btn-login{
    width:100%;
    height:55px;
    background:#009245;
    color:#fff;
    border:none;
    border-radius:8px;
    font-size:18px;
    font-weight:600;
    transition:.3s;
}

.btn-login:hover{
    background:#007b38;
}

.login-links{
    margin-top:20px;
    text-align:center;
}

.login-links a{
    color:#009245;
    text-decoration:none;
    font-weight:600;
}

.alert-danger{
    border-radius:8px;
}

</style>

<div class="login-section">

    <div class="container">

        <div class="row justify-content-center">

            <div class="col-lg-5 col-md-7">

                <div class="login-card">

                    <div class="login-title">

                        <h2>Login</h2>

                        <p>
                            Welcome back! Login to your account.
                        </p>

                    </div>

                    <?php if(!empty($error)){ ?>

                        <div class="alert alert-danger">
                            <?php echo $error; ?>
                        </div>

                    <?php } ?>

                    <form method="post">

                        <div class="mb-3">

                            <input
                                type="text"
                                name="uname"
                                class="form-control"
                                placeholder="Username or Email"
                                required>

                        </div>

                        <div class="mb-3">

                            <input
                                type="password"
                                name="pass"
                                class="form-control"
                                placeholder="Password"
                                required>

                        </div>

                        <div class="d-flex justify-content-between mb-4">

                            <div>
                                <input type="checkbox" id="remember">
                                <label for="remember">
                                    Remember Me
                                </label>
                            </div>

                            <div>
                                <a href="forgot-password.php">
                                    Forgot Password?
                                </a>
                            </div>

                        </div>

                        <button
                            type="submit"
                            name="login"
                            class="btn-login">

                            Login

                        </button>

                    </form>

                    <div class="login-links">

                        Don't have an account?

                        <a href="register.php">
                            Register Now
                        </a>

                    </div>

                </div>

            </div>

        </div>

    </div>

</div>

<?php include('footer.php'); ?>

VaKeR 2022