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 

Comment Problem!

 
Post new topic   Reply to topic    boardom Forum Index -> Installation issues
View previous topic :: View next topic  
Author Message
fluffyland



Joined: 12 May 2004
Posts: 8

PostPosted: Sat Jul 03, 2004 4:30 am    Post subject: Comment Problem! Reply with quote

I was setting up Dodo's threaded comments script on my webbie. I followed all the instructions in the readme, and tried to reply to my own comment, but got an error. I figured it would be easier to retry everything than to find my own mistake, so I reverted to my backed up files of b2config.php, b2comments.php, b2comments.post.php, and b2-include/b2functions.php. Then I continued to get an error, even when posting regular comments, so I reuploaded every page of b2.. and I still can't comment.

I get this error:
Quote:
There is an error with the database, it can't store your comment...
Contact the webmaster


I'm tearing my hair out here.. I want my comments back!!
I'm not sure of another solution.. anyone have any bright ideas??
_________________
Sam
http://www.fluffyland.com


Last edited by fluffyland on Sun Jul 04, 2004 8:28 pm; edited 4 times in total
Back to top
View user's profile Send private message Visit poster's website AIM Address
fluffyland



Joined: 12 May 2004
Posts: 8

PostPosted: Sun Jul 04, 2004 8:20 pm    Post subject: Files Reply with quote

I've copied and pasted these files, in case it helps.

b2comments.php
Quote:

<?php // Do not delete these lines
if (basename($HTTP_SERVER_VARS["SCRIPT_FILENAME"]) == "b2comments.php")
die ("please, do not load this page directly");
if (($withcomments) or ($c)) {

$comment_author = (empty($HTTP_COOKIE_VARS["comment_author"])) ? "name" : $HTTP_COOKIE_VARS["comment_author"];
$comment_author_email = (empty($HTTP_COOKIE_VARS["comment_author"])) ? "email" : trim($HTTP_COOKIE_VARS["comment_author_email"]);
$comment_author_url = (empty($HTTP_COOKIE_VARS["comment_author"])) ? "http://url" : trim($HTTP_COOKIE_VARS["comment_author_url"]);

$queryc = "SELECT * FROM $tablecomments WHERE comment_post_ID = $id AND comment_content NOT LIKE '%<trackback />%' AND comment_content NOT LIKE '%<pingback />%' ORDER BY comment_date";
$resultc = mysql_query($queryc);
if ($resultc) {
?>

<!-- you can start editing here -->

<a name="comments"></a>
<h2><font class="subject">Comments</font></h2>

<?php /* this line is b2's motor, do not delete it */ $wxcvbn_c=0; while($rowc = mysql_fetch_object($resultc)) { $wxcvbn_c++; $commentdata = get_commentdata($rowc->comment_ID); ?>

<a name="c<?php comment_ID() ?>"></a>

<!-- comment -->

<h2><?php comment_date() ?> @ <?php comment_time() ?></h2>
<b><?php comment_author() ?> <?php comment_author_email_link("@", " - ", "") ?><?php comment_author_url_link("url", " - ", "") ?></b>
<br />
<?php comment_text() ?>
<br />

<!-- /comment -->


<?php /* end of the loop, don't delete */ } if (!$wxcvbn_c) { ?>

<!-- this is displayed if there are no pingbacks so far -->
<p>There are no comments on this post so far, but I'd love it if you added one!</p>

<?php /* if you delete this the sky will fall on your head */ } ?>

<h2><font class="subject">Leave a comment?</font></h2>

<!-- form to add a comment -->

<form action="<?php echo $siteurl; ?>/b2comments.post.php" method="post">
<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
<input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars($HTTP_SERVER_VARS["REQUEST_URI"]); ?>" />

<p class="commentfield">
your name<br />
<input type="text" name="author" class="textarea" value="<?php echo $comment_author ?>" size="20" tabindex="1"
onfocus="this.value=(this.value=='name') ? '' : this.value;" onblur="this.value=(this.value=='') ? 'name' : this.value;" />
</p>

<p class="commentfield">
your email<br />
<input type="text" name="email" class="textarea" value="<?php echo $comment_author_email ?>" size="20" tabindex="2"
onfocus="this.value=(this.value=='email') ? '' : this.value;" onblur="this.value=(this.value=='') ? '@' : this.value;" />
</p>

<p class="commentfield">
your webbie<br />
<input type="text" name="url" class="textarea" value="<?php echo $comment_author_url ?>" size="20" tabindex="3"
onfocus="this.value=(this.value=='http://url') ? '' : this.value;" onblur="this.value=(this.value=='') ? 'http://' : this.value;" />
</p>

<p class="commentfield">
comment here!<br />
<textarea cols="40" rows="4" name="comment" tabindex="4" class="textarea"
onfocus="this.value=(this.value=='comment') ? '' : this.value;" onblur="this.value=(this.value=='') ? 'blah..' : this.value;" >blah..</textarea>
</p>

<p class="commentfield">
<input type="checkbox" name="comment_autobr" value="1" <?php
if ($autobr)
echo " checked=\"checked\"" ?> tabindex="6" /> Auto-BR (line-breaks become <br /> tags)<br /><br />
<input type="submit" name="submit" class="buttonarea" value="ok" tabindex="5" />
</p>

</form>

<!-- /form -->

<br />
<a href="javascript:history.go(-1)"><< back to main blog</a>
<br />
<?php // if you delete this the sky will fall on your head
}
} else {
return false;
}
?>


