Jump to content

Header Problem


elmas156

Recommended Posts

I've got this sign in code:

 


[code=php:0]
<?php
include("conf.inc.php"); // Includes the db and form info.
if ($_SESSION['logged'] == 1) { // User is already logged in.
    $_SESSION['email'] = $email;
header("Location: main.php"); // Goes to main page.
exit(); // Stops the rest of the script.
} else {
if (!isset($_POST['submit'])) { // If the form HAS NOT been submitted.
	echo "<td width=\"320\" height=\"50\" align=\"left\" valign=\"middle\"> </td>";
      	echo "<td width=\"360\" height=\"50\" align=\"left\" valign=\"middle\">";
	echo "<form name=\"form\" action=\"index.php\" method=\"POST\" style=\"margin-bottom:0;\">";
	echo "<a href=\"signup.php\" class=\"bluelink\">Sign Me Up!</a>                  ";
	echo "<a href=\"pwordhelp.php\" class=\"bluelink\" onMouseOver=\"window.name = 'main'\" onClick=\"return popup(this, 'notes')\">Forgot Password</a><br>";
	echo "<input type=\"text\" name=\"email\" size=\"17\" value=\"Email...\" style=\"color: #999999\" onfocus=\"if (this.value == 'Email...') {this.value=''; this.style.color='#000000'}\">    ";
	echo "<input type=\"password\" name=\"pword\" size=\"17\" value=\"Password...\" style=\"color: #999999\" onfocus=\"if (this.value == 'Password...') {this.value=''; this.style.color='#000000';}\"> ";
	echo "<input type=\"submit\" name=\"submit\" value=\"Submit\">";
	echo "</form>";
} else {    // If the form HAS been submitted
	$email = form($_POST['email']);
	$pword = md5($_POST['pword']); // Encrypts the password.

	$q = mysql_query("SELECT * FROM `signin` WHERE email = '$email' AND pword = '$pword'") or die (mysql_error()); // mySQL query
	$r = mysql_num_rows($q); // Checks to see if anything is in the db. 

	if (!$r) { // There is nothing in the db. The username/password do not match up.

		echo "<td width=\"108\" height=\"50\" align=\"left\" valign=\"middle\"> </td>";
      		echo "<td width=\"572\" height=\"50\" align=\"left\" valign=\"middle\">";
		echo "<form name=\"form\" action=\"index.php\" method=\"POST\" style=\"margin-bottom:0;\">";
		echo "                                                     <a href=\"signup.php\" class=\"bluelink\">Sign Me Up!</a>                 ";
		echo "<a href=\"pwordhelp.php\" class=\"bluelink\" onClick=\"return popup(this, 'notes')\">Forgot Password</a><br>";
		echo "<font color=\"#FF0000\"><strong>Incorrect Email or Password.</strong></font>   ";
		echo "<input type=\"text\" name=\"email\" size=\"17\" value=\"Email...\" style=\"color: #999999\" onfocus=\"if (this.value == 'Email...') {this.value=''; this.style.color='#000000'}\">    ";
		echo "<input type=\"password\" name=\"pword\" size=\"17\" value=\"Password...\" style=\"color: #999999\" onfocus=\"if (this.value == 'Password...') {this.value=''; this.style.color='#000000';}\"> ";
		echo "<input type=\"submit\" name=\"submit\" value=\"Submit\">";
		echo "</form>";

	} else {      // If the username/password is invalid

		$_SESSION['logged'] = 1; // Sets the session.
		$_SESSION['email'] = $email;
		header("Location: main.php"); //   THIS IS LINE 111
		exit(); // Stops the rest of the script.

	}
}
}
?>

 

[/code]

 

And when I sign in with my user name and password, I get this warning message:

 

Warning: Cannot modify header information - headers already sent by (output started at /home/content/29/6879529/html/calhoun/index.php:9) in /home/content/29/6879529/html/calhoun/head1.inc.php on line 111

 

Can anyone help me out and tell me what I need to do to correct this?  Thanks in advance for your help!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.