header sent problem
Posted: Tue Jun 08, 2004 8:27 am
here is my code. fix it please!!! it will not work!!
Code: Select all
<?
if (!$Submit)
{
echo "<p align='center' class='maintext'>To access the command console, you are required to log-in.</p>
<form action='login.php' method='post' name='login' id='login'>
<table width='200' border='0' align='center' cellpadding='0' cellspacing='0' class='maintext'>
<tr>
<td><div align='right'>Username:</div></td>
<td><input name='user' type='text' id='user'></td>
</tr>
<tr>
<td>Password:</td>
<td><input name='pass' type='password' id='pass'></td>
</tr>
<tr>
<td> </td>
<td><input type='submit' name='Submit' value='Submit'></td>
</tr>
</table>
</form>";
}
else
{
if ($user == "admin" && $pass == "qwerty")
{
$cookname ="authid";
$life= 1800;
$valid_user = $user;
setcookie($cookname, $valid_user, time()+ $life);
echo "<p align='center' class='maintext'>You are logged in as ".$user.", <a href='console.php' target='_self'> Click Here to continue to the Command Console</a></p>";
}
else
{
echo "<p align='center' class='maintext'>Invalid Username or Password, try again.</p>
<form action='login.php' method='post' name='login' id='login'>
<table width='200' border='0' align='center' cellpadding='0' cellspacing='0' class='maintext'>
<tr>
<td><div align='right'>Username:</div></td>
<td><input name='user' type='text' id='user'></td>
</tr>
<tr>
<td>Password:</td>
<td><input name='pass' type='password' id='pass'></td>
</tr>
<tr>
<td> </td>
<td><input type='submit' name='Submit' value='Submit'></td>
</tr>
</table>
</form>";
}
}
?>