php
| From: | Brandon Feldhahn | Date: | Sat, 17 Feb 2001 21:05:57 +0000 |
| Subject: | php | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-40374@lists.php.net to get a copy of this message | ||
im trying to make somthing that takes the user to the members page if
the authentecation is right, but i keep getting this error:
Warning: Cannot add header information - headers already sent by (output
started at C:\www\login2.PHP:7) in C:\www\login2.PHP on line 30
and this is my code:
<HTML>
<HEAD>
<TITLE>My Login Form</TITLE>
</HEAD>
<?
require ('header.php');
switch ($do) {
case "authenticate":
$connection = mysql_connect("localhost", "brandon", "******")
or die ("Couldn't connect to server.");
$db = mysql_select_db("TNB", $connection)
or die ("Couldn't select database.");
$sql = "SELECT id
FROM members
WHERE username='$username' and password='$password'";
$result = mysql_query($sql)
or die("Couldn't execute query.");
$num = mysql_numrows($result);
if ($num == 1) {
header("Location:index.php");
}else if ($num == 0) {
unset($do);
echo "<font color='ff0000'>You are not authorized! Please try
again.</font></p>";
include("login_form.irc");
}
break;
default:
include("login_form.irc");
}
require ('footer.php');
?>
</BODY>
</HTML>
Line 30 is in bold.
what should i do? PLEASE HELP