hi,
here i mention my code its a code to login and logout code when i click on logout than its return on userlogin page but when i press back button of browser its return to previous page.
code here
RM.php
<form action="login.php" method="post">
<table width="300" align="center" border="1">
<tr>
<td colspan="3" align="center"><h2>Login</h2></td>
</tr>
<?php
$msg=$_GET['msg'];
if(isset($msg))
{
//echo "hello";
echo "<tr><td colspan='3'><font color='#FF0000'>" .$msg. "</font></td></tr>";
}
?>
<tr>
<td width="80" align="right">Userid</td>
<td width="10">:</td>
<td><input type="text" id="txt_userid" name="txt_userid" /></td>
</tr>
<tr>
<td width="80" align="right">Password</td>
<td width="10">:</td>
<td><input type="text" id="txt_pass" name="txt_pass" /></td>
</tr>
<tr>
<td width="80"></td>
<td width="10"></td>
<td><input type="submit" id="txt_sub" name="txt_sub" value="Login" /></td>
</tr>
</table>
</form>
login.php
<?php
session_start();
if($_POST['txt_userid']=="rm" && $_POST['txt_pass']=="123")
{
$_SESSION['username']="rm";
$_SESSION['pass']="123";
header("location:welcome.php");
}
else
{
/*?>
<script language="javascript">
alert("Check user name and password");
</script>
<?php*/
header("location:rm.php?msg=Check user name and password");
}
?>
welcome.php
<?php
session_start();
echo $_SESSION['username'];
?>
<a href="logout.php">Logout</a>
Logout.php
<?php
session_start();
session_unset(void);
header("location:login.php");
?>
anybody suggest me where is the mistake
i want a proper login and logout page.
thanks