登录后如何http_referer
在我的页面中设置我的位置logout.php
(使用signin.php)检查并成功登录重定向到我提供注销链接(使用href)的joomla.php现在我想点击注销并转到`登录。php & 我得到 http_referer 是 joomla.php 所以我可以设置 logout.php
代码:Signin.php
$referer = $_SERVER['HTTP_REFERER']; echo $referer; if ($referer == 'http://localhost/MinProject/reg.php') { echo "Registration SuccessFully"; } else if($referer=='http://localhost/MinProject/changepassword.php') { echo"Change Password SuccessFully"; }
joomla.php
<html> <body> <table width="100%"> <tr> <td width="20%" height="32" align="right" class="unm"> <?php session_start(); if(isset($_SESSION['username'])) { $name =$_SESSION['username']; echo "Welcome ".$name; } ?> </td> <td width="64%" height="32" align="right"> <a href="changepassword.php">ChangePassword</a> </td> <td width="10%" align="right"> <a href="logout.php">logout</style></a> </td> <td width="11%"></td> <td width="5%"></td> <td width="5%"></td> <td width="5%"></td> </tr> </table> </body> </html>
注销.php
session_start(); unset($_SESSION['username']); session_destroy(); response.setHeader("Location: http://localhost/MinProject/logout.php"); header("Location: Signin.php"); exit();