
<?php
session_start();
include_once __DIR__ .'/Plutio/database.php';
$database = new Database();
$mysqli = $database->getConnection();
if(isset($_SESSION['user']))
{
 
  header("Location:dashboard.php");
 
}

include('layout.php');
if(isset($_POST['submit']))
{
    extract($_POST);
    $query="SELECT * FROM user where email='".$email."'";
    $result = $mysqli->query($query);
   if($result->num_rows>0)
   {
    $row = $result->fetch_object();
    $pass= $row->password;
    if($pass==$password)
    {
      $_SESSION['user']=$row->email;
     
       header("Location:dashboard.php");
    }
    else
    {
       
    }
  
   }
   else
   {
    echo "<script>alert('email not correct')</script>";
   }

}
?>
<link rel="stylesheet" href="asset/css/style.css">
  <form class="modal-content animatel" action="" method="post">
    <div class="imgcontainer">
     <h1>Login</h1>
    </div>

    <div class="container">
      test
      <label for="uname"><b>Username</b></label>
      <input type="text" placeholder="Enter Email" name="email" required>

      <label for="psw"><b>Password</b></label>
      <input type="password" placeholder="Enter Password" name="password" required>

      <button type="submit" name="submit">Login</button>
    </div>
  </form>