b2comments.post.php
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");
}

?>



b2config.php:
Quote:

<?php

/* *
* b2's config file *
* */


# Reminder: everything that starts with #, /* or // is a comment

/* Start editing */

# $siteurl is your blog's URL: for example, 'http://mydomain.com' (no trailing slash !)
# $blogfilename is the name of the default file for your blog
# $blogname is the name of your blog

$siteurl = 'http://fluffyland.com';
$blogfilename = 'index.php';
$blogname = "My Weblog";
$blogdescription = "babblings !";


# fill these only if you have a Cafelog ID,
# this enables your blog to be in the Recently Updated b2 blogs list.
# to obtain this ID, e-mail [email protected] with these details:
# name of the weblog, weblog's URL, your e-mail address, and a password
# in the future, the password will allow you to change these details online

$cafelogID = '';
$use_cafelogping = 0; # set this to 1 if you do have a Cafelog ID


# $pathserver is where you have uploaded b2: for example, 'http://mydomain.com' (no ending slash !)
# by default b2 is set to run in the folder your blog resides, same as $siteurl

$pathserver = 'http://fluffyland.com';


# your email (obvious uh ?)
$admin_email = '[email protected]';


# set this to 0 or 1, whether you want new users to be able to post entries once they registered
$new_users_can_blog = 0;


# set this to 0 or 1, whether you want to allow users to register on your blog.
$users_can_register = 0;


# day at the start of the week: 0 for Sunday, 1 for Monday, 2 for Tuesday, etc
$start_of_week = 0;



// ** MySQL settings **

# fill with your database details
$dbname = 'fluffyl_blog'; // the name of the database
$dbhost = 'localhost'; // 99% chances you won't need to change this value
$dbusername = 'fluffyl_fluffy'; // your MySQL username
$dbpassword = 'pepper'; // ...and password

# database tables' names (change them if you want to have multiple b2's in a single database)
$tableposts = 'b2posts';
$tableusers = 'b2users';
$tablesettings = 'b2settings';
$tablecategories = 'b2categories';
$tablecomments = 'b2comments';


// ** Post preview function **

# set this to 1 if you want to use the 'preview' function
$use_preview = 0;



// ** Spell Checker functions **


# set this to 0 to disable the spell checker, or 1 to enable it
$use_spellchecker = 1;



// ** Text formatting options **

# these options can help you format your text without using too much html
$use_bbcode = 0; // use BBCode, like bold
$use_gmcode = 0; // use GreyMatter-styles: **bold** \italic\ __underline__
$use_quicktags = 1; // buttons for HTML tags (they won't work on IE Mac yet)

