Hey there everyone. I am getting this error: Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/rizonct/terms.php:1) in /usr/www/users/rizonct/includes/config.inc.php on line 8 on my page, terms.php. I will provide the snippets of code i believe to be causing the problem, please tell me how to fix this asap if you can! Top of terms.php: <?php include('includes/config.inc.php'); require_once('includes/online.inc.php'); require_once('includes/banned.inc.php'); ?> <?php include ('header.php'); include ('includes/index.inc.php'); include_once('header.php'); if (isset($_COOKIE["usNick"]) && isset($_COOKIE["usPass"])) { $user = $_COOKIE["usNick"]; } else { $user = 'Guest'; } ?> PHP: Config.inc.php: <?php require_once ('database/database.inc.php'); $myDb = new Db; include ('siteconfig.inc.php'); require_once ('controls.inc.php'); if(isset($_COOKIE["usReferrer"])){ }else{ setcookie("usReferrer",limpiar($_GET["ref"]),time()+7776000); } ?> PHP: Thank you, all your help is greatly appreciated!
Replace the top part of terms.php with: <?php ob_start(); include('includes/config.inc.php'); require_once('includes/online.inc.php'); require_once('includes/banned.inc.php'); ?> PHP:
You can not modify header via header() after you've wrote a content to page using echo() or print() command. this means you can't put header() into the bottom of the page also.
ads2help, that didn't seem to work.. yoes san, i dont have any headers modified at the bottom, this page had always been fine until i changed this: <table id="ptable" border="0" cellspacing="5" cellpadding="5" width="100%"> <tr> <td width="48" valign="top"><img src="images/icons/terms05.png" border="0"></a></td> <td valign="top" align="left"> You must have a valid e-mail address and valid AlertPay address to register with our program. In order to recieve payments,you must first verify your alertpay address by paying a one-time fee of $1.00 to RizonClickz. This is to prevent fraudsters and cheaters from recieving our money. If you fail to verify your account, you may not recieve any further payments. </td> </tr> </table> PHP: all i did was change the text, then i got this error now.. i hope that can help someone help me.. Thanks for the suggestions.
If you are saving your web-pages in utf-8(UNICODE) you should take care about BOM-please google about "saving utf8 pages without bom". BOM causes output start, so next call to session_start()/header() results in warning. Regards
Hmm i just cant seem to get this to work.. what the heck is going on here!! All i changed was the text, and saved it as i normally do..
Just put this code at the most top of the file. For example: If your index.php includes header.php first, put it at the top of header.php, not index.php Are you sure you pasted that on the most top of file?
You can suppress warnings by entering: <?php error_reporting(0);?> Code (markup): at topmost of your file instead of ob_start()->this will hide warning but is not a complete and clean solution: it's best to zip your file and post it here and let us check it. Regards
I discovered that too in the past when i was having trouble with a wordpress theme that i was creating, i resaved all files as UTF-8 without BOM and it solved the issue i was having.