File: /var/www/nclive/technc/login.php
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="icon" type="image/png" href="/images/favicon.ico">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<style type="text/css">
body{
background: #441f7c;
}
.login-form {
width: 340px;
margin: 50px auto;
}
.login-form form {
margin-bottom: 15px;
background: #f7f7f7;
box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
padding: 30px;
}
.login-form h2 {
margin: 0 0 15px;
}
.form-control, .btn {
min-height: 38px;
border-radius: 2px;
}
.btn {
font-size: 15px;
font-weight: bold;
background: #441f7c;
border: #441f7c;
}
.logo{
width: 146px;
margin-left: 96px;
padding: 7px;
}
</style>
</head>
<body>
<div class="login-form">
<img class="logo" class="logo_image" alt="logo_white" src="/images/naukriconnect-logo.png">
<form action="" method="post">
<h2 class="text-center">Log in</h2>
<div class="form-group">
<input type="text" class="form-control" placeholder="Username" name="user_name" required="required">
</div>
<div class="form-group">
<input type="password" class="form-control" placeholder="Password" name="password" required="required">
</div>
<div class="form-group">
<button type="submit"name="submit" class="btn btn-primary btn-block">Log in</button>
</div>
<div class="clearfix">
<!-- <label class="pull-left checkbox-inline"><input type="checkbox"> Remember me</label>-->
<a href="#" class="pull-right">Forgot Password?</a>
</div>
</form>
<!--<p class="text-center"><a href="#">Create an Account</a></p>-->
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
include_once('config.php');
if(isset($_REQUEST['submit']))
{
$user_name = $_REQUEST['user_name'];
$password = $_REQUEST['password'];
$curDate=date('Y-m-d H:i:s');
$loginQuery = "select id, username, password, type, status, expiry_date from `sp_admin_login` where username='$user_name' and password='$password' and status='1'";
$sql=$db->prepare($loginQuery);
$sql->execute();
$loginData = $sql->fetch();
// print_r($loginData);
$login = $loginData['id'];
$user =$loginData['id'];
$type =$loginData['type'];
if($login != 0){
if($loginData['expiry_date'] >= $curDate){
session_start();
$session_id =uniqid();
$_SESSION['uname']=$user_name;
$_SESSION['password']=$password;
$_SESSION['user_id']=$user;
$_SESSION['session_id']=$session_id;
$_SESSION['type']=$type;
/* ------------------Session Tracker------------------------*/
include_once('admin-tracker.php');
/* ------------------Session Tracker------------------------*/
header("location:/technc/");
}
else {
echo '<font style="color:red">Password expires, please contact to admin</font>';
}
}
else {
echo '<font style="color:red">Please enter correct username and password</font>';
}
}
?>
</div>
</body>
</html>