# IMPORTANT! set this to 0 if you are using Chinese, Japanese, Korean,
# or other double-bytes languages
$use_htmltrans = 1;

# this could help balance your HTML code. if it gives bad results, set it to 0
$use_balanceTags = 1;

# this would convert quotes into smart/curly quotes, set it to 1 to enable it
$use_smartquotes = 0;


// ** Image upload **


# set this to 0 to disable file upload, or 1 to enable it
$use_fileupload = 0;

# enter the real path of the directory where you'll upload the pictures
# if you're unsure about what your real path is, please ask your host's support staff
# note that the directory must be writable by the webserver (ChMod 766)
# note for windows-servers users: use forwardslashes instead of backslashes
#$fileupload_realpath = '/home/your/site/b2/images';
$fileupload_realpath = '/home/example/public_html/images';

# enter the URL of that directory (it's used to generate the links to the pictures)
$fileupload_url = 'http://example.com/images';

# accepted file types, you can add to that list if you want
# note: add a space before and after each file type
# example: $fileupload_allowedtypes = ' jpg gif png ';
$fileupload_allowedtypes = ' jpg gif png ';

# by default, most servers limit the size of uploads to 2048 KB
# if you want to set it to a lower value, here it is (you cannot set a higher value)
$fileupload_maxk = '96';

# you may not want all users to upload pictures/files, so you can set a minimum level for this
$fileupload_minlevel = '1';

# ...or you may authorize only some users. enter their logins here, separated by spaces
# if you leave that variable blank, all users who have the minimum level are authorized to upload
# note: add a space before and after each login name
# example: $fileupload_allowedusers = ' barbara anne ';
$fileupload_allowedusers = '';



// ** RSS syndication options **

# these options are used by b2rdf.php (1.0), b2rss.php (0.92), and b2rss2.php (2.0)
# note: if you don't want to syndicate your news, you can delete these files

# number of last posts to syndicate
$posts_per_rss = 10;

# the language of your blog ( see this: http://backend.userland.com/stories/storyReader$16 )
$rss_language = 'en';

# for b2rss.php: allow encoded HTML in <description> tag? 1=yes, 0=no
$rss_encoded_html = 0;

# length (in words) of excerpts in the RSS feed? 0=unlimited
# note: in b2rss.php, this will be set to 0 if you use encoded HTML
$rss_excerpt_length = 50;



// ** Weblogs.com ping **

# set this to 1 if you want your site to be listed on http://weblogs.com when you add a new post
$use_weblogsping = 0;


// ** Blo.gs ping **

# set this to 1 if you want your site to be listed on http://blo.gs when you add a new post
$use_blodotgsping = 0;

# if you ping blo.gs, this is the URL that will be sent to it (enter your blog's URL):
$blodotgsping_url = 'http://fluffyland.com';



// ** Trackback / PingBack **

# set this to 0 or 1, whether you want to allow your posts to be trackback'able or not
# note: setting it to zero would also disable sending trackbacks
$use_trackback = 0;

# set this to 0 or 1, whether you want to allow your posts to be pingback'able or not
# note: setting it to zero would also disable sending pingbacks
$use_pingback = 0;



// ** Comments options **

# set this to 1 to require e-mail and name, or 0 to allow comments without e-mail/name
$require_name_email = 1;

# here is a list of the tags that are allowed in the comments.
# you can add tags to the list, just add them in the string,
# add only the opening tag: for example, only '<a>' instead of '<a href=""></a>'

$comment_allowed_tags = '<b><i><u><strong><em><code><blockquote><p><br><strike><a><img>';

# set this to 1 to let every author be notified about comments on their posts
$comments_notify = 0;



// ** Smilies options **

# set this to 1 to enable smiley conversion in posts
# (note: this makes smiley conversion in ALL posts)
$use_smilies = 1;

# the directory where your smilies are (no trailing slash)
$smilies_directory = 'http://fluffyland.com/b2-img/smilies';

