File: /var/www/content-sp/work-sp/login.php
<?php
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(E_ALL);
include_once('config.php');
session_start();
if(!empty($_SESSION['editor'])){
header('Location:' . '/work-sp/dashboard');
} else {
if(isset($_POST['submit']))
{
$login = $_REQUEST['user_name'];
$password = md5($_REQUEST['password']);
$checkUser = "SELECT editor_id,display_name,editor_role FROM csp_editors where editor_login='$login' and editor_password='$password' and editor_status='1'";
$result = $conn->query($checkUser);
$row = $result->fetch_assoc();
$editor_id = $row['editor_id'];
$display_name = $row['display_name'];
$editor_role = $row['editor_role'];
if($editor_id == ''){
$error= '<div class="alert alert-danger alert-dismissible" role="alert">): Wrong username or password<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button></div>';
} else {
if($editor_id != ''){
$editorArray = array();
$editorArray['eId'] = $editor_id;
$editorArray['e_name'] = $display_name;
$editorArray['e_role'] = $editor_role;
//session_start();
$_SESSION['editor'] = json_encode($editorArray);
header('Location:' . '/work-sp/dashboard');
}
}
}
?>
<!DOCTYPE html>
<html>
<head>
<!-- Title -->
<title>Editors Admin | GEPL</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="GEPL" />
<META NAME="robots" CONTENT="noindex,nofollow">
<link rel="icon" href="assets/images/favicon.png" type="image/x-icon">
<!-- 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>
<script>
localStorage.removeItem("liid");
</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/graposs-logo.png" class="img-responsive" alt=""></a>
<p class="text-center m-t-md"><?php if(isset($error)) echo $error; ?></p>
<form class="m-t-md" method="post" action="">
<div class="form-group">
<input type="text" name="user_name" class="form-control" placeholder="Username Or Email" 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>
<?php } ?>