87 lines
No EOL
2.8 KiB
PHP
87 lines
No EOL
2.8 KiB
PHP
<?php
|
|
require('components/utils.php');
|
|
require('components/db_config.php');
|
|
|
|
session_start();
|
|
if((isset($_SESSION['adminLogin']) && $_SESSION['adminLogin'] == true)){
|
|
redirect('dashboard.php');
|
|
}
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Admin Login Panel | Midtown Hotel</title>
|
|
<?php require('components/link.php') ?>
|
|
<style>
|
|
.btn-main{
|
|
background-color: #112E2E;
|
|
border: none;
|
|
color: white;
|
|
padding: 6px 12px;
|
|
text-align: center;
|
|
font-size: 18px;
|
|
border-radius: 3px;
|
|
}
|
|
.btn-main:hover{
|
|
background-color: #194141;
|
|
color: #B6C2C2;
|
|
transition: all 0.5s ease;
|
|
}
|
|
.login-form{
|
|
position: absolute;
|
|
top: 50%;
|
|
left: 50%;
|
|
transform: translate(-50%, -50%);
|
|
width: 300px;
|
|
}
|
|
.custom-alert{
|
|
position: fixed;
|
|
top: 25px;
|
|
right: 25px;
|
|
}
|
|
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="login-form text-center rounded shadow overflow-hidden" style="background-color: #B6C2C2;">
|
|
<form method="POST">
|
|
<div class="py-2 d-flex justify-content-between align-items-center" style="background-color: #112E2E;">
|
|
<img src="../images/logo-white.png" style="width: 100px;"/>
|
|
<h5 class="text-white" style="font-weight: 600; text-transform: uppercase; margin-right: 20px;">Admin Login</h5>
|
|
</div>
|
|
<div class="m-4">
|
|
<div class="mb-4">
|
|
<input required name="admin_name" type="text" class="form-control shadow-none" placeholder="Username"/>
|
|
</div>
|
|
<div class="mb-4">
|
|
<input required name="admin_pass" type="password" class="form-control shadow-none" placeholder="Password"/>
|
|
</div>
|
|
<button name="login" type="submit" class="btn btn-main">Login</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
<?php
|
|
if(isset($_POST['login'])){
|
|
$frm_data = filteration($_POST);
|
|
$query = "SELECT * FROM `admin_creds` WHERE `admin_name`=? AND `admin_pass`=?";
|
|
$values = [$frm_data['admin_name'], $frm_data['admin_pass']];
|
|
|
|
$res = select($query, $values, "ss");
|
|
if($res->num_rows==1){
|
|
$row = mysqli_fetch_assoc($res);
|
|
$_SESSION['adminLogin'] = true;
|
|
$_SESSION['adminId'] = $row['sr_no'];
|
|
redirect('dashboard.php');
|
|
} else{
|
|
alert('error', 'Invalid credentials!');
|
|
}
|
|
}
|
|
?>
|
|
|
|
|
|
<?php require('components/script.php') ?>
|
|
</body>
|
|
</html>
|