How can I set my http_referer
location in my logout.php
page after signin(using signin.php) which checks & successfully login redirects to joomla.php where i gave logout link(using a href) now i want to click on logout & go to `signin. php & i got http_referer is joomla.php so hw can i set logout.php
Code: 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>
logout.php
session_start();
unset($_SESSION['username']);
session_destroy();
response.setHeader("Location: http://localhost/MinProject/logout.php");
header("Location: Signin.php");
exit();
HTTP_REFERER can be spoofed so you should not use that.
Looking at your code i think you are trying to achieve.
$Message = $_SESSION['MESSAGE'];//set the message Registration SuccessFully if registration else set it as Change Password SuccessFully or accordingly
if (isset($Message) and userhasidentity)
{
echo $Message;
}else
{
header('location:logout.php');
}