File: /var/www/grapossconnect/center-admin/index.php
<?php
include '../sample-wp/wp-config.php';
session_start();
//echo crypt('123456', 'GraposConct');
/* --------- check if agent is logged in ---------- */
if (isset($_SESSION["AGENT_ID"])) {
header('Location:home');
}
/* --------- end if agent is logged in ---------- */
$GRP_AGENTS_TABLE = 'grp_agents';
if (isset($_POST["submit"])) {
$msg = "";
$usrname = $_POST["usrname"];
$passwd = $_POST["passwd"];
$chkPass = md5($passwd);
if ($usrname == '' || $passwd == '') {
$msg = "Enter username/password to login";
} else {
$getAgentData = $wpdb->get_row("select agent_id, agent_code, password, active from $GRP_AGENTS_TABLE where agent_code='$usrname' and password='$chkPass'");
if ($getAgentData->agent_id == '') {
$msg = "Invalid username/password";
} else if ($getAgentData->active != 'A') {
$msg = "Your accout is not active, please contact to admin";
} else {
$_SESSION["AGENT_ID"] = $getAgentData->agent_id;
$_SESSION["AGENT_CODE"] = $getAgentData->agent_code;
if (isset($_REQUEST['redirect_to']) != '') {
$redirect = $_REQUEST['redirect_to'];
} else {
$redirect = 'home';
}
header('Location:' . $redirect);
}
}
}
?>
<!DOCTYPE html>
<html>
<head>
<!-- Title -->
<title>Graposs Connect | Center Login</title>
<meta content="width=device-width, initial-scale=1" name="viewport" />
<meta charset="UTF-8">
<meta name="description" content="Login" />
<meta name="keywords" content="Login" />
<meta name="author" content="Graposs Connect" />
<link href="assets/images/favicon.png" rel="shortcut icon" type="image/png">
<!-- Styles -->
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,600' rel='stylesheet' type='text/css'>
<link href="assets/assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="assets/assets/plugins/fontawesome/css/font-awesome.css" rel="stylesheet" type="text/css" />
<!-- Theme Styles -->
<link href="assets/css/modern.min.css" rel="stylesheet" type="text/css" />
<link href="assets/css/custom.css" rel="stylesheet" type="text/css" />
</head>
<style>
.welcome-logo-box {
margin-bottom: 90px;
}
.welcome-logo-box img.gp-logo {
width: 100%;
}
section.login-form-section {
padding: 6em 5em !important;
}
h4.welcom-txt{
text-align: center !important;
}
</style>
<body class="page-login">
<section class="login-form-section">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="form-box row">
<div class="col-md-5 no-padding">
<section class="left-side-section">
<div class="left-side-bg"></div>
<div class="welcome-div-box">
<div class="welcome-logo-box">
<img class="gp-logo" src="assets/images/graposs-logo.png" alt="">
<h4 class="welcom-txt">Welcome to Graposs Connect Center Admin</h4>
</div>
</div>
</section>
</div>
<div class="col-md-7 no-padding">
<div class="section-heading">
<p class="card-text">
<small><a style="color: #fff;" href="#">Login To Center Admin </a> </small>
</p>
</div>
<div class="login-form">
<h4 class="login-form-txt">Login</h4>
<?php if ($msg != '') { ?>
<div class="alert alert-danger" role="alert">
<?php echo $msg; ?>
</div>
<?php } ?>
<form action="#" method="post">
<label for="usrname">Username</label>
<input type="text" id="usrname" name="usrname" placeholder="Your Username..">
<label for="passwd">Password</label>
<input type="password" id="passwd" name="passwd" placeholder="Your password..">
<input type="submit" name="submit" value="LOGIN">
<div class="social-div">
<p class="login-with-p">connect with</p>
<ul class="social-ul">
<li><a href="https://www.facebook.com/grapconnect" target="_blank"><i class="fa fa-facebook"></i></a></li>
<li><a href="https://twitter.com/GrapossConnect" target="_blank"><i class="fa fa-twitter"></i></a></li>
</ul>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</body>
</html>