January 06 2009 12:38:29
Navigation
Last Seen Users
JoshileyOnline
skorpion31Online
gregoryOnline
LookMovieOnline
elyn< 5 mins
sathishIPL< 5 mins
breker< 5 mins
Ashvinmax< 5 mins
Chesus00:06:23
xa0s00:13:35

Guests Online: 0
Registered Members: 3,621
Newest Member: Colognechaser
Downloads v7
Currently popular Downloads

Professional Down... 543
Extended Profile 502
FusionBoard 4 473
Photoalbum Mass U... 470
Avatar Studio 450
HighSlide Gallery... 416
Photo in Profile 400
VArcade 1.7 388
Wap Mod 360
Who Is Online Adm... 337

Latest Downloads


Login Redirect 5
Apache Errors Mod 3
View & Delete all Co... 0
Mod "index.php + mod... 3
Comments Management 2
FB Latest Referrers ... 8
Slideshow Lightbox P... 10
RSS and Panel 11
Secure Admin Login 21
SQL Injection Block 22
Downloads v6
Currently popular Downloads

Video Gallery 376
EXTboard 362
Extreme Theme Editor 341
Icon Package 2.0 290
Banner System v2.0.4 284
Tabbed welcome panel 281
Fuzed Shoutbox 276
Extended Profile ... 272
News.php 265
Header Banner System 221

Latest Downloads


Login Redirect 0
Mod "index.php + mod... 0
Base Games 1
Banner exchange system 0
Poll with comments a... 88
Media Streamer 5
v6.01.18 FULL 14
v6.01.16 - v6.01.17 44
v6.01.15 - v6.01.16 1
v6.01.17 - v6.01.18 8
Provider
PHPfusion-mods.net is hosted at:

110MB
Online Stats
Guests online: 4
Members online:
gregory, Joshiley, LookMovie, skorpion31

registered members: 3621
newest member: Colognechaser

user today: 3514
user online: 8
Max. onlinerecord: 43
Max. per day: 5705
user yesterday: 4842
user month: 27706
Entire users: 101489

last 24h:
























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 :)
Comments
#3webadmin88 on August 24 2008 20:52:49
Thank you- I am really proud with this one =)
#2Diemux on August 07 2008 14:48:46
Issue resolved with correct code. Article updated.
#1Diemux on August 04 2008 14: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! 75% [3 Votes]
Very Good Very Good 0% [No Votes]
Good Good 0% [No Votes]
Average Average 0% [No Votes]
Poor Poor 25% [1 Vote]
Login
Username

Password



Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
Our Coders
Rizald 'Elyn' Maxwell
Diemux
Donate

Affiliates:
Venue

Shoutbox
You must login to post a message.

06/01/2009 10:14
@diemux - i've upload my mod.. with updates..

06/01/2009 09:57
just submit again, I will check both Smile

06/01/2009 06:21
how to update my uploaded mod here? i forgot to attached the images

06/01/2009 03:42
Mod "index.php + mod panels" doenst have a install.php as said on readme file

06/01/2009 01:00
Cheers!

05/01/2009 23:27
Bye!

05/01/2009 20:01
Helloy Bye!

05/01/2009 17:58
kkcafe : lol. yes i am

05/01/2009 17:30
owh.. elyn, are u Malaysian?

05/01/2009 16:26
lol. i am reading Malay in some threads. @diemux: no, its not me..

Advertiser
One-click Translation
Translate This Site

Render time: 0.23 seconds 471,770 unique visits