php - admin page of website only to be accessed by admin if someone tries to access it , it redirects to login-page -
this code have written
if(!isset($_session['authenticated'])){header("location:login.php");} but code not working , being accessed
could set variable true or false?
if ($_session['authenticated']) { // admin page here... } else { // redirect page... header("location: login.php"); die(); } edit:
the reason set true or false ca log user out setting false. rather unsetting variable.
edit:
- removed
= truenot required.
you missed capital l in header function , need kill page once have redirected.
replace
header('location:index.php'); with
header("location: login.php"); die();
Comments
Post a Comment