BBnepal-Accounts/hostel/application/views/hms-admin/login.php
Sampanna Rimal 9cd05ef3cb commitall
2024-07-10 18:28:19 +05:45

158 lines
5.2 KiB
PHP

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hostel Management | Admin Login</title>
<link rel="icon" type="image/x-icon" href="<?php echo base_url(); ?>assets-hms/fav.png">
<!--styles links-->
<link rel="stylesheet" href="<?php echo base_url(); ?>assets-hms/css/bootstrap.min.css">
<link rel="stylesheet" href="<?php echo base_url(); ?>assets-hms/css/font-family.css">
<link rel="stylesheet" href="<?php echo base_url(); ?>assets-hms/css/all.css">
<link rel="stylesheet" href="<?php echo base_url(); ?>assets-hms/css/style.css">
<link rel="stylesheet" href="<?php echo base_url(); ?>assets-hms/css/responsive.css">
</head>
<body>
<div class="containers">
<div class="main-logo">
<img src="<?php echo base_url(); ?>assets-hms/<?php echo $school_info['color_logo']; ?>">
</div>
<?php
$uname = ''; $pass = ''; $rme = 'Off';
if(isset($_COOKIE["username"]))
$uname = $_COOKIE["username"];
if(isset($_COOKIE["password"]))
$pass = $_COOKIE["password"];
if(isset($_COOKIE["rem_me"]))
$rme = $_COOKIE["rem_me"];
$checked = isset($_COOKIE["rem_me"]) ? 'checked' : '';
if(count($_POST) > 0)
{
$uname = $_POST['email'];
$pass = $_POST['password'];
if(isset($_POST['remember_me']))
$rme = 'On';
}
?>
<div class="containers">
<form action='<?php echo base_url().'admin';?>' id="loginform" method="post">
<div class="row login-row">
<div class="col-md-7 col-lg-7 login-bg">
<img src="<?php echo base_url(); ?>assets-hms/images/login/login-bg.svg" class="lg-img" alt="">
</div>
<div class="col-md-4 col-lg-4 login-right">
<div class="login-box">
<div class="login-fields">
<h3>Hostel Admin Login</h3>
<?php if($this->session->flashdata('danger')){?>
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<p><?php echo $this->session->flashdata('danger') ?></p>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<?php } ?>
<input name="email" id="email" value='<?php echo $uname;?>' placeholder="Enter Your Email ID" class="form-control login-input" >
<p class="error-message" id='email_error'></p>
<div class="error-message"><?php echo form_error('email'); ?></div>
<div class="login-eye-pos">
<input type="password" name="password" id="paswd" value='<?php echo $pass;?>' placeholder="Password" class="form-control login-input">
<span class="login-eye login-eye-icon"><i class="far fa-eye"></i></span>
<p class="error-message" id='paswd_error'></p>
<div class="error-message"><?php echo form_error('password'); ?></div>
<div>
<a href="<?php echo base_url().'forgot-password'; ?>">Forgot Password?</a><br>
<input type="checkbox" <?= $checked ?> id="remember" name="remember_me" value="on">
<label class="remember" for="remember"> Remember me</label><br><br>
<div class="login-button">
<button class="login-btn" type='button' onclick="validate_login_form()">Login</button>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
<script src="<?php echo base_url(); ?>assets-hms/js/jquery-3.4.1.min.js"></script>
<script src="<?php echo base_url(); ?>assets-hms/js/popper.min.js"></script>
<script src="<?php echo base_url(); ?>assets-hms/js/bootstrap.min.js"></script>
<script defer src="<?php echo base_url(); ?>assets-hms/js/all.js"></script>
<script type="text/javascript">
$(".login-eye").click(function() {
$(".login-eye").toggleClass("login-eye-icon");
var input = $('#paswd');
if (input.attr("type") == "password")
input.attr("type", "text");
else
input.attr("type", "password");
});
$(document).ready(function(){
$(document).on('keypress', function(e){
if(e.which==13)
{
//if(js_status != 'Not Verified')
validate_login_form();
}
});
});
function hide_all_login_errors()
{
$('#email_error').hide();
$('#paswd_error').hide();
}
function validate_login_form()
{
hide_all_login_errors();
var errArr = new Array();
var lemail = $('#email').val().trim();
var regex = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if(lemail==''){
errArr.push('email_Sep@Str_Please enter your email address.');
}else if(!regex.test(lemail)){
errArr.push('email_Sep@Str_Please enter a valid email address.');
}
var lpwd = $('#paswd').val().trim();
if(lpwd==''){
errArr.push('paswd_Sep@Str_Please enter your password.');
}
if(errArr.length>0)
{
for(i=0; i<errArr.length; i++)
{
var resArr = errArr[i].split("_Sep@Str_");
$("#"+resArr[0]+"_error").html(resArr[1]);;
$("#"+resArr[0]+"_error").show();
}
var xxxVal = errArr[0].split('_Sep@Str_');
$('#'+xxxVal[0]).focus();
return false;
}
else{
$('#loginform').submit();
}
}
</script>
</body>
</html>