07-Jun-2014, 05:22 PM
hi! I'm testing a new installation with export/import sql..and seems to work fine..but the same code (2.4) return errors or nothing
<?php include("comments/latest_comments.php");?>
<?php include("comments/latest_comments.php");?>
PHP Code:
<?php
//define('IN_COMMENTICS', 'true');
require_once "includes/db/connect.php";
// Start of 'Recent Comments' **********************************************************************************************
$comments = mysql_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "comments` WHERE `is_approved` = '1' ORDER BY `dated` DESC LIMIT 5");
while ($comment = mysql_fetch_array($comments)) {
$page_query = mysql_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "pages` WHERE `id` = '" . $comment["page_id"] . "'");
$page = mysql_fetch_assoc($page_query);
$comment_snippet = $comment["comment"];
$comment_snippet = str_ireplace("<br />", " ", $comment_snippet);
$comment_snippet = str_ireplace("<p></p>", " ", $comment_snippet);
$comment_snippet = strip_tags($comment_snippet);
$comment_snippet = html_entity_decode($comment_snippet, ENT_QUOTES, 'UTF-8');
$comment_snippet = substr($comment_snippet, 0, 20);
$comment_snippet = htmlspecialchars($comment_snippet, ENT_NOQUOTES, 'UTF-8');
echo $comment["name"] . " in <a href='" . $page["url"] . "'>" . $page["reference"] . "</a> - " . $comment_snippet ."..";
echo "<br/>";
}
// End of 'Recent Comments' ************************************************************************************************
?>
Access Denied
PHP Code:
<?php
require_once "includes/db/connect.php";
// Start of 'Most Commented' ********************************************************
$comments = mysql_query("SELECT `page_id`, COUNT(`page_id`) AS `total` FROM `" . $cmtx_mysql_table_prefix . "comments` WHERE `is_approved` = '1' GROUP BY `page_id` ORDER BY `total` DESC LIMIT 1");
while ($comment = mysql_fetch_assoc($comments)) {
$page_query = mysql_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "pages` WHERE `id` = '" . $comment["page_id"] . "'");
$page = mysql_fetch_assoc($page_query);
//$n=$page["url"];
//$b="<strong><font color=#339900> $n </font></strong>";
echo "<a href='" . $page["url"] . "'>" . $page["reference"] . "</a> (" . $comment["total"] . ")";
}
?>