<?php
session_start();
if(isset($_SESSION['username'])){
header('location:dashboard/index.php');
}
include_once('dbcon.php');
$error = false;
if(isset($_POST['btn-login'])){
$email = trim($_POST['email']);
$email = htmlspecialchars(strip_tags($email));
$password = trim($_POST['password']);
$password = htmlspecialchars(strip_tags($password));
if(empty($email)){
$error = true;
$errorEmail = 'অনুগ্রহ করে ইমেইল লিখুন';
}elseif(!filter_var($email, FILTER_VALIDATE_EMAIL)){
$error = true;
$errorEmail = 'অনুগ্রহ করে সঠিক ইমেইল লিখুন';
}
if(empty($password)){
$error = true;
$errorPassword = 'অনুগ্রহ করে পাসওয়ার্ড লিখুন';
}elseif(strlen($password)< 6){
$error = true;
$errorPassword = 'পাসওয়ার্ড কমপক্ষে ৬ ডিজিট দিতে হবে....';
}
if(!$error){
$password = md5($password);
$sql = "select * from admin_users where email='$email' ";
$result = mysqli_query($link, $sql);
$count = mysqli_num_rows($result);
$row = mysqli_fetch_assoc($result);
if($count==1 && $row['password'] == $password){
$_SESSION['username'] = $row['username'];
header('location:dashboard/index.php');
}else{
$errorMsg = 'ব্যবহারকারীর আইডি ও পাসওয়ার্ড মিলে নাই' ;
}
}
}
?>
<html>
<head>
<title>লগ-ইন || .:::Login System:::.</title>
<link rel="icon" href="dashboard/favicon.ico">
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="dashboard/assets/css/bootstrap.min.css">
<link rel="stylesheet" href="dashboard/assets/css/animate.css">
<style>
.login-box{
margin-top:60px;
}
.login-box-body{
background:#fff;
padding:20px;
border-top:0;
color:#666;
-moz-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
-webkit-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
}
.navbar-default{
border-color: transparent;
}
.navbar{
margin-bottom: 0;
}
.active{
font-size: 20px;
font-weight: bold;
}
.navbar-default{
font-size: 20px;
}
#navheader{
background-image: -webkit-linear-gradient(top left, #CC2A63, #9900ff);
background-image: linear-gradient(to bottom right, #CC2A63, #9900ff);
box-shadow: 0px 0px 10px #000000;
}
.udc-footer{
text-align: center;
padding: 20px;
color: white;
margin: 0px;
margin-top: 60px;
box-shadow: 0px 0px 10px #000000;
background-image: -webkit-linear-gradient(top left, #0066CC, #9900FF);
background-image: linear-gradient(to bottom right, #0066CC, #9900FF) ;
}
</style>
</head>
<body>
<nav class="navbar navbar-default topnav navbar-static-top" id="navheader">
<ul class="nav navbar-nav navbar-right" style="margin: 10px">
<li><a href="index.php" class="animated bounceIn" style="font-size: 58px;line-height: 66px;font-weight: 900;font-style: normal;text-shadow: 1px 1px 1px #000000;color: #FFFFFF">পাঁচগাছী ইউনিয়ন ডিজিটাল সেন্টার </a></li>
<li><a href="login.php" class="active" style="line-height: 51px;font-size: 23px;font-weight: 900;">লগ-ইন</a></li>
<li><a href="register.php" style="font-size: 28px;line-height: 29px;"><span class="logo-mini" style="font-size: 18px;line-height: 2.8;">সাইন-আপ</span></a></li>
</ul>
</nav>
<div class="container content-wrapper" style="min-height:400px; padding-bottom:auto;background-color: #fff">
<div class="login-box">
<div class="row">
<div class="col-md-4 col-md-offset-4 ">
<div class="animated bounceIn">
<div class="login-box-body">
<form method="post" action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>" autocomplete="off">
<center><h2 class="display-6" id="loginform">লগ-ইন</h2></center>
<?php if(isset($errorMsg)){ ?>
<div class="alert alert-danger">
<span class="glyphicon glyphicon-info-sign"></span>
<?php echo $errorMsg; ?>
</div>
<?php } ?>
<div class="form-item">
<label for="email" class="control-label">ব্যবহারকারীর আইডি</label>
<input type="email" placeholder="ব্যবহারকারীর আইডি" autofocus="autofocus" class="form-control valid" name="email" autocomplete="off">
<span class="text-danger"><?php if(isset($errorEmail)) echo $errorEmail; ?></span>
</div>
<div class="form-item">
<label for="password" class="control-label">পাসওয়ার্ড</label>
<input type="password" name="password" placeholder="পাসওয়ার্ড" class="form-control valid" autocomplete="off">
<span class="text-danger"><?php if(isset($errorPassword)) echo $errorPassword; ?></span>
</div>
<div class="form-group">
<br>
<input type="submit" name="btn-login" value="লগ-ইন" class="btn btn-info btn-flat btn-block">
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<footer class="udc-footer">
<div class="animated bounceIn">Copyright © 2018 - <?= date('Y')?>. All Rights Reserved || Developed and Maintained by <b><a href='https://jahidcsekurigram.blogspot.com/' rel='dofollow' style='color:yellow;' target='_self'>.:::Jahid CSE:::.</a></b> || IT Supported By <b><a href='https://jahiddigitalmultimedia.blogspot.com/' rel='dofollow' style='color:yellow;' target='_self'>:::Jahid Digital Multimedia:::.</a>
</div>
</footer>
</body>
</html>