File: /home/imensosw/www/imenso.co/dev/mps-analytics/assets/login_code.php
<?php
session_start();
if(isset($_POST['email']) && isset($_POST['password']) && !empty($_POST['email']) && !empty($_POST['password']))
{
// die('dfdsf');
$json = file_get_contents("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['success'] = 'Login Successfully';
header('location:index.php');
}
elseif(empty($_POST['email']) && empty($_POST['password']))
{
$_SESSION['error'] = 'Please enter email and password';
header('location:index.php');
}
else
{
$_SESSION['error'] = 'Email or password is invailid';
header('location:index.php');
}
}
}
?>