Forum Moderators: coopster

Message Too Old, No Replies

Can't figure out header error

         

andrewsmd

5:44 pm on Jan 7, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have a page that uses a template system like smarty. I have a JS function that calls this php file to add some user input to a db and the page. I'm getting the cannot modify header information error. While I know the reason behind this error, I cannot seem to find in my code where I'm setting some sort of header information after html has been set. Here is the add input file that gets called by JS on a button click that is causing the header error. I should also mention this runs fine on my dev server but not on my live server

<?php

require_once("IT.php");
require_once("functions.php");


connect();
$input = mysql_real_escape_string($_GET['input']);
$fb = mysql_real_escape_string($_GET['fbLink']);
$twt = mysql_real_escape_string($_GET['twtLink']);
$cust = mysql_real_escape_string($_GET['custLink']);
close();
$time = time();

$code = $_GET['code'];

//check the captcha
include("securimage/securimage.php");
$img = new Securimage();
$valid = $img->check($code);

if($valid == true){

//make sure that we have some input
if($input != "" && $input != "Enter something about yourself, a funny quote, or just about anything you want to identify yourself here..."){

if($fb == "Your facebook page"){

$fb = "";

}//if fb
if($twt == "Your twitter page"){

$twt = "";

}//if fb
if($cust == "Your blog or website"){

$cust = "";

}//if fb

$query = "insert into messages(text, facebook, twitter, custom, up, date) values('{$input}', '{$fb}', '{$twt}', '{$cust}', 0, '{$time}');";

$lastReplace = stripslashes($_GET['input']);

if(runQuery($query)){
$temp = (mysql_insert_id());
$_SESSION['posted'] = time();

//check the message length
$output = checkMessage($lastReplace, $temp);
$_SESSION['hasInput'] = "Yes";
echo("<div class=\"bubbleTop\">
</div>
<div class=\"bubbleMiddle\">
<div id=\"\" class=\"bubbleContent\">".html_entity_decode($output)."</div>
<table style=\"width: 285px;\">
<tbody><tr>
<td align=\"right\">");
echo($fb != "" ? "<a href=\"$fb\" target=\"_blank\"><img src=\"images/buttons/facebook.png\" style=\"border: none;\"></a>&nbsp;&nbsp;" : "");
echo($twt != "" ? "<a href=\"$twt\" target=\"_blank\"><img src=\"images/buttons/twitter.png\" style=\"border: none;\"></a>&nbsp;&nbsp;" : "");
echo($cust != "" ? "<a href=\"$cust\" target=\"_blank\"><img src=\"images/buttons/site.png\" style=\"border: none;\"></a>&nbsp;&nbsp;" : "");
echo("<img id=\"plus{$temp}\" src=\"images/buttons/plus.png\" onclick=\"plusClick('{$temp}')\" style=\"border: none; cursor: hand;\">");
echo("</td>
</tr>
</tbody></table>
</div>
<div class=\"bubbleBottom\">
</div>
<br>
<br>

</div>");

}//if runQuery
else{

echo("error");

}//else
}//if input
else{

echo("error");

}//else

}//if valid == ture
else{
echo("wrong code");
}//else

?>

penders

10:32 am on Jan 8, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Are you getting the "...output already started on line ?", but no help?

You are using sessions. Sessions store a cookie which is part of the header.

Do you have any white space outside of your PHP delimiters
<?php ... ?>
? White space before the delimiter would cause output to start immediately.

henry0

1:59 pm on Jan 8, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



On live server is OB turned on?