# here's the conversion table, you can modify it if you know what you're doing
$b2smiliestrans = array(
'Smile' => 'icon_smile.gif',
'Very Happy' => 'icon_biggrin.gif',
'Very Happy' => 'icon_biggrin.gif',
'Very Happy' => 'icon_biggrin.gif',
'Smile' => 'icon_smile.gif',
'Smile' => 'icon_smile.gif',
'Smile' => 'icon_smile.gif',
'Sad' => 'icon_sad.gif',
'Sad' => 'icon_sad.gif',
'Sad' => 'icon_sad.gif',
'' => 'icon_surprised.gif',
'' => 'icon_surprised.gif',
'' => 'icon_surprised.gif',
'' => 'icon_confused.gif',
'' => 'icon_confused.gif',
'' => 'icon_confused.gif',
'o.o' => 'icon_eek.gif',
'LOL' => 'icon_lol.gif',
'' => 'icon_lol.gif',
'' => 'icon_mad.gif',
'' => 'icon_mad.gif',
'' => 'icon_mad.gif',
'Razz' => 'icon_razz.gif',
'Razz' => 'icon_razz.gif',
'Razz' => 'icon_razz.gif',
'' => 'icon_redface.gif',
'' => 'icon_cry.gif',
'' => 'icon_evil.gif',
'' => 'icon_twisted.gif',
'' => 'icon_rolleyes.gif',
'' => 'icon_wink.gif',
'' => 'icon_wink.gif',
'' => 'icon_wink.gif',
'' => 'icon_arrow.gif',
'Neutral' => 'icon_neutral.gif',
'Neutral' => 'icon_neutral.gif',
'Neutral' => 'icon_neutral.gif',
);


# the weekdays and the months.. translate them if necessary

$weekday[0]='Sunday';
$weekday[1]='Monday';
$weekday[2]='Tuesday';
$weekday[3]='Wednesday';
$weekday[4]='Thursday';
$weekday[5]='Friday';
$weekday[6]='Saturday';


# the months, translate them if necessary - note: this isn't active everywhere yet
$month['01']='January';
$month['02']='February';
$month['03']='March';
$month['04']='April';
$month['05']='May';
$month['06']='June';
$month['07']='July';
$month['08']='August';
$month['09']='September';
$month['10']='October';
$month['11']='November';
$month['12']='December';



# $b2inc is where the included b2 files are: that's generally the directory b2-include,
# so you shouldn't have to change that setting
$b2inc = './b2-include';


// ** Querystring Configuration ** (don't change if you don't know what you're doing)

$querystring_start = '?';
$querystring_equal = '=';
$querystring_separator = '&';




// ** Configuration for b2mail.php ** (skip this if you don't intend to blog via email)

# mailserver settings
$mailserver_url = 'mail.fluffyland.com';
$mailserver_login = '[email protected]';
$mailserver_pass = 'pepper';
$mailserver_port = 110;

# by default posts will have this category
$default_category = 1;

# subject prefix
$subjectprefix = 'blog:';

# body terminator string (starting from this string, everything will be ignored, including this string)
$bodyterminator = "___";

# set this to 1 to run in test mode
$thisisforfunonly = 0;


### Special Configuration for some phone email services

# some mobile phone email services will send identical subject & content on the same line
# if you use such a service, set $use_phoneemail to 1, and indicate a separator string
# when you compose your message, you'll type your subject then the separator string
# then you type your login:password, then the separator, then content

$use_phoneemail = 0;
$phoneemail_separator = ':::';





/* Stop editing */


$HTTP_HOST=getenv('HTTP_HOST'); /* domain name */
$REMOTE_ADDR=getenv('REMOTE_ADDR'); /* visitor's IP */
$HTTP_USER_AGENT=getenv('HTTP_USER_AGENT'); /* visitor's browser */

$server = $dbhost;
$loginsql = $dbusername;
$passsql = $dbpassword;
$path = $pathserver;
$base = $dbname;

?>
[/b]
_________________
Sam
http://www.fluffyland.com
Back to top
View user's profile Send private message Visit poster's website AIM Address
Display posts from previous:   
Post new topic   Reply to topic    boardom Forum Index -> Installation issues 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