File: /home/nyiet8349bzl/Backup/sbc_back/homedir/public_html/bsadmin-portal/index.php
<?php
include("../config/connection.php");
$connection = new createCon();
$connection->connect();
if(@$_SESSION['admin']['user_id']!='')
{
echo "<script>window.location.href='dashboard.php'</script>";
}
$erroMSG = "";
if(isset($_REQUEST['Sign_in']))
{
$mail_id = $_POST['Email'];
$password = mysqli_real_escape_string($connection->myconn, $_REQUEST['Password']);
$mdpassword = md5($password);
//echo $mdpassword;
$query = mysqli_query($connection->myconn, "SELECT * FROM user WHERE user_name = '".$mail_id."' and user_password = '".$mdpassword."' and role_id = '1' ");
if(mysqli_num_rows($query)>0)
{
$result = mysqli_fetch_array($query);
$usersession = array();
$usersession['user_id'] = $result['id'];
$usersession['user_name'] = $result['user_name'];
$_SESSION['admin'] = $usersession;
echo "<script>window.location='dashboard.php'</script>";
}else
{
$erroMSG = "Invalid email id or password";
}
}
?>
<!doctype html>
<html class="fixed">
<head>
<title>Login :: SBSC Admin</title>
<?php include("inc-head.php");?>
</head>
<body>
<!-- start: page -->
<section class="body-sign">
<div class="center-sign">
<a href="#" class="logo pull-left">
<img src="assets/images/logo.png" height="60" alt="SBSC" />
</a>
<div class="panel panel-sign">
<div class="panel-title-sign mt-xl text-right">
<h2 class="title text-uppercase text-weight-bold m-none"><i class="fa fa-user mr-xs"></i> Sign In</h2>
</div>
<div class="panel-body">
<div id="errorClass" style="background-color: #FFEBE8; color:#FF0000;font-size:14px; text-align:center;line-height:30px"><?php if($erroMSG!=''){ echo $erroMSG; } ?></div>
<form name="acdlogin" action="" method="POST" onsubmit="return valid_login();">
<div class="form-group mb-lg">
<label>User Name</label>
<div class="input-group input-group-icon">
<input type="text" name="Email" placeholder="User Name" maxlength="45" class="form-control input-lg"/>
<span class="input-group-addon">
<span class="icon icon-lg">
<i class="fa fa-user"></i>
</span>
</span>
</div>
</div>
<div class="form-group mb-lg">
<div class="clearfix">
<label class="pull-left">Password</label>
</div>
<div class="input-group input-group-icon">
<input type="password" name="Password" placeholder="User Password" maxlength="15" class="form-control input-lg"/>
<span class="input-group-addon">
<span class="icon icon-lg">
<i class="fa fa-lock"></i>
</span>
</span>
</div>
</div>
<div class="row">
<div class="col-sm-8"></div>
<div class="col-sm-4 text-right">
<input type="submit" class="btn btn-primary" name="Sign_in" value="Sign in"/>
</div>
</div>
</form>
</div>
</div>
<p class="text-center text-muted mt-md mb-md">Copyright © 2018, <a href="http://www.bagwarsoftwares.com/" target="_blank">Bagwar Softwares Pvt. Ltd.</a> All Rights Reserved.</p>
</div>
</section>
<!-- end: page -->
<?php include("inc-footer.php");?>
<script>
function valid_login()
{
if(document.acdlogin.Email.value == '')
{
$("#errorClass").html("Please enter user name");
document.acdlogin.Email.focus();
return false;
}
if(document.acdlogin.inputPassword.value == '')
{
$("#errorClass").html("Please enter password");
document.acdlogin.inputPassword.focus();
return false;
}
}
</script>
</body>
</html>