File: /home/nyiet8349bzl/public_html/oldwebsite.sbsc.in/faculty/admin/login.php
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
include "../config/database.php";
if (isset($_POST['login'])) {
$username = trim($_POST['username']);
$password = trim($_POST['password']);
$stmt = $conn->prepare(
"SELECT id, password FROM admin_users WHERE username = ?"
);
$stmt->bind_param("s", $username);
$stmt->execute();
$stmt->bind_result($admin_id, $hash);
$stmt->fetch();
if ($admin_id && password_verify($password, $hash)) {
$_SESSION['admin_logged_in'] = true;
$_SESSION['admin_id'] = $admin_id;
header("Location: dashboard.php");
exit;
} else {
$error = "Invalid login credentials";
}
$stmt->close();
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Admin Login</title>
<!-- OPEN SANS -->
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700&display=swap" rel="stylesheet">
<style>
*{
box-sizing:border-box;
font-family:'Open Sans', sans-serif;
}
body{
margin:0;
height:100vh;
display:flex;
align-items:center;
justify-content:center;
background:#3f5efb;
}
.login-container{
width:900px;
height:420px;
background:#fff;
border-radius:18px;
display:flex;
overflow:hidden;
box-shadow:0 30px 60px rgba(0,0,0,.25);
}
/* LEFT */
.login-left{
width:50%;
padding:50px;
}
.login-left h2{
margin:0 0 20px;
font-weight:700;
}
.login-left input{
width:100%;
padding:12px 14px;
margin-bottom:15px;
border:1px solid #ddd;
border-radius:6px;
font-size:14px;
}
.login-left button{
width:100%;
padding:12px;
border:none;
background:#3f5efb;
color:#fff;
border-radius:6px;
font-size:15px;
cursor:pointer;
}
.login-left .error{
color:red;
margin-bottom:12px;
font-size:13px;
}
/* RIGHT */
.login-right{
width:50%;
background:#f4f7ff;
display:flex;
align-items:center;
justify-content:center;
padding:30px;
}
.login-right img{
width:90%;
max-width:350px;
}
.login-right h3{
margin-top:20px;
font-weight:600;
}
</style>
</head>
<body>
<div class="login-container">
<!-- LEFT LOGIN -->
<div class="login-left">
<h2>Admin Login</h2>
<?php if(isset($error)){ ?>
<div class="error"><?php echo $error; ?></div>
<?php } ?>
<form method="post">
<input type="text" name="username" placeholder="Enter Username" required>
<input type="password" name="password" placeholder="Enter Password" required>
<button name="login">Login</button>
</form>
</div>
<!-- RIGHT ILLUSTRATION -->
<div class="login-right">
<div style="text-align:center">
<img src="https://sbsec.org/images/logo.png">
<h3>Shaheed Bhagat Singh Evening College</h3>
</div>
</div>
</div>
</body>
</html>