Header page error
| From: | Wee Chua | Date: | Wed, 06 Sep 2000 18:07:35 +0000 |
| Subject: | Header page error | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-15573@lists.php.net to get a copy of this message | ||
Hi all,
Why I couldn't jump to another page in my codes if login process fail? Here
are my codes:
<?php
$db = mysql_connect("localhost", "$username", "$password") or die
("Unable
to connect to database");
mysql_select_db("mysql", $db) or die ("Unable to connect to database");
$ip = $REMOTE_ADDR;
$result = mysql_query("Select host,user,password, PASSWORD('$password') as
Form_Pass From user Where user= '$username'",$db);
$row = mysql_fetch_array($result);
if (($row["host"] == "$ip") or ($row["host"] ==
"localhost")){
if (($row["user"] == "$username") && ($row["password"] ==
$row["Form_Pass"]) && ($username != "") && ($password !=
""))
{
header("Location: http://152.160.178.35/index.html");
}
else
{
// echo "Incorrect Wrong!";
header("Location: http://152.160.178.35/index.html");
exit();
}
}
else
{
echo "<H1>Wrong Host!</H1><BR>";
}
?>
And it also gave me this error message "Warning: Cannot add header
information - headers already sent by (output started at
/usr/local/apache/htdocs/SSL/main.php:2)" when I tried to login. Why??
Thank you very much.
Calvin