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 

Comments no longer working. Please help me

 
Post new topic   Reply to topic    boardom Forum Index -> Template help
View previous topic :: View next topic  
Author Message
tobygirl



Joined: 18 Sep 2004
Posts: 2

PostPosted: Sat Sep 18, 2004 4:16 pm    Post subject: Comments no longer working. Please help me Reply with quote

I have three different b2 blogs on my website and never had a problem. Recently I did a new layout and now the comments won't work. I post my comment hit the okay button (or whatever button it is) then my blog comes up. It has all the stuff on the left hand side, but where the post/comments are suppose to be it's blank. I don't get errors or anything. Theres just nothing there. What can I do?

http://www.toby-girl.net/belly is where the blog is. Please help me I am clueless as to what has happened.

I have done searches and the most I've been able to find is information when there is an error that comes up.
_________________
http://www.toby-girl.net/belly
Back to top
View user's profile Send private message
shellorz



Joined: 14 Sep 2004
Posts: 12
Location: France

PostPosted: Sat Sep 18, 2004 11:25 pm    Post subject: Reply with quote

First things first, is your database updated. I mean : does the new comment appear in it?

Many B2 blogs use comment popups. Yours don't. It might be linked to your issue.

The code for the comment part on your displayed page looks normal:

Code:

<FORM method="post"
action="http://toby-girl.net/belly/b2comments.post.php"><INPUT type=hidden
value=26 name=comment_post_ID> <INPUT type=hidden
value=/belly/index.php?p=26&c=1 name=redirect_to>
<P class=commentfield>name<BR><INPUT class=textarea
onblur="this.value=(this.value=='') ? 'name' : this.value;"
onfocus="this.value=(this.value=='name') ? '' : this.value;" tabIndex=1
value=name name=author> </P>
<P class=commentfield>email<BR><INPUT class=textarea
onblur="this.value=(this.value=='') ? 'email' : this.value;"
onfocus="this.value=(this.value=='email') ? '' : this.value;" tabIndex=2
value=email name=email> </P>
<P class=commentfield>url<BR><INPUT class=textarea
onblur="this.value=(this.value=='') ? 'http://url' : this.value;"
onfocus="this.value=(this.value=='http://url') ? '' : this.value;" tabIndex=3
value=http://url name=url> </P>
<P class=commentfield>your comment<BR><TEXTAREA class=textarea onblur="this.value=(this.value=='') ? 'comment' : this.value;" onfocus="this.value=(this.value=='comment') ? '' : this.value;" tabIndex=4 name=comment rows=4 cols=40>comment</TEXTAREA>
</P>
<P class=commentfield><INPUT tabIndex=6 type=checkbox CHECKED value=1
name=comment_autobr> Auto-BR (line-breaks become <br> tags)<BR><INPUT class=buttonarea tabIndex=5 type=submit value=ok name=submit>
</P></FORM>


Now I can't know whether your b2comments.post.php file deals with the same POST parameters as the one sent by your FORM.
_________________
Make yourself at home but DON'T touch my Porn.
Back to top
View user's profile Send private message
tobygirl



Joined: 18 Sep 2004
Posts: 2

PostPosted: Sun Sep 19, 2004 2:19 pm    Post subject: Reply with quote

This is what was in the b2comments.post.php file.

Quote:
<?php

# if you want to change the paths here, remember to put your new path BEFORE $b2inc,
# like this: "b2/$b2inc/b2functions.php"

require("b2config.php");
require("$b2inc/b2template.functions.php");
include("$b2inc/b2vars.php");
include("$b2inc/b2functions.php");

dbconnect();

function add_magic_quotes($array) {
foreach ($array as $k => $v) {
if (is_array($v)) {
$array[$k] = add_magic_quotes($v);
} else {
$array[$k] = addslashes($v);
}
}
return $array;
}

if (!get_magic_quotes_gpc()) {
$HTTP_GET_VARS = add_magic_quotes($HTTP_GET_VARS);
$HTTP_POST_VARS = add_magic_quotes($HTTP_POST_VARS);
$HTTP_COOKIE_VARS = add_magic_quotes($HTTP_COOKIE_VARS);
}

$author = trim($HTTP_POST_VARS["author"]);
$email = trim($HTTP_POST_VARS["email"]);
$url = trim($HTTP_POST_VARS["url"]);
$comment = trim($HTTP_POST_VARS["comment"]);
$original_comment = $comment;
$comment_autobr = $HTTP_POST_VARS["comment_autobr"];
$comment_post_ID = $HTTP_POST_VARS["comment_post_ID"];

if ($require_name_email && ($email == "" || $email == "@" || $author == "" || $author == "name")) { //original fix by Dodo, and then Drinyth
echo "Error: please fill the required fields (name, email)";
exit;
}
if ($comment == "comment" || $comment == "") {
echo "Error: please type a comment";
exit;
}

$user_ip = $HTTP_SERVER_VARS['REMOTE_ADDR'];
$user_domain = gethostbyaddr($user_ip);
$time_difference = get_settings("time_difference");
$now = date("Y-m-d H:i:s",(time() + ($time_difference * 3600)));

