File: //var/www/santabrigade/santab-admin/index.php
<?php
include_once('../wp-config.php');
global $wpdb;
session_start();
//error_reporting(E_ALL);
//ini_set('display_errors', 'ON');
$redirect_to=get_site_url().'/santab-admin/dashboard';
//$PSY_COUNSELORS = $wpdb->prefix . PSY_COUNSELORS;
////9891531192 / 300a917c
unset($_SESSION["errMsg"]);
if(isset($_POST['submit']))
{
unset($_SESSION["errMsg"]);
$login=filter_var($_REQUEST['user_name'], FILTER_SANITIZE_STRING);
$password=$_REQUEST['password'];
$checkExist = $wpdb->get_row("select admin_id, name, username, status from `wp_sb_admin_users` where username='$login' and password='$password' limit 1");
if($login=='' || $password==''){
$_SESSION["errMsg"] = "Username/Password can not empty";
} else if($checkExist->username==''){
$_SESSION["errMsg"] = "Wrong username or password";
} else if($checkExist->status!='1'){
$_SESSION["errMsg"] = "Your account is not active please contact Admin";
} else {
$_SESSION['ADMN-ID'] = $checkExist->admin_id;
$_SESSION['ADMN-UNAME'] = $checkExist->username;
wp_redirect($redirect_to);
//exit();
}
}
if(isset($_SESSION['ADMN-ID'])){
$checkUser = $wpdb->get_var("select count(*) from `wp_sb_admin_users` where admin_id='".$_SESSION['ADMN-ID']."' and status='1'");
if($checkUser!=''){
wp_redirect($redirect_to);
exit();
} else {
wp_redirect(get_site_url());
exit();
}
}
//echo $adminId = $_SESSION['ADMN-ID'];
?>
<!DOCTYPE html>
<html>
<head>
<!-- Title -->
<title>Santa Brigade | Admin Login</title>
<meta content="width=device-width, initial-scale=1" name="viewport"/>
<meta charset="UTF-8">
<meta name="description" content="Admin Dashboard Template" />
<meta name="keywords" content="admin,dashboard" />
<meta name="author" content="Santas" />
<link rel="icon" type="image/png" sizes="32x32" href="/wp-content/themes/santabrigade/images/favicon-32x32.png">
<!-- Styles -->
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,600' rel='stylesheet' type='text/css'>
<link href="assets/plugins/pace-master/themes/blue/pace-theme-flash.css" rel="stylesheet"/>
<link href="assets/plugins/uniform/css/uniform.default.min.css" rel="stylesheet"/>
<link href="assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<link href="assets/plugins/fontawesome/css/font-awesome.css" rel="stylesheet" type="text/css"/>
<link href="assets/plugins/line-icons/simple-line-icons.css" rel="stylesheet" type="text/css"/>
<link href="assets/plugins/offcanvasmenueffects/css/menu_cornerbox.css" rel="stylesheet" type="text/css"/>
<link href="assets/plugins/waves/waves.min.css" rel="stylesheet" type="text/css"/>
<link href="assets/plugins/switchery/switchery.min.css" rel="stylesheet" type="text/css"/>
<link href="assets/plugins/3d-bold-navigation/css/style.css" rel="stylesheet" type="text/css"/>
<!-- Theme Styles -->
<link href="assets/css/modern.min.css" rel="stylesheet" type="text/css"/>
<link href="assets/css/themes/white.css" class="theme-color" rel="stylesheet" type="text/css"/>
<link href="assets/css/custom.css" rel="stylesheet" type="text/css"/>
<script src="assets/plugins/3d-bold-navigation/js/modernizr.js"></script>
<script src="assets/plugins/offcanvasmenueffects/js/snap.svg-min.js"></script>
</head>
<body class="page-login">
<main class="page-content">
<div class="page-inner">
<div id="main-wrapper">
<div class="row">
<div class="col-md-3 center">
<div class="login-box">
<a href="#" class="logo-name text-lg text-center">
<!--<img src="assets/images/college_nxt_now_logo.png" class="img-responsive" alt="" style="margin: 0 auto;">-->
Santa Brigade Admin Login
</a>
<p class="text-center m-t-md"><?php if(isset($_SESSION["errMsg"])) echo $_SESSION["errMsg"]; ?></p>
<form class="m-t-md" method="post" action="">
<div class="form-group">
<input type="text" name="user_name" class="form-control" placeholder="Username" required>
</div>
<div class="form-group">
<input type="password" name="password" class="form-control" placeholder="Password" required>
</div>
<button type="submit" name="submit" class="btn btn-success btn-block">Login</button>
</form>
</div>
</div>
</div><!-- Row -->
</div><!-- Main Wrapper -->
</div><!-- Page Inner -->
</main><!-- Page Content -->
</body>
</html>