i used this code there is no errors but after logout when i was going back to the welcome page and click on back it was opening webpage again what i have to do?
it is my login code for three users it working successfully but when i add the session code it only redirect the login page instead of Index page. i am not getting that where is the error in login page or session page how to solve it please please someone help me
<?php
include("connectivity.php")
?>
<?php
if(isset($_POST['login']))
{$u=$_POST['Email'];
$p=$_POST['Password'];
$c=$_POST['usertype'];
$sql="select * from registration where Email='$u'";
$result = $connection->query($sql);
$row = $result->fetch_assoc();
$x=$row['Password'];
$y=$row['usertype'];
if(strcasecmp($x,$p)==0 && !empty($u) && !empty($p))
{//echo "Login Successful";
$_SESSION['Email']=$u;
if($y=='Admin'){
header('location:Admin Portal/AddBooks.php');
echo "Login Successful";
}
elseif($y=='Faculty'){
header('location:Without Login/Contactus1.php');
echo "Login Successful";
}
elseif($y=='Student'){
header('location:Student Portal/BorrowBooks1.php');
echo "Login Successful";
}
}
else
{ echo "<script type='text/javascript'>alert('Failed to Login! Incorrect Email or Password')</script>";
}
}
?>
this code i write for session:
<?php
include('../connectivity.php');
//check if the user is already loggedin
session_start();
if($_SESSION["Email"] != true) {
header('location:../Login.php');
exit();
}
?>
plz help me