November 21 2008 00:46:19 Home | Mod Downloads v6 | Mod Downloads v7 | Support Forum | Useful Resources | Articles | Dev log
 
Navigation
Home
Home
Articles
Search

Community
Mod Downloads v6
Mod Downloads v7
Support Forum
Contact Us

Information
News Categories
Useful Resources
Photo Gallery
Dev log
Site Map
Last Seen Users
GhostRider2007< 5 mins
Thijs< 5 mins
rUMENcho00:11:35
limon00:12:13
Massa00:15:49
rodjak00:16:30
dallas00:29:56
UniCoRN00:31:59
rudik00:34:45
baz00:40:48

Guests Online: 0
Registered Members: 2,573
Newest Member: rushqone
Latest Articles
Admin Control Panel Protection
How to Secure Your Importan...
Show Content by Default Use...
v7 | Add social bookmark to...
v7 | Custom MySQL error mes...
How To: A PM after registra...
v7 | SEO friendly URL's for...
v7 | SEO friendly URL's for...
Comments Advanced View and ...
Auto-redirect to the page v...
A tour through PHP-Fusion v...
Upgrading to PHP-Fusion v7 ...
SEO | Improve your PHP-Fusi...
Advertisements in article f...
Improving your photogallery...

View all articles
Downloads v7
Currently popular Downloads

Professional Downloa... 344
Extended Profile 330
Photoalbum Mass Upload 297
Photo in Profile 289
FusionBoard 4 278
HighSlide Gallery In... 274
Avatar Studio 257
Wap Mod 235
VArcade 1.7 226
Download System mSF 220

Latest Downloads


PHP-Fusion v7 Bosnia... 1
Memberlist with avatar 25
Orders script 9
Unactivated Users li... 6
Forum Ad Bot Agent 14
catsbyR5 news catego... 5
Qrmiz new category i... 3
Qrmiz news category ... 1
Clean set of news ca... 1
News Category Images... 0
Downloads v6
Currently popular Downloads

EXTboard 322
Video Gallery 302
Extreme Theme Editor 280
Icon Package 2.0 233
Fuzed Shoutbox 225
News.php 225
Tabbed welcome panel 221
Extended Profile 2.20 217
Header Banner System 177
Seoname.php 165

Latest Downloads


ExtBoard 1.1 67
Forum Attachment Admin 1
Extended User Search 1
CCMail Infusion 1
Advanced Search 92
Expose Photogallery 80
Who is online | Admin 110
Mark Threads As Read 2 10
Forum look without s... 46
Banner System v2.0.4 165
Provider
PHPfusion-mods.net is hosted at:

Security System 1.8.5 © 2006 by BS-Fusion Deutschland
CTracker - cback.de


Comments Advanced View and Anti-Spam Captcha Image
Here is a small modification that I've made to the php fusion so that we can enjoy a fully functional well displayed paged COMMENTS (15 per page) + captcha image anti-spam protection and not this a bit silly math calculation....

First of all you have to edit files so make a copy before editing each one. Now let's stick to the business:

**************************
Open your includes/comments_include.php and replace the code within with this one:

<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright  2002 - 2005 Nick Jones
| http://www.php-fusion.co.uk/
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------+
| Comments system developed by CrappoMan
| email: simonpatterson@dsl.pipex.com
+----------------------------------------------------*/
if (!defined("IN_FUSION")) { header("Location:../index.php"); exit; }

include LOCALE.LOCALESET."comments.php";

