I have a log in system and upon logging in, I cannot get the page to redirect to the members section. I've tried a bunch of different methods, and none seem to work. Here is my current code, can anyone offer some suggestions please?
{
$username = mysql_real_escape_string($username);
$password = md5( mysql_real_escape_string($password) );
$sql = mysql_query("SELECT * FROM usersystem WHERE username = '$username' AND password = '$password' LIMIT 1");
$rows = mysql_num_rows($sql);
if ($rows<1)
{
echo "&serverResponse=Incorrect username/password";
}
else {
ob_start();
header( "Location: play.php" ) ;
setcookie("username", "$username", time()+3600);
$result = mysql_query("SELECT total FROM usersystem WHERE username = '$username'") or die( mysql_error() );
$row=mysql_fetch_assoc($result);
$total = $row['total'];
setcookie("total", "$total", time()+3600);
$_SESSION['username'] = $username;
}
}
It does set the cookies because if I go to play.php manually I can see where they are pulled. If I do not log in it will redirect to the page reserved for not being logged in. I'm completely new at this so I'm sure it is a simple mistake, I just don't know what. Thanks.