<?php
$cre = $_SESSION['username'];
$query = "SELECT * FROM student_info WHERE SHA1(st_id)='$cre'";
$subject_set = mysqli_query($connection,$query);
$row = mysqli_fetch_array($subject_set);

$user = $row['st_id'];
$surname = $row['surname'];
$first_name = $row['first_name'];

if(!isset($_SESSION['username']) || $_SESSION['username']!= SHA1($user))
{
    header('Location:logout.php');
}

?>