Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Sign In
Not a member yet? Click here to register.

Comments View

Add this into a custom page to view all submitted comments to your site. Set for Admins only.

[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]<?php
| PHP-Fusion Content Management System
| Copyright © 2002 - 2011 Nick Jones
| \http://www.php-fusion.co.uk/
| Filename: comments_view.php
| Author: PHP-Fusion Addons Team
| Spam Rate by kneekoo
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at \www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).

if (!iADMIN) { redirect(BASEDIR."index.php"wink; }

require_once INCLUDES."bbcode_include.php";
include LOCALE.LOCALESET."comments.php";
$counter = (dbcount("(comment_id)", DB_COMMENTS));

if (!function_exists("spam_rating"wink) {
function spam_rating($text) {
global $settings;
$hits = 0;
$word_list = array("href=", "url=", "[url]", "buy", "viagra", "cialis", "granite", "sex", "amateur", "hire", "outdoor", "online", "estate", "realtor", "alcohol", "drug", "pizza", "trade", "trading", "lawyer", "grow", "backlink", "internet", "build", "packet", "rapid", "sell", "sale", "market", "loan", "credit", "mortgage", "degree", "diploma", "consult", "affiliat", "download", "advert", "promo", "prosper", "poker"wink;
if ($settings['bad_words_enabled'] == "1" && $settings['bad_words'] != "" ) {
foreach (explode("\r\n", $settings['bad_words']) as $word)
$word_list[] = $word;
$count = count($word_list);
for ($i=0; $i < $count; $i++) {
preg_match_all("#".$word_list[$i]."#i", $text, $matches);
$hits += count($matches[0]);
return $hits;

if (isset($_GET['rowstart']) && isnum($_GET['rowstart'])) {
$rowstart = $_GET['rowstart'];
} else {
$rowstart = 0;

$result = dbquery("SELECT comment_id,
ORDER BY comment_datestamp
DESC LIMIT $rowstart,50

if (dbrows($result) != 0) {

echo "<table class='tbl-border' width='100%'>\n<tr>\n";
echo "<td class='tbl2'><b>ID</b></td>\n";
if (iADMIN && checkrights("M"wink) {
echo "<td class='tbl2'><b>Admin</b></td>\n";
echo "<td class='tbl2'><b>User</b></td>\n";
echo "<td class='tbl2'><b>View</b></td>\n";
echo "<td class='tbl2'><b>Message</b></td>\n";
echo "<td class='tbl2'><b>Spam Rate</b></td>\n";
echo "</tr>\n";

while ($data = dbarray($result)) {

$cell_color = ($i % 2 == 0 ? "tbl1" : "tbl2"wink;
echo "<tr>\n";
echo "<td class='$cell_color' align='center' valign='top'>".$data['comment_id']."</td>\n";

$user = $data['comment_name'];
$user_details = dbarray(dbquery("SELECT user_id, user_name, user_status FROM ".DB_USERS." WHERE user_id = '$user'"wink);

if (iADMIN && checkrights("M"wink)
{ echo "<td class='$cell_color' align='center' valign='top'><a href='".ADMIN."members.php".$aidlink."&amp;step=view&amp;user_id=".$data['comment_name']."' title='Members Admin' />
<img src='".IMAGES."admin.png' alt='' /></a></td>\n";
echo "<td class='$cell_color' valign='top'>".profile_link($data['comment_name'], $user_details['user_name'], $user_details['user_status'])."</td>\n";

if ($data['comment_type'] == 'A'wink { $comment_file = "articles"; $file_id = "article_id";}
elseif ($data['comment_type'] == 'N'wink {$comment_file = "news"; $file_id = "readmore"; }
elseif ($data['comment_type'] == 'P'wink {$comment_file = "photogallery"; $file_id = "photo_id"; }
elseif ($data['comment_type'] == 'C'wink {$comment_file = "viewpage"; $file_id = "page_id"; }
elseif ($data['comment_type'] == 'M'wink {$comment_file = "infusions/addondb/view"; $file_id = "addon_id"; }
elseif ($data['comment_type'] == 'AL'wink {$comment_file = "infusions/sf_admin_log_panel/log_view"; $file_id = "log_id"; }
else {$comment_file = ""; $file_id ="";}

echo "<td class='$cell_color' valign='top'><a href='".BASEDIR.$comment_file.".php?".$file_id."=".$data['comment_item_id']."' title='View Page'><img src='".IMAGES."view.png' alt='' /></a></td>\n";
echo "<td class='$cell_color' valign='top'>".nl2br(parseubb(parsesmileys($data['comment_message'])))."</td>\n";
echo "<td class='$cell_color' valign='top'>".spam_rating($data['comment_message'])."</td>\n</tr>\n";
echo "<td class='$cell_color' colspan='6' valign='top'><hr /></td>\n</tr>\n";

} else {
echo "<center>".$locale['c101']."</center>\n";
echo "</table>\n";

if ($counter > 50) echo "<div align='center' style=';margin-top:5px;'>\n".makepagenav($rowstart,50,$counter,3,FUSION_SELF."?page_id=".$_GET['page_id']."&amp;"wink."\n</div>\n";

Never realise this was here, Nice work Philip and other Staff involved in this its quite a useful thing to keep an eye on them spam comments.

Thank you Fellow Staff guys. ;)


Fangree_Craig wrote:
its quite a useful thing to keep an eye on them spam comments.

Yeah ! I agree with you ! Because, I have a lot of photos in my Clan website and sometimes, the Spammers post comments to the photos and Normally no one use to see the comment and even I cannot control the activity of members then :(

So it is quite Useful for me ! ;) Thanks For this :)
Just do something with registration, and viola - no spamers - no spam.
Quite easy.
Agree with Polar Fox.
Thread Information
6 posts
2934 times
Last Post
Last updated on 9 years ago
You can view all discussion threads in this forum.
You cannot set up a bounty in this discussion thread.
You can start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You can download attachments in this forum.
You cannot up or down-vote on the post in this discussion thread.
Users who participated in discussion: Craig, HobbyMan, PolarFox, Rolf Mayer, Ankur