$author = strip_tags($author);
$email = strip_tags($email);
if (strlen($email) < 6) {
$email = '';
}
$url = trim(strip_tags($url));
$url = ((!stristr($url, '://')) && ($url != '')) ? 'http://'.$url : $url;
if (strlen($url) < 7) {
$url = '';
}
$comment = strip_tags($comment, $comment_allowed_tags);
$comment = balanceTags($comment, 1);
$comment = convert_chars($comment);
$comment = format_to_post($comment);

$comment_author = $author;
$comment_author_email = $email;
$comment_author_url = $url;

$author = addslashes($author);
$email = addslashes($email);
$url = addslashes($url);

/* flood-protection */
$query = "SELECT * FROM $tablecomments WHERE comment_author_IP='$user_ip' ORDER BY comment_date DESC LIMIT 1";
$result = mysql_query($query);
$ok=1;
if (!empty($result)) {
while($row = mysql_fetch_object($result)) {
$then=$row->comment_date;
}
$time_lastcomment=mysql2date("U","$then");
$time_newcomment=mysql2date("U","$now");
if (($time_newcomment - $time_lastcomment) < 30)
$ok=0;
}
/* end flood-protection */

if ($ok) {

$query = "INSERT INTO $tablecomments VALUES ('0','$comment_post_ID','$author','$email','$url','$user_ip','$now','$comment','0')";
$result = mysql_query($query);
if (!$result)
die ("There is an error with the database, it can't store your comment...<br>Contact the <a href=\"mailto:$admin_email\">webmaster</a>");

if ($comments_notify) {

$notify_message = "New comment on your post #$comment_post_ID.\r\n\r\n";
$notify_message .= "author : $comment_author (IP: $user_ip , $user_domain)\r\n";
$notify_message .= "e-mail : $comment_author_email\r\n";
$notify_message .= "url : $comment_author_url\r\n";
$notify_message .= "comment: \n".stripslashes($original_comment)."\r\n\r\n";
$notify_message .= "You can see all comments on this post there: \r\n";
$notify_message .= $siteurl.'/'.$blogfilename.$querystring_start.'p'.$querystring_equal.$comment_post_ID.$querystring_separator.'c'.$querystring_equal.'1'."\r\n\r\n";

$postdata = get_postdata($comment_post_ID);
$authordata = get_userdata($postdata["Author_ID"]);
$recipient = $authordata["user_email"];
$subject = "comment on post #$comment_post_ID \"".$postdata["Title"]."\"";

@mail($recipient, $subject, $notify_message, "From: b2@".$HTTP_SERVER_VARS['SERVER_NAME']."\r\n"."X-Mailer: b2 $b2_version - PHP/" . phpversion());

}

if ($email == "") {
$email = " "; // this to make sure a cookie is set for 'no email'
}
if ($url == "") {
$url = " "; // this to make sure a cookie is set for 'no url'
}
setcookie("comment_author",$author, time()+30000000);
setcookie("comment_author_email",$email, time()+30000000);
setcookie("comment_author_url",$url, time()+30000000);

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
$location = (!empty($HTTP_POST_VARS['redirect_to'])) ? $HTTP_POST_VARS['redirect_to'] : $HTTP_SERVER_VARS["HTTP_REFERER"];
if ($is_IIS) {
header("Refresh: 0;url=$location");
} else {
header("Location: $location");
}
} else {
die("Sorry, you can only post a new comment every 30 seconds");
}

?>


I didn't know what I was looking for so I posted the whole thing. Does this help at all? As far as I remember I've never done anything to this page.
_________________
http://www.toby-girl.net/belly
Back to top
View user's profile Send private message
shellorz



Joined: 14 Sep 2004
Posts: 12
Location: France

PostPosted: Sun Sep 19, 2004 3:23 pm    Post subject: Reply with quote

Do you have some handful testing tools such as easy php ? It migth help.

You should test what is the value of $location = (!empty($HTTP_POST_VARS['redirect_to'])) ? $HTTP_POST_VARS['redirect_to'] : $HTTP_SERVER_VARS["HTTP_REFERER"];

(it means that if the POST variable "redirect_to" is set then the new location is this variable otherwise it would be the HTTP_REFERER , the page you came from.

To see what it values, insert a temporary "die ($location);" after this line.

Note : don't forget to always backup your files. It's more because it might soon become a mess rather than being irreversible. In the case it became too much of a mess, you could easily get back to the original version.
_________________
Make yourself at home but DON'T touch my Porn.
Back to top
View user's profile Send private message
shellorz



Joined: 14 Sep 2004
Posts: 12
Location: France

PostPosted: Sun Sep 19, 2004 3:42 pm    Post subject: Reply with quote

According to your FORM variables, the "redirect_to" value is
Code:

/belly/index.php?p=26&c=1


which means the page is in the belly folder which is at the root.
So the code of your index page is the one that matters now.

But you should still verify whether the comments have been added to your comment table in your database !
_________________
Make yourself at home but DON'T touch my Porn.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    boardom Forum Index -> Template help 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