34
<?php include('../Class/config.php'); ?>
<?php
if(isset($_POST['login']))
{
if($_SESSION['code'] == $_POST['code'] )
{
if(!empty($_POST['token'] == $_SESSION['token']))
{
if( !empty($_POST['email']) && !empty($_POST['pass']) )
{
$Uni->where ( 'email', $_POST['email']);
$Uni->where ( 'pass', $_POST['pass']);
$data = $Uni->getOne('admin');
if ($Uni->count == 1)
{
$_SESSION['ADMIN_ID'] = $data['id'];
$_SESSION['ADMIN_NAME'] = $data['admin_name'];
header('Location: '.BASE_URL.'admin/Dashboard/index.php');
exit();
}
else
{
$msg_danger = 'invalid login credentials';
}
}
else
{
$msg_danger = 'Please fill all details';
}
}
else
{
$msg_danger = 'Page Expire';
}
}
else
{
$msg_danger = 'invalid Captcha !';
}
}
?>
<!doctype html>
<html lang="en">
<head>
<?php include('../layout/admin_header.php'); ?>
</head>
<body class="bg-light bg-gradient">
<section>
<div class="container">
<div class="row d-flex vh-100">
<div class="col-sm-6 mx-auto m-5 shadow rounded-3 p-5 align-self-center bg-white bg-gradient">
<?php include('../Class/error.php'); ?>
<div class="text-center">
<i class="bi bi-person-fill-gear fs-1 text-danger"></i>
</div>
<h4 class="text-center my-2">Admin Login ( <b> Super Admin </b> )</h4>
<form action="" method="post" class="row">
<input type="hidden" name="token" value="<?php echo $Uni->token(); ?>">
<div class="col-12 mb-3">
<input type="email" name="email" class="form-control" placeholder="Enter E-mail" value="admin@gmail.com">
</div>
<div class="col-12 mb-3">
<input type="password" name="pass" class="form-control" placeholder="Enter Password" value="pass">
</div>
<div class="col-sm-3 form-group mb-3 align-self-center text-start">
<img src="<?= BASE_URL;?>Class/captcha.php" class="img-fluid rounded" id="captcha">
</div>
<div class="col-sm-3 form-group mb-3 align-self-center text-start">
<a href="javascript:void(0);" class="btn btn-outline-success btn-sm" id="reload"> <i class="bi bi-arrow-clockwise"></i> </a>
</div>
<div class="col-sm-6 form-group mb-3 align-self-center">
<input type="text" name="code" class="form-control w-100" placeholder="Enter Chaptcha Code" required autocomplete="off" />
</div>
<div class="col-6 md-2 align-self-center">
<a class="btn btn-outline-dark btn-sm w-100" href="<?=BASE_URL;?>">
<i class="bi bi-arrow-right"></i> Home
</a>
</div>
<div class="col-6 md-2 text-end align-self-center">
<button type="submit" class="btn btn-success btn-sm w-100" name="login">Login</button>
</div>
</form>
</div>
</div>
</div>
</section>
</body>
</html>
<?php include('../layout/admin_footer_js.php'); ?>