Re: Header page error

From: Date: Thu, 07 Sep 2000 10:20:32 +0000
Subject: Re: Header page error
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-15738@lists.php.net to get a copy of this message
Wee, You must make sure that the <?php is _the_first_thing_in_the_file_. The error means that you have sent plain text before you call the header(). If the mysql_* functions are writting warnings then it could cause this problem. Try pre-pending an @ to the start of the functions to stop warnings. hth, David. ----- Original Message ----- From: Wee Chua <Chua@mail.interclean.com> To: PHP (E-mail) <php-general@lists.php.net> Sent: Wednesday, September 06, 2000 7:07 PM Subject: [PHP] Header page error > 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 > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#15738) next »