Here's my sample code for preventing user from entering the page using direct URL
<?php
ob_start();
include("../include/userlogin.php");
include('../include/database.php');
if(!isset($_SESSION))
{
session_start();
}
if($_SESSION['usertype'] != "admin"){
$_SESSION['message'] = "You cannot access only admin is allowed!";
header("location: login.php?success=1");
}
ob_end_flush()
?>
How to achieve this after the user successfully logged in, how can I prevent that user from going back to login page by clicking the back button in google chrome?