Hello, need a little help with this one. I have a login script that after the user logs in, it just say "You are logged in". But I would like it to redirect to a page after the login instead of the message. Below is the part of the script I think that is responsible for the message.
<?php
$target=$_SERVER["PHP_SELF"];
include("assets/common.php");
if (isset($_SESSION['level'])) {
if (isset($logout)){
session_unregister("level");
}else{
echo"
<form name=form1 method=post action=$target>
<table border=0 cellspacing=0 cellpadding=0 class=content>
<tr>
<td>You are logged</td>
</tr>
<tr>
<td >
<input name=logout type=hidden value=logout>
<input name=submit type=image src=assets/logout.gif border=0 >
</td>
</tr>
</table>
</form>";
}
}
if (!isset($_SESSION['level'])) {
if (isset($username)){
$query = "SELECT level FROM users WHERE username='$username' AND password='$password'" or die("Wrong Password");
$sql_results = mysql_query($query,$connection);
while ($row = mysql_fetch_array($sql_results)) {
$level = $row['level'];
session_register("level");
}
}
if (isset($_SESSION['level'])) {
echo"
<form name=form1 method=post action=$target>
<table border=0 cellspacing=0 cellpadding=0 class=content>
<tr>
<td>You are logged</td>
</tr>
<tr>
<td >
<input name=logout type=hidden value=logout>
<input name=submit type=image src=assets/logout.gif border=0 >
</td>
</tr>
</table>
</form>";
}else{
echo"
<form name=form1 method=post action=$target>
<table width=300 class=fntsize2 border=0 cellspacing=0 cellpadding=5 align=left bgcolor=eeeeee style=BORDER-RIGHT:#3399CC 1px solid; BORDER-LEFT:#3399CC 1px solid; BORDER-TOP:#3399CC 1px solid; BORDER-BOTTOM:#3399CC 1px solid>
<tr>
<td colspan=2 class=texthead>Login</td>
</tr>
<tr>
<td width=123 bgcolor=#dddddd>Username:</td>
<td width=257 bgcolor=#dddddd>
<input type=text tabindex=1 name=username class=form>
</td>
</tr>
<tr>
<td width=123 bgcolor=#dddddd>
Password:</td>
<td width=257 bgcolor=#dddddd>
<input type=password tabindex=2 name=password class=form>
</td>
</tr>
<tr>
<td width=123 bgcolor=#dddddd><a class=fntsize1 href=#>Password
Retrieval</a></td>
<td width=257 align=right bgcolor=#dddddd>
<input type=submit name=Submit tabindex=3 value=Login>
</td>
</tr>
</table>
</form>";
}
}
?>
Thanks for any help.