受限制的HTML页面(使用PHP)(安全吗?)

时间:2018-05-22 19:34:05

标签: php html

快速提问,我可以限制未登录用户的HTML网页吗?截至目前,在每个HTML脚本的开头,我都有PHP代码检查$ _SESSION ['LoggedIn']变量是否为true。如果没有,则不加载HTML代码。这样安全吗?有更好的方法吗?

谢谢!

此代码是指问题,无论是否安全。

<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>

0 个答案:

没有答案