header sent problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Locked
almostsane
Forum Newbie
Posts: 13
Joined: Sat Jan 10, 2004 3:26 am

header sent problem

Post 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>";
	}
}
?>
almostsane
Forum Newbie
Posts: 13
Joined: Sat Jan 10, 2004 3:26 am

Post by almostsane »

forgot to say none of the above "solutions" work.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Re: header sent problem

Post 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.
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

and even if you take it to the mechannc instead of your neighbor, you generally tell him what's wrong, right?
jason
Site Admin
Posts: 1767
Joined: Thu Apr 18, 2002 3:14 pm
Location: Montreal, CA
Contact:

Post 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.
Locked