Ok, so I log in with one username, and it says Welcome User1.
I click back, and log in with a different user and it says Welcome User1.
Now when I click log out with either username, it destroys the session. How do I get it so this doesnt happed. I mean so it will display the correct name and the correct info for each log in name...
Here is my code:
<?
include('dbinfo.inc.php');
$query = "SELECT * FROM users WHERE username='$username' AND password='$password'";
$result = mysql_query($query) or die(mysql_error());
$rows = mysql_num_rows($result) or die(mysql_error());
if ($rows == '1') {
session_start();
session_register("username");
header("Location: secure.php");
} else {
echo" <font color='#000000'>ACCESS DENIED! </font> ";
}
?>
That was the verify part, here is the secure.php part:
<?
session_start();
if (session_is_registered("username")) {
include('dbinfo.inc.php');
include('css.css');
include('top.php');
?>
<tr>
<td width=593 height=1 colspan=2><img src="/images/black.gif" width=100% height=1></td>
</tr>
<tr>
<td width=593 height=1 colspan=2><img src="/images/black.gif" width=100% height=1></td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" border="0" width="656" align="center">
<tr>
<td colspan="2" width="621" bgcolor="#687B8C" valign="top">
<table cellpadding="10" cellspacing="0" border="0" width="654">
<tr>
<td valign="top"> <div align="center"></div>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#415369" width="465"><img src="/images/leftcorners_smallboxes.gif" alt="" border="0" width="32" height="32">
<font face="Tahoma" color="#ffffff" size="4"><b>Login Accepted!</b></font></td>
</tr>
<tr>
<td bgcolor="#415369" height="120" width="465"><div align="center">
<font color="#FFFFFF" size="2" face="Tahoma"><strong>Welcome
<?= $username ?>
</strong> </font></div></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<?
include('bottom.php');
} else {
header("Location: [url]http://kaboom.ionichost.com/index.php[/url]");
}
?>
And logout.php is just:
<?
session_start();
session_destroy();
include('css.css');
include('top.php');
include('dbinfo.inc.php');
?>
<tr>
<td width=593 height=1 colspan=2><img src="/images/black.gif" width=100% height=1></td>
</tr>
<tr>
<td width=593 height=1 colspan=2><img src="/images/black.gif" width=100% height=1></td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" border="0" width="656" align="center">
<tr>
<td colspan="2" width="621" bgcolor="#000000"><img src="/images/spacer.gif" width=1 height=1 alt="" border="0"></td>
</tr>
<tr>
<td colspan="2" width="621" bgcolor="#D1DADE"><img src="/images/spacer.gif" width=1 height=1 alt="" border="0"></td>
</tr>
<tr>
<td colspan="2" width="621" bgcolor="#687B8C" valign="top">
<table cellpadding="10" cellspacing="0" border="0" width="654">
<tr>
<td valign="top"> <div align="center"></div>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#415369" width="465"><img src="/images/leftcorners_smallboxes.gif" alt="" border="0" width="32" height="32">
<font face="Tahoma" color="#ffffff" size="4"><b>Logged out!</b></font></td>
</tr>
<tr>
<td bgcolor="#415369" height="120" width="465"><div align="center">
<font color="#FFFFFF" size="2" face="Tahoma"><strong>You have
successfully logged out.</strong> </font></div></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<?
include('bottom.php');
?>
Thanks so much in advance!