boardom Forum Index boardom
b2 message board
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Hack Error--Or My Error

 
Post new topic   Reply to topic    boardom Forum Index -> Hacks
View previous topic :: View next topic  
Author Message
kenya



Joined: 27 Sep 2003
Posts: 3

PostPosted: Sun Mar 14, 2004 3:10 pm    Post subject: Hack Error--Or My Error Reply with quote

Greetings,

Last night, I eagerly installed the following hacks that I found on this site:

Number of posts, Number of comments

Smilies into the commentspopup and comments files

Smilies in the Post and Edit region

and Last Comments

Now I have a problem....

If I create a new entry or comment on an entry and push "POST" or "SUBMIT" or "BLOG THIS", then I get an error message.

An example is what I just received when I tried to comment on an entry.


Warning: Cannot modify header information - headers already sent by (output started at /home/black-po/public_html/blog/b2-include/b2functions.php:960) in /home/black-po/public_html/blog/b2comments.post.php on line 103

Warning: Cannot modify header information - headers already sent by (output started at /home/black-po/public_html/blog/b2-include/b2functions.php:960) in /home/black-po/public_html/blog/b2comments.post.php on line 104

Warning: Cannot modify header information - headers already sent by (output started at /home/black-po/public_html/blog/b2-include/b2functions.php:960) in /home/black-po/public_html/blog/b2comments.post.php on line 105

Warning: Cannot modify header information - headers already sent by (output started at /home/black-po/public_html/blog/b2-include/b2functions.php:960) in /home/black-po/public_html/blog/b2comments.post.php on line 107


Could someone please help me? I thought that it might have been the "LAST COMMENTS" script because the error message says something about b2functions.php:960. So I deleted the include statement on b2function and the call statement on where I want it to show up but I still get errors.

Thanks!
Kenya

You can check out my site and try to comment or post at www.black-poetry.com
Back to top
View user's profile Send private message
kenya



Joined: 27 Sep 2003
Posts: 3

PostPosted: Mon Mar 15, 2004 8:10 am    Post subject: Sadly... Reply with quote

I deleted the Last Comments script COMPLETELY.

I kept the smilies in the posts and in the comments. I have also kept the total posts and total comments features.

I erased the small line of code (WHICH ORIGINALLY WORKED) out of b2functions. This code was for the Last Comments script.

THIS IS THE ERROR MESSAGE THAT I STILL GET. If someone tries to login or if they post a comment, I get the same message but it references, for example, /blog/b2edit.php on line 176 if someone tries to POST a new entry.

Warning: Cannot modify header information - headers already sent by (output started at /home/black-po/public_html/blog/b2-include/b2functions.php:960) in /home/black-po/public_html/blog/b2comments.post.php on line 103

Warning: Cannot modify header information - headers already sent by (output started at /home/black-po/public_html/blog/b2-include/b2functions.php:960) in /home/black-po/public_html/blog/b2comments.post.php on line 104

Warning: Cannot modify header information - headers already sent by (output started at /home/black-po/public_html/blog/b2-include/b2functions.php:960) in /home/black-po/public_html/blog/b2comments.post.php on line 105


Here is the b2function beginning and ending of the script.

BEGINNING:

<?php

/* functions... */

function get_currentuserinfo() { // a bit like get_userdata(), on steroids
global $HTTP_COOKIE_VARS,$user_login,$userdata,$user_level,$user_ID,$user_nickname,$user_email,$user_url,$user_pass_md5,$user_image;
// *** retrieving user's data from cookies and db - no spoofing
$user_login = $HTTP_COOKIE_VARS["cafeloguser"];
$userdata = get_userdatabylogin($user_login);
$user_level = $userdata["user_level"];
$user_ID=$userdata["ID"];
$user_nickname=$userdata["user_nickname"];
$user_email=$userdata["user_email"];
$user_url=$userdata["user_url"];
$user_pass_md5=md5($userdata["user_pass"]);
$user_image=$userdata["user_image"];
}



function dbconnect() {
global $connexion, $server, $loginsql, $passsql, $base;
$connexion = mysql_connect($server,$loginsql,$passsql) or die("Can't connect to the database server. MySQL said:<br />".mysql_error());
$connexionbase = mysql_select_db("$base") or die("Can't connect to the database $base. MySQL said:<br />".mysql_error());
return(($connexion && $connexionbase));
}

/***** Formatting functions *****/


function autobrize($content) {
$content = preg_replace("/<br>\n/", "\n", $content);
$content = preg_replace("/<br \/>\n/", "\n", $content);
$content = preg_replace("/(\015\012)|(\015)|(\012)/", "<br />\n", $content);
return($content);
}
function unautobrize($content) {
$content = preg_replace("/<br>\n/", "\n", $content); //for PHP versions before 4.0.5
$content = preg_replace("/<br \/>\n/", "\n", $content);
return($content);
}


function format_to_edit($content) {
global $autobr;
$content = stripslashes($content);
if ($autobr) { $content = unautobrize($content); }
$content = htmlspecialchars($content);
return($content);
}
function format_to_post($content) {
global $post_autobr,$comment_autobr;
$content = addslashes($content);
if ($post_autobr || $comment_autobr) { $content = autobrize($content); }
return($content);
}


