Page 1 of 1

header sent problem

Posted: Tue Jun 08, 2004 8:27 am
by almostsane
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>&nbsp;</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>&nbsp;</td>
		  		<td><input type='submit' name='Submit' value='Submit'></td>
				</tr>
	  			</table>
				</form>";
	}
}
?>

Posted: Tue Jun 08, 2004 8:31 am
by almostsane
forgot to say none of the above "solutions" work.

Posted: Tue Jun 08, 2004 2:00 pm
by feyd
I split this out of the tutorials because it doesn't belong there. Additionally, I switched the

Code: Select all

tags to

Code: Select all

tags.

Re: header sent problem

Posted: Tue Jun 08, 2004 2:06 pm
by patrikG
almostsane wrote:here is my code. fix it please!!! it will not work!!
When your car breaks down, do you knock on your neighbour's door and shout "My car is broken. FIX IT!"?

No?

I thought so. You are asking volunteers to help you. It's in your interest to ask politely and courtesly. I am tempted to lock this thread for a week to make my point somewhat clearer.

Posted: Tue Jun 08, 2004 2:09 pm
by magicrobotmonkey
and even if you take it to the mechannc instead of your neighbor, you generally tell him what's wrong, right?

Posted: Tue Jun 08, 2004 3:17 pm
by jason
almostsane: Please repost, and make sure you describe what you are trying to accomplish, and what the problems are that you are having. If you want someone to write the code for you, you can post in the Business section under Job Hunt or ask for Volunteer help.