
PK 
<?php
ob_start();
//error_reporting(E_ALL ^ E_NOTICE);
@session_start();
ini_set('allow_url_include',1);
date_default_timezone_set("Asia/Kolkata");
set_time_limit(600);
ini_set('max_execution_time',600);
include 'includes/settings/constant.php';
//include '../includes/settings/db.php';
require_once 'includes/settings/PDODB.php';
include 'includes/modules/functions.php';
$function = new FUNCTIONS();
if(!empty($_SESSION['adminId'])){
header("Location: dashboard/index.php");
exit();
}
if(isset($_POST['btnLogin'])){
$username = $_POST['username'];
$password = $_POST['password'];
//print_r($password); exit;
if(!empty($username) && !empty($password)){
$password = md5($password);
$loginQuery = "SELECT * FROM `admin` WHERE (email='$username' OR username='$username') AND password='$password' AND isactive='1'";
//exit;
$pdodb = PDODB::getInstance();
$result = $pdodb->query($loginQuery);
//print_r($loginQuery); exit;
PDODB::closeInstance();
if(!empty(count($result))){
$_SESSION['adminId'] = $result[0]['id'];
$_SESSION['admin_role_id'] = $result[0]['admin_role_id'];
header("Location: dashboard/index.php");
}else{
//Alert
$error_msg = "Kindly check your login credentials.";
//echo "<script>tossterMsgAlert('".$error_msg."','Error');</script>";
}
}else{
//Alert
$error_msg = "Kindly enter your Username & Password.";
//echo "<script>tossterMsgAlert('".$error_msg."','Error');</script>";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Coforge Techcon | Login</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="font-awesome/css/font-awesome.css" rel="stylesheet">
<link href="css/animate.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
</head>
<body class="gray-bg">
<div class="middle-box text-center loginscreen animated fadeInDown" style="padding: 10px 10px; background-color: #082340; margin-top: 50px;">
<div>
<div>
<h1 class="logo-name"><img src="img/logo.png" width="80%;"></h1>
</div>
<h3>Admin Panel</h3>
<p>Login in. To see it in action.</p>
<form class="m-t" role="form" action="" method="POST">
<div class="form-group">
<input type="text" class="form-control" name="username" placeholder="Username & Email" required="">
</div>
<div class="form-group">
<input type="password" class="form-control" name="password" placeholder="Password" required="">
</div>
<button type="submit" name="btnLogin" class="btn btn-danger block full-width m-b">Login</button>
<p style="color:red; text-align: center;"><?=(!empty($error_msg))?$error_msg:'';?></p>
</form>
</div>
</div>
<!-- Mainly scripts -->
<script src="js/jquery-2.1.1.js"></script>
<script src="js/bootstrap.min.js"></script>
<script>
function tossterMsgAlert(msg='Welcome',title='') {
toastr.options = {
closeButton: true,
//debug: false,
newestOnTop: false,
//progressBar: false,
positionClass: 'toast-top-center',
preventDuplicates: true,
//onclick: null,
//showDuration: 300,
//hideDuration: 1000,
timeOut: 2000,
//extendedTimeOut: 1000,
//showEasing: 'swing',
//hideEasing: 'linear',
//showMethod: 'fadeIn',
hideMethod: 'fadeOut'
};
toastr.warning(title,msg);
}
</script>
</body>
</html>


PK 99