function showcomments($ctype,$cdb,$ccol,$cid,$clink,$rowstartt) {

    global $settings,$locale,$userdata,$aidlink;
    

    if (isset($_POST['post_comment'])) {
global $settings,$locale,$userdata,$aidlink;


if (isset($_POST['post_comment'])) {
if (dbrows(dbquery("SELECT $ccol FROM ".DB_PREFIX."$cdb WHERE $ccol='$cid'"))==0) {
fallback(BASEDIR."index.php");
}
if (iMEMBER) {
$comment_name = $userdata['user_id'];
} elseif ($settings['guestposts'] == "1") {
$comment_name = trim(stripinput($_POST['comment_name']));
$comment_name = preg_replace("(^[0-9]*)", "", $comment_name);
if (isNum($comment_name)) $comment_name="";
}
$comment_message = trim(stripinput(censorwords($_POST['comment_message'])));
$comment_smileys = isset($_POST['disable_smileys']) ? "0" : "1";
if ($comment_name != "" && $comment_message != "") {
if (!check_captcha($_POST['captcha_encode'], $_POST['captcha_code'])) {
if (checkrights("C")) {
$result = dbquery("INSERT INTO ".DB_PREFIX."comments VALUES('', '$cid', '$ctype', '$comment_name', '$comment_message', '$comment_smileys', '".time()."', '".USER_IP."')");
redirect($clink);
}
else { $error .= "· <span class='alt'><b>Please enter correct verification code!</b></span><br />\n"; }
}
else {
$result = dbquery("INSERT INTO ".DB_PREFIX."comments VALUES('', '$cid', '$ctype', '$comment_name', '$comment_message', '$comment_smileys', '".time()."', '".USER_IP."')");
redirect($clink);
}
}
}
} else {
$invalid = true;
$comment_message2 = trim(stripinput(censorwords($_POST['comment_message'])));
}

    tablebreak();
    $rows = dbrows(dbquery("SELECT tcm.*,user_name FROM ".DB_PREFIX."comments tcm
        LEFT JOIN ".DB_PREFIX."users tcu ON tcm.comment_name=tcu.user_id
        WHERE comment_item_id='$cid' AND comment_type='$ctype'
        ORDER BY comment_datestamp DESC")); // Ausgabe der Anzahl an Threads no sticky
    if (!isset($rowstartt) || !isNum($rowstartt)) $rowstartt = 0;
    if ($rows==0) $rowstartt = 0;
    opentable($locale['c100']);
    if ($rows > 15) {
        echo "<table cellspacing='1' cellpadding='0' border='0' width='100%'><tr><td valign='bottom'>";
        $clink2 = str_replace('.htm','',$clink);
        echo forumpagenav($rowstartt,15,$rows,3,$clink2)."</td></tr></table>\n";
    }
    $result10 = dbquery(
        "SELECT tcm.*,user_name FROM ".DB_PREFIX."comments tcm
        LEFT JOIN ".DB_PREFIX."users tcu ON tcm.comment_name=tcu.user_id
        WHERE comment_item_id='$cid' AND comment_type='$ctype'
        ORDER BY comment_datestamp DESC LIMIT ".$rowstartt.", 15"
    );
    if (dbrows($result10) != 0) {
        $i = 0;
        echo "<table width='100%' cellpadding='0' cellspacing='1' class='tbl-border'>\n";
        while ($data = dbarray($result10)) {
            echo "<tr>\n<td class='".($i% 2==0?"tbl1":"tbl2")."'><span class='comment-name'>\n";
            if ($data['user_name']) {
                echo "<a href='".BASEDIR.seoname($data['user_name'])."-user".$data['comment_name'].".htm'>".$data['user_name']."</a>";
            } else {
                echo $data['comment_name'];
            }
            if ($data['comment_smileys'] == "1") {
                $comment_message = parsesmileys($data['comment_message']);
            } else {
                $comment_message = $data['comment_message'];
            }
            $comment_message = nl2br(parseubb($comment_message));
            echo "</span>\n<span class='small'>".$locale['041'].showdate("longdate", $data['comment_datestamp'])."</span><br>\n";
            echo $comment_message."</td>\n</tr>\n";
            $i++;
        }
        if (checkrights("C")) echo "<tr>\n<td align='right' class='".($i% 2==0?"tbl1":"tbl2")."'><a href='".ADMIN."comments.php".$aidlink."&ctype=$ctype&cid=$cid'>".$locale['c106']."</a></td>\n</tr>\n";        
        echo "</table>\n";
        if ($rows > 15) {
        echo "<table cellspacing='1' cellpadding='0' border='0' width='100%'><tr><td valign='bottom'>";
        $clink2 = str_replace('.htm','',$clink);
        echo forumpagenav($rowstartt,15,$rows,3,$clink2)."</td></tr></table>\n";
    }
    } else {
        echo $locale['c101']."\n";
    }
    closetable();
    tablebreak();


    opentable($locale['c102']);
    if (iMEMBER || $settings['guestposts'] == "1") {
        echo "<p align='center'><font color='red'>".$error."</font></p>";
        echo "<form name='inputform' method='post' action='$clink'>
<table align='center' cellspacing='0' cellpadding='0' class='tbl'>\n";
        if (iGUEST) {
            echo "<tr>
<td>".$locale['c103']."</td>
</tr>
<tr>
<td><input type='text' name='comment_name' maxlength='50' class='textbox' style='width:100%;'></td>
</tr>\n";
        }
        echo "<tr>
<td align='center'><textarea name='comment_message' rows='6' class='textbox' style='width:400px'>"; if($invalid) echo $comment_message2; echo"</textarea><br>
<input type='button' value='b' class='button' style='font-weight:bold;width:25px;' onClick=\"addText('comment_message', '[b]', '[/b]');\">
<input type='button' value='i' class='button' style='font-style:italic;width:25px;' onClick=\"addText('comment_message', '[i]', '[/i]');\">
<input type='button' value='u' class='button' style='text-decoration:underline;width:25px;' onClick=\"addText('comment_message', '[u]', '[/u]');\">
<input type='button' value='url' class='button' style='width:30px;' onClick=\"addText('comment_message', '[url]', '[/url]');\">
<input type='button' value='mail' class='button' style='width:35px;' onClick=\"addText('comment_message', '[mail]', '[/mail]');\">
<input type='button' value='img' class='button' style='width:30px;' onClick=\"addText('comment_message', '[img]', '[/img]');\">
<input type='button' value='center' class='button' style='width:45px;' onClick=\"addText('comment_message', '[center]', '[/center]');\">
<input type='button' value='small' class='button' style='width:40px;' onClick=\"addText('comment_message', '[small]', '[/small]');\">
<input type='button' value='code' class='button' style='width:40px;' onClick=\"addText('comment_message', '[code]', '[/code]');\">
<input type='button' value='quote' class='button' style='width:45px;' onClick=\"addText('comment_message', '[quote]', '[/quote]');\">
<br><br>
".displaysmileys("comment_message")."
</td>
</tr>
<tr><td class='tbl' align='left'><b>Anti-Spam Code:</b>    ".make_captcha()."</tr>
<tr><td class='tbl' align='left'><b>Enter Anti-Spam Code:</b><input type='text' name='captcha_code' class='textbox' width='100'></td></td></tr>
<tr>
<td align='center'><input type='checkbox' name='disable_smileys' value='1'>".$locale['c107']."<br><br>
<input type='submit' name='post_comment' value='".$locale['c102']."' class='button'></td>
</tr>
</table>
</form>\n";
    } else {
        echo $locale['c105']."\n";
    }
    closetable();
}
?>


Save, Close and Upload file.

*************************

Open maincore.php and find the following line:

function makepagenav($start,$count,$total,$range=0,$link=""){

ABOVE this line, place the following:

function commentpagenav($start,$count,$total,$range=0,$link=""){
global $locale;
if ($link == "") $link = FUSION_SELF."?";
$res="";
$pg_cnt=ceil($total / $count);
if ($pg_cnt > 1) {
$idx_back = $start - $count;
$idx_next = $start + $count;
$cur_page=ceil(($start + 1) / $count);
$res.="<table cellspacing='1' cellpadding='1' border='0' class='tbl-border'>\n<tr>\n";
$res.="<td class='tbl2'><span class='small'>".$locale['052']."$cur_page".$locale['053']."$pg_cnt</span></td>\n";
if ($idx_back >= 0) {
if ($cur_page > ($range + 1)) $res.="<td class='tbl2'><a class='small' href='$link"."rowstartt=0'><<</a></td>\n";
$res.="<td class='tbl2'><a class='small' href='$link"."rowstartt=$idx_back'><</a></td>\n";
}
$idx_fst=max($cur_page - $range, 1);
$idx_lst=min($cur_page + $range, $pg_cnt);
if ($range==0) {
$idx_fst = 1;
$idx_lst=$pg_cnt;
}
for($i=$idx_fst;$i<=$idx_lst;$i++) {
$offset_page=($i - 1) * $count;
if ($i==$cur_page) {
$res.="<td class='tbl1'><span class='small'><b>$i</b></span></td>\n";
} else {
$res.="<td class='tbl1'><a class='small' href='$link"."rowstartt=$offset_page'>$i</a></td>\n";
}
}
if ($idx_next < $total) {
$res.="<td class='tbl2'><a class='small' href='$link"."rowstartt=$idx_next'>></a></td>\n";
if ($cur_page < ($pg_cnt - $range)) $res.="<td class='tbl2'><a class='small' href='$link"."rowstartt=".($pg_cnt-1)*$count."'>>></a></td>\n";
}
$res.="</tr>\n</table>\n";

}
return $res;
}

*************************

Ok done, now in order to display your comments correctly, all you have to do is lets say to open readarticle.php

Find the line that includes comments include (looks like this):

if ($data['article_allow_comments']) showcomments("A","articles","article_id",$article_id,FUSION_SELF."?article_id=$article_id");

And add 6th parameter within the showcomments() function called $rowstartt like that:

if ($data['article_allow_comments']) showcomments("A","articles","article_id",$article_id,FUSION_SELF."?article_id=$article_id",$rowstartt);

You can do that on all pages on which you want to add comments, e.g. news.php, just add the $rowstartt 6th parameter and it will display correctly and etc...

*************************

Regards, Webadmin88

PS: For technical support regarding this mod, click here .

PS2: Please note that if you are a SuperAdministrator or Administrator, you don't have to fill out the anti-spam measure, I thought this is crucial when you are and admin LOL :)


Article Tags
Comments admin captcha security anti-spam spam tutorials work-around how-to how to PHP HTML PHP-Fusion v6
Comments
webadmin88 on August 24 2008 21:52:49
Thank you- I am really proud with this one =)
Diemux on August 07 2008 15:48:46
Issue resolved with correct code. Article updated.
Diemux on August 04 2008 15:46:53
Tried to implant this but got the following error:

Parse error: syntax error, unexpected T_ELSE in /home/undergro/public_html/includes/comments_include.php on line 51
Post Comment
Please Login to Post a Comment.
Ratings
Rating is available to Members only.

Please login or register to vote.

Awesome! Awesome! 100% [3 Votes]
Very Good Very Good 0% [No Votes]
Good Good 0% [No Votes]
Average Average 0% [No Votes]
Poor Poor 0% [No Votes]
Login
Username

Password



Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
PHP-Fusion Coders
Andrean Rashkov
Georgios
Diemux
Donate

Affiliates:


Shoutbox
You must login to post a message.

bullet Diemux 
20/11/2008 20:59
@sathishIPL: - I thought you meant the article (pm after registration). Anyhow, I have commented at the download.

bullet elyn 
20/11/2008 19:38
lol. diemux seems like an operator here. user : *dialed 1515-phpfusion-MODs operator (diemux) : for any enquiries.. please press 1 ... for *user press 1 operator(diemux) : for.. and it

bullet sathishIPL 
20/11/2008 15:29
I cant find .... as u said in article

bullet Diemux 
20/11/2008 12:32
Check the article comment please

bullet sathishIPL 
20/11/2008 10:35
Hi Diemux, The Mod Pm after Registration works for me...but i want to add the from ...where i can add thr from

Bullet Display More Shouts Bullet

bullet Diemux 
20/11/2008 02:12
@samaritean: - Check the "Orders script" in v7 downloads under Miscellaneous.

bullet Diemux 
20/11/2008 02:11
@gozoc, ratings is fixed, thanks . Couldn't find anything wrong with comments or redirect?

bullet samaritean 
19/11/2008 21:02
There is a infusion for sell cars ?To add cars in the forum as Infusion.

bullet gozoc 
19/11/2008 20:07
...and fix your redirect after post a shout to the download overview

bullet gozoc 
19/11/2008 20:06
diemux, please fix your download-ratings

Advertiser
One-click Translation

Powered by Google