我有一个受登录保护的 php 页面,我已将下面的代码放在我所有的 php 页面上
<?PHP
session_start();
session_destroy();
if (!(isset($_SESSION['login']) && $_SESSION['login'] != '')) {
header ("Location: infralogin.php");
}
?>
我有我的主页,在我登录后它被路由,
<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td colspan="2" align="center">
<form id="form1" name="form1" method="post" action="checklogin.php">
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td> </td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="center"><a href="tickettracker.php">Ticket Uploader</a></td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="center"><a href="raptool.php">RAP Tool</a></td>
</tr>
<tr bgcolor="#FFFFFF">
<td> </td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="center"><a href="login/add_user.php">Add User</a></td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="center"><a href="login/logout.php">Logout</a></td>
</tr>
</table>
</form></td>
</table>
现在这个tickettracker.php有子页面,我通过里面的链接访问,下面是里面的示例链接,
<tr>
<td width="135"><strong>Ticket Source:</strong></td>
<td align="left"><select name="Ticket" id="Ticket">
<option value="tickettracker.php" selected="selected">Please select...</option>
<option value="wireless_new.php">Wireless - Remedy</option>
<option value="smp_backend.php">SMP - Backend</option>
<option value="ess_remedy.php">ESS - Remedy</option>
<option value="wireline_remedy.php">Wireline - Remedy</option>
</select>
<input type="submit" value="Go" id="submit"/></td>
</tr>
<p align="center"><a href="view_transactions.php">View Transactions</a> | <a href="report_generator.php">Report Generator</a></p>
<tr align="center">
<p align="center">External Link: <a href="raptool.php">RAP Tool</a></p></td>
我尝试在所有子页面中输入下面的代码,以保护它们,因为我无法访问它们并且我被路由到登录页面,但事情是每当我已经登录并且我点击了tickettracker.php访问子页面,我仍然被重定向到登录页面
<?PHP
session_start();
session_destroy();
if (!(isset($_SESSION['login']) && $_SESSION['login'] != '')) {
header ("Location: infralogin.php");
}
?>