html - Is it safe to only redirect non logged users on php? -


i'm creating little website , i'm wondering since had lessons on http headers if it's safe use such logging algorithm :

if(! isset($_session["user"]) {    header("location : logout.php");    }    // , here start web page if conditin above not satisfied    <html> ........

i think it's not because redirection can ignored web client isn't ?

its better add 'else' statement prevent bugs trolling :)

if(!isset($_session["user"]) {      header("location : logout.php");     exit("you not authorized!");  } else { ?>    <html>...</html> <?php } ?> 

Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -