I am trying to add more security to my user authentication sessions. When the user login I regenerate_session_id
but I would like your answer on if I regenerate_session_id
on every page that I authenticate the user will help me out.
authenticate user on each page
<?php
session_start();
if(!isset($_SESSION['MEMBER_ID']) || (trim($_SESSION['MEMBER_ID']) == '')) {
header("location: denied.php");
exit();
}
?>
I changed this to
session_start();
if(!isset($_SESSION['SESS_MEMBER_ID']) || (trim($_SESSION['SESS_MEMBER_ID']) == '')) {
header("location: access-denied.php");
exit();
} else {
session_regenerate_id(); }