Re: header information problem
| From: | Gareth Williams | Date: | Sat, 18 Dec 2004 11:26:45 +0000 |
| Subject: | Re: header information problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-204650@lists.php.net to get a copy of this message | ||
In the else part, you have the possibility to echo to the screen and later on, then header("Location: ...");
This is the bit which isn't allowed.
If you are doing header("Location: ...");, you are not allowed to echo before it.
On 18 Dec 2004, at 11:52, Ahmed Abdel-Aliem wrote:
Dear Groups members. i am making a user protected page, the script works excellent on my local server, but online it gives me this error : Warning: Cannot modify header information - headers already sent by (output started at /home/me2resh/public_html/apex/upload/header.html:10) in /home/me2resh/public_html/apex/upload/upload.php on line 33 the script of the page is <? if (!isset($ID)){ include 'header.html'; echo "No ID is Set.<br>You Got To This Page By Mistake"; include 'footer.html'; }else{ session_start(); include 'db.php'; include 'header.html'; $username = $_POST['username']; $password = $_POST['password']; if((!$username) || (!$password)){ echo "Please enter ALL of the information! <br />";include 'login_form.html'; include 'footer.html'; exit();} $sql = mysql_query("SELECT * FROM user WHERE User_Login='$username' AND User_Password='$password'"); $login_check = mysql_num_rows($sql); if($login_check > 0){ session_register('ID');$_SESSION['ID'] = $ID; while($row = mysql_fetch_array($sql)){ foreach( $row AS $key => $val ){ $$key = stripslashes( $val ); } session_register('User_First_Name'); $_SESSION['User_First_Name'] = $User_First_Name; session_register('User_Last_Name'); $_SESSION['User_Last_Name'] = $User_Last_Name; session_register('User_ID'); $_SESSION['User_ID'] = $User_ID; header("Location: login_success.php"); }}else{ include 'header.html'; echo "You could not be logged in! Either the username and password do not match!<br /> Please try again!<br />"; include 'login_form.html'; include 'footer.html'; } } ?> Can anyone help me with that problem please ? -- Ahmed Abdel-Aliem www.ApexScript.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php