File: /home/imensosw/www/imenso.co/dev/mps-analytics/index.php
<?php
session_start();
// include('data.json');
if (isset($_POST['login']))
{
$json = file_get_contents("assets/data.json");
$data = json_decode($json);
foreach ($data as $datas)
{
$email = $datas->email;
$password = $datas->password;
if($_POST['email']==$email && $_POST['password']==$password && !empty($_POST['email']) && !empty($_POST['password']))
{
$_SESSION['login_user'] = $email;
header('location:dashboard.php');
}
elseif(empty($_POST['email']) && empty($_POST['password']))
{
$_SESSION['error'] = 'Please enter email and password';
header('location:index.php');
exit();
}
else
{
$_SESSION['error'] = 'Email or password is invailid';
header('location:index.php');
exit();
}
}
}
?>
<!doctype html>
<html lang="en-US" >
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/png" href="assets/images/favicon.png" />
<link rel="profile" href="http://gmpg.org/xfn/11">
<title>MPS Analytics</title>
<link rel="stylesheet" type="text/css" href="assets/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="assets/css/style.css">
<link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
</head>
<body>
<article class="inverse-body body_area">
<div class="login-box">
<div class="row">
<div class="col-12">
<div class="d-table">
<div class="left-part">
<img src="assets/images/mps-dark.png" width="200">
</div>
<div class="right-part">
<header class="text-center">
<h4>Login | MPS Analytics</h4>
</header>
<?php if(isset($_SESSION['success'])): ?>
<div class="alert alert-success">
<?php
// echo $_SESSION['success'];
?>
</div>
<?php elseif(isset($_SESSION['error'])): ?>
<div class="alert alert-danger">
<?php
echo $_SESSION['error'];
unset($_SESSION['error']);
?>
</div>
<?php endif ?>
<form class="mt-5" action="" method="post">
<div class="form-group">
<input type="email" class="form-control" id="" name="email" placeholder="Enter your email">
</div>
<div class="form-group">
<input type="password" class="form-control" id="" name="password" placeholder="Enter your Password">
</div>
<div class="form-group">
<button class="btn btn-primary" name="login" >SUBMIT</button>
<!-- <a href="assets/login_code.php" class="btn btn-primary" name="login" >SUBMIT</a> -->
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</article>
</body>
</html>