Hi,
Anyone,please help me ...............
my first page called index.php
(which has username and password field to enter to move on to next page)
index.php code
<?php
session_start();
mysql_connect("localhost", "root", "")or die("cannot connect");
mysql_select_db("artedb")or die("cannot select DB");
if (isset($_POST) && ($_POST == "submit"))
{
if($_POST=="" && $_POST=="")
{
$msg="Please enter the User Name or Password";
}
else
{
$q=mysql_query("select * from login where username='".$_POST."' and password='".$_POST."'")or die(mysql_error());
$rowcount=mysql_num_rows($q);
if($rowcount==1)
{
$_SESSION="";
$_SESSION=$_POST;
header("Location:search.php");
}
else
{
$msg="Please enter a valid User Name or Password";
}
}
}
?>
<html>
<head>
<title>ARTE</title>
<style type="text/css">
.style1 {font-size: 18px; font-weight: bold; color:25547D; font-family:Verdana;}
.style2 {font-size: 12px; font-weight: bold; color:25547D; font-family:Verdana;}
.style3 {font-size: 11px; font-weight: bold; color:black; font-family:Verdana;}
.style4 {font-family: Verdana;font-weight: normal;font-size: 11px;color: #404040;background-color: #fafafa;border: 1px #ffffff solid;
border-collapse: collapse;border-spacing: 0px;margin-top: 10px;
}
</style>
</head>
<body>
<table align="center" >
<tr>
<td align="center"><br /><br />
<span class="style1"> Indian Institute of Technology Madras <br /></span>
<span class="style2"> Chennai - 600 036. <br /></span>
</td>
</tr>
</table><br /><br /><br /><br /><br />
<table align="center">
<tr><td><font color="blue"><b>Login Details</b></font></td></tr>
</table>
<table align="center">
<tr><td><font color="#FF0000"><b><? echo $msg; ?></b></font></td></tr>
</table>
<form method="POST" name="newentry">
<span class="style4">
<table width="40%" border="0" cellpadding="0" cellspacing="5" align="center">
<tr>
<td width="50%" align="center"><span class="style3">User Name <font color=red>*</font></span></td>
<td><input name="uname" type="text" id="uname" value="<?= $_POST[uname] ?>"></td>
</tr><tr><td></td></tr>
<tr>
<td width="50%" align="center"><span class="style3">Password <font color=red>*</font> </span></td>
<td><input type="password" name="pass" id="pass" size=22/></td>
</tr><tr><td></td></tr>
<tr>
<td align="right">
<input type="submit" name="submit" id="submit" value="submit" />
</td>
<td><input type="reset" name="reset" id="reset" value="Reset" /></td>
</tr>
</table>
</span>
</form>
</body>
</html>
this above code is working fine.
second page called search.php
, in this page, i created a submit button called "LOGOUT". In logout only,i am facing a big problem.when by clicking "Logout button", i redirected to first page `index.php.
logout.php
<?
session_start();
session_destroy();
header ("Location: index.php");
?>
its also redirecting to that page correctly (no problem in this)
But, when i clicking "BACK or FORWARD BUTTON" on the browser (any browser), it showing all my previous used page (search.php, update.php, delete.php
etc).
i dont need like this...........
how to use session_destroy() or session_unset()
or how to delete the cookies .
when by clicking back or forward button in the browser ,i want to restrict from going to previous page.
regards,
santhanalakshmi.