Search the Community
Showing results for tags 'cannot modify'.
-
Hey guys, So I have this really tricky problem with my login system. I get the cannot modify header information but I havent sent any output ? Here's the error log: [10-Nov-2012 09:38:25 UTC] PHP Warning: Cannot modify header information - headers already sent by (output started at /home/sdelkata/public_html/login.php:1) in /home/sdelkata/public_html/login.php on line 16 [10-Nov-2012 09:38:25 UTC] PHP Warning: Cannot modify header information - headers already sent by (output started at /home/sdelkata/public_html/login.php:1) in /home/sdelkata/public_html/login.php on line 17 and here's the login.php ( lines 16 and 17 are originally the setcookie lines ) <?php ob_start(); require("connect_db.php"); $email = mysql_real_escape_string($_POST['email']); $password = mysql_real_escape_string($_POST['password']); $msg=""; if (mysql_num_rows(mysql_query("SELECT `id` FROM `blabla` WHERE `email`='$email'"))==0){ $msg = "There is no user named ".wordwrap($email, 33, "<br />\n", 1); }elseif(mysql_num_rows(mysql_query("SELECT `id` FROM `blabla` WHERE `email`='$email' AND BINARY `password`='$password'"))==0){ $msg = "Wrong password!"; }else{ $id = mysql_result(mysql_query("SELECT `id` FROM `blabla` WHERE `email`='$email' AND `password`='$password'"),0); setcookie("dd", md5($id),time()+60*60*24*365*10); setcookie("ff", md5("1"), time()+60*60*24*365*10); sleep(2); echo "<script>document.location.reload(true)</script>"; } if($msg!=""){ sleep(2); echo "<div id='msgboxred'>$msg</div>"; include "login.html"; } ob_end_clean(); ?> I even added ob_start and ob_end_clean but it still gives me the error. What is weird tho is that it works on my 5.4.4 localhost testing server but doesn't work on the online hosting machine which has 5.3.15 ( php version ). Any help is really appreciated!
- 4 replies
-
- header
- cannot modify
-
(and 1 more)
Tagged with: