<?php

include_once __DIR__.'/dbconnect.php';

if($_SERVER['REQUEST_METHOD']=='POST'){

if(isset($_POST['submit-btn']) and !empty($_POST['submit-btn'])){

$email =isset($_POST['email'])?$_POST['email']:NULL;

$password =isset($_POST['password'])?$_POST['password']:NULL;

if(is_null('$email') or empty('$email')){

header("location:{$_REQUEST['/']}?msg=email=blank-email");

exit;

}

$pass =isset($_POST['password'])?$_POST['password']:NULL;

if(is_null('$pass') or empty('$pass')){

header("location:{$_REQUEST['/']}?msg=email=blank-email");

exit;

}

$sql = "select name,email,password from vritant_tbl where email ='{$email}' and password='{$password}'";

$result = mysqli_query($conn,$sql);


if($result){

$count= mysqli_num_rows($result);

if($count>0){

$row = mysqli_fetch_assoc($result);


$name= $row['name'];


session_start();

$_SESSION['name']=$name;


header("location:dashbord.php");

}


}else{

echo "email or id not matched";

}

}else{

header("location:{$_REQUEST['/']}");

}

}else{

header("location:login.php");

}

?>



Login Code In PHP