function zeroise($number,$threshold) { // function to add leading zeros when necessary
$l=strlen($number);
if ($l<$threshold)


ENDING:

}
}
$tag = '';
}
} else { // Begin Tag
$tag = strtolower($regex[1]);

// Tag Cleaning
if(checkTag($tag)) {
// Push if not img or br or hr
if($tag != 'br' && $tag != 'img' && $tag != 'hr') {
$stacksize = array_push ($tagstack, $tag);
}

// Attributes
// $attributes = $regex[2];
$attributes = cleanAttributes($regex[2]);
if($attributes) {
$attributes = " " . $attributes;
}

$tag = "<$tag" . $attributes . ">";
} else {
$tag = '';
}
}

$newtext .= substr($text,0,$i) . $tag;
$text = substr($text,$i+$l);
}

// Clear Tag Queue
$newtext = $newtext . $tagqueue;

// Add Remaining text
$newtext .= $text;

// Empty Stack
while($x = array_pop($tagstack)) {
$newtext = $newtext . '</' . $x . '>'; // Add remaining tags to close
}

# b2 fix for the bug with HTML comments
$newtext = str_replace("< !--","<!--",$newtext);
$newtext = str_replace("< !--","< !--",$newtext);

return $newtext;

}
}



function checkTag($tag) {
$ok = 1;

// the using ifs are 25% faster than declaring an array and using in_array()
if ($tag == 'applet' || $tag == 'base' || $tag == 'body' || $tag == 'embed' || $tag == 'frame' || $tag == 'frameset' || $tag == 'html' || $tag == 'iframe' || $tag == 'layer' || $tag == 'meta' || $tag == 'object' || $tag == 'script' || $tag == 'style') {
$ok = 0;
}

return $ok;
}

function cleanAttributes($attributes) {

return($attributes);

if (1==2) {

$name = 1; // if we're in a name or a value
$quote = 0; // quote open or not
$new ='';
$attr = '';
$i = 0;
$l = 0;

while($attributes) {
if($name) {
$found = preg_match('/([^\s=]+)\s*([=]*)/i', $attributes, $regex);

$attr .= strtolower($regex[1]);
$i = strpos($attributes,$regex[0]);

//$new .= "[name]$attr" . '[/name]';

// DEBUG
//echo "<fieldset><legend>name</legend>attributes: [$attributes]<br>regex[1]: [$regex[1]]</fieldset><br>";

$l = strlen($regex[0]);

// strip quotes in attribute names
$attr = str_replace('"', '', $attr);

if($attr == 'style' || $attr == 'type' || preg_match('/^on/', $attr)) { // allow src and hrefs
$attr = ' ';
} else {
if($regex[2]) {
$attr .= '=';
$name = 0;
} else {
if(substr($attributes,$i+$l)) $attr .= ' ';
}
}
} else { //var
$found = preg_match('/("?)([^\s"]+)("?)/i', $attributes, $regex);
$attr = $regex[0];
$i = strpos($attributes,$regex[0]);
$l = strlen($regex[0]);

//DEBUG
//echo "<fieldset><legend>var</legend>found: $found<br>attributes: [$attributes]<br>regex[2]: [$regex[2]]<br>";
//print_r($regex);
//echo "</fieldset><br>";

if($regex[1]) $quote ? !$quote : $quote;
if($regex[3]) $quote ? !$quote : $quote;

if(preg_match('/javascript:/', $attr)) {
$attr = '""';
}

// sets to name if closed quote
$quote ? $name = 0 : $name = 1;
}

$new .= substr($attributes,0,$i) . $attr;
$attr = '';
$attributes = substr($attributes,$i+$l);
}

//allow badly formed attributes? i don't think so
//$new .= $attributes;

// open quote
$quote ? $new .= '"' : $new ;

return $new;
}
}

?>




Thanks for anyone who can offer a pointer.
Back to top
View user's profile Send private message
stevem



Joined: 15 Mar 2003
Posts: 85

PostPosted: Tue Mar 16, 2004 7:42 pm    Post subject: Reply with quote

Have you got any spaces or empty lines after the final ?> of b2functions.php?

The problem starts on line 960 of b2functions.php, so check near this line, but the cause could be elsewhere in the file.

If this doesn't help, then go back to the original b2functions.php you downloaded and make any changes one at a time, testing to see what happens until you have found the cause of the problem. Tedious, but possibly the only way to dind the source of the error.
Back to top
View user's profile Send private message
kenya



Joined: 27 Sep 2003
Posts: 3

PostPosted: Wed Mar 17, 2004 9:46 pm    Post subject: Thanks SteveM! Reply with quote

I am a newbie and had no idea that it was just a few spaces causing me the problems. I had about four spaces or lines following the last ?>.

Thanks so much for taking the time to read through my post and then replying!

You be da man!

KENYA
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    boardom Forum Index -> Hacks All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2 © 2001, 2002 phpBB Group