Quick question, can I restrict HTML pages from non-logged in users? As of now, at the start of each HTML script I have PHP code checking whether the $_SESSION['LoggedIn'] variable is true. If not, the HTML code is not loaded. Is this safe? Is there a better way to do this?
Thanks!
This code is in reference to the question, whether it is safe or not.
<body>
<div id = "homePage" align = center>
<?php
session_start ();
if ($_SESSION["LoggedIn"] != "true") {
echo '<h1>Restricted Access</h1>';
die();
}
?>
<h1> Home Page </h1><br>
<form action = "https://www.google.com">
<input id = "button" type = "submit" value= "Ban Panel">
</form>
<form action = "https://www.google.com">
<input id = "button" type = "submit" value= "User Info">
</form>
<form action = "https://www.google.com">
<input id = "button" type = "submit" value= "Gift User">
</form>
</div>