Điều hành viên: Hỗ trợ NukeViet

function showcomm($sid) {. ""._ARTICLECONTENT."\n<a> | <a href=\"#\" onClick=\"MM_openBrWindow('modules.php?name=$module_name&file=comm&sid=$sid','','scrollbars=no,width=500,height=500')\" onMouseOut=\"window.status=''; return true;\" onMouseOver=\"window.status='"._COMMENTSQ."'; return true;\">"._COMMENTSQ."</a>\n</td>\n</tr>\n</table>\n". ""._ARTICLECONTENT."\n<a> | <a href=\"modules.php?name=".$module_name."&op=addcomment&sid=".$sid."\">"._COMMENTSQ."</a>\n</td>\n</tr>\n</table>\n" function viewst() {userbar($sid, $acomm, $comments);//Bo sung va fix loi bao mat
//---- the hien comments ----------------
if(!$acomm) {
if($articlecomm==1 OR ($articlecomm==2 AND defined('IS_USER'))) {
if(!isset($_SESSION['floodtime'])) {
$_SESSION['floodtime'] = 0;
}
if($comments) {
$all_page = $comments ? $comments : 1;
$perpage = 15;
$base_url = "modules.php?name=$module_name&op=viewst&sid=$sid";
$sql_comment = "SELECT tid, name, email, comment, MONTH(date) as month, DAYOFMONTH(date) as day, YEAR(date) as year FROM ".$prefix."_stories_comments WHERE sid='$sid' AND online='1' ORDER BY date DESC LIMIT $page, $perpage";
$res_comment = $db->sql_query($sql_comment);
if ($db->sql_numrows($res_comment) > 0) {
echo "<div align='center' class='A_white1' style='padding: 1px'><b>"._COMCON."</b></div><br>\n";
echo "<center><font class='tieudiem'>("._COMCONNO.")</font></center><br>\n";
echo "<div>\n";
echo "<table width='100%' border='1' bordercolor='#C0C0C0' cellpadding='3' style='border-collapse: collapse'>\n";
$k = $all_page - $page;
while($row_comment = $db->sql_fetchrow($res_comment)) {
echo "<tr>\n";
echo "<td bgcolor='#d5df55' align='left' class='tieudiem'><span>".$k." - ".stripslashes(trim($row_comment['name']))."</span> | <span><a class='tinmoi' href='mailto:".stripslashes(trim($row_comment['email']))."'>".stripslashes(trim($row_comment['email']))."</a></span> | <span align='right'>".intval($row_comment['day']).".".intval($row_comment['month']).".".intval($row_comment['year'])."</span></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td bgcolor='#d9ffff'>".stripslashes(trim($row_comment['comment']))."</td>\n";
echo "</tr>\n";
$k--;
}
echo "</table>\n";
echo "</div>\n";
if($all_page > $perpage){
echo "<div style='padding-top: 5px'>".generate_page($base_url,$all_page,$perpage,$page)."</div>\n";
}
echo "<div><hr style=\"border-style: dotted; border-width: 1px\"></div>\n";
}
}
//---- form thao luan ------
echo "<script language=\"Javascript\" type=\"text/javascript\">\n";
echo " var cfilter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;\n";
echo "function checkMail(field){\n";
echo " if (cfilter.test(field)) {\n";
echo " return true;\n";
echo " }\n";
echo " return false;\n";
echo "}\n";
echo "function checkformempty(form){\n";
echo " if(form.postname.value.length < 3 || form.postname.value.length > 50){\n";
echo " alert('"._ERCOM1."');\n";
echo " form.postname.focus();\n";
echo " return false;\n";
echo " }\n";
echo " if(checkMail(form.postemail.value)==false){\n";
echo " alert('"._ERCOM2."');\n";
echo " form.postemail.focus();\n";
echo " return false;\n";
echo " }\n";
echo " if(form.postcomment.value.length < 3){\n";
echo " alert('"._ERCOM3."');\n";
echo " form.postcomment.focus();\n";
echo " return false;\n";
echo " }\n";
if (extension_loaded("gd")) {
echo " if(form.gfxcomment.value.length != 6){\n";
echo " alert('"._SECCODEINCOR."');\n";
echo " form.gfxcomment.focus();\n";
echo " return false;\n";
echo " }\n";
}
echo " return true; \n";
echo "}\n";
echo "</script>\n";
echo "<form style='padding: 0px;margin: 0px;' action='modules.php?name=$module_name&op=addcomment&sid=$sid' onsubmit='return checkformempty(this);' method='post'>\n";
echo "<div align='center'>\n";
echo "<div class='A_white1' style='padding: 5px'><b>"._COMMTIT.":<br /><font class=\"tieude_vuaphai1\">".$title."</font></b></div>\n";
echo "<table bgcolor='#ccf0c1' width='100%' border='1' bordercolor='#C0C0C0' cellpadding='1' style='border-collapse: collapse'>\n";
if(!defined('IS_USER')) {
echo "<tr>\n";
echo "<td width=\"70\" align='center'><b>"._COMNAME." <font color=\"#ff0000\">*</font></b></td>\n";
echo "<td><input type='text' name='postname' id='postname' size='20' maxlength='50'> ("._COMNAMENOTE.")</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"70\" align='center'><b>"._COMMAIL."</b> <font color=\"#ff0000\">*</font></td>\n";
echo "<td><input type='text' name='postemail' id='postemail' size='20' maxlength='60'> ("._COMMAILNOTE.")</td>\n";
echo "</tr>\n";
} else {
global $mbrow;
echo "<tr>\n";
echo "<td width=\"70\" align='center'><b>"._COMNAME." <font color=\"#ff0000\">*</font></b></td>\n";
echo "<td><input type='hidden' name='postname' id='postname' value='".stripslashes(trim($mbrow['username']))."'><b>".stripslashes(trim($mbrow['username']))."</b></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"70\" align='center'><b>"._COMMAIL." <font color=\"#ff0000\">*</font></b></td>\n";
echo "<td><input type='hidden' name='postemail' id='postemail' value='".stripslashes(trim($mbrow['user_email']))."'><b>".stripslashes(trim($mbrow['user_email']))."</b></td>\n";
echo "</tr>\n";
}
echo "<tr>\n";
echo "<td width=\"70\" align='center'><b>"._COMMENTND." <font color=\"#ff0000\">*</font></b><BR>("._COMCONNOTE.")</td>\n";
echo "<td><textarea wrap='virtual' cols='65' rows='11' name='postcomment' id='postcomment'></textarea></td>\n";
echo "</tr>\n";
if (extension_loaded("gd")) {
mt_srand ((double)microtime()*1000000);
$maxran = 1000000;
$random_num = mt_rand(0, $maxran);
echo "<tr>\n";
echo "<td width=\"70\" align='center'><b>"._SECURITYCODE."</b></td>\n";
echo "<td><input type='hidden' name='random_num' value='$random_num'><img width=\"73\" height=\"17\" src='?gfx=gfx&random_num=$random_num' border='1' alt='"._SECURITYCODE."' title='"._SECURITYCODE."'></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"70\" align='center'><b>"._TYPESECCODE." <font color=\"#ff0000\">*</font></b></td>\n";
echo "<td><input type='text' name='gfxcomment' id='gfxcomment' size='11' maxlength='6'></td>\n";
echo "</tr>\n";
}
echo "<tr>\n";
echo "<td align='center' colspan='2'>\n";
echo "<input type='hidden' name='save' value='1'>\n";
echo "<input type='submit' name='submit' value='"._COMSUB."'></td>\n";
echo "</tr>\n";
echo "</table>\n</form>\n";
echo "</div>\n";
//---- //form thao luan ----
echo "<div><hr style=\"border-style: dotted; border-width: 1px\"><br></div>\n";
}
}
//---- //the hien comments --------------
function addcomment(){
function addcomment(){
global $db, $prefix, $module_name, $articlecomm, $client_ip, $commentcheck, $sitekey;
if(!$articlecomm OR ($articlecomm==2 AND !defined('IS_USER'))) {
Header("Location: modules.php?name=$module_name");
die();
}
$sid = intval($_GET['sid']);
if(!$sid) {
Header("Location: modules.php?name=$module_name");
die();
}
$result = $db->sql_query("SELECT title, acomm FROM ".$prefix."_stories WHERE sid=$sid");
if ($numrows = $db->sql_numrows($result) != 1) {
Header("Location: modules.php?name=$module_name");
die();
}
$row = $db->sql_fetchrow($result);
$acomm = intval($row['acomm']);
if($acomm) {
Header("Location: modules.php?name=$module_name");
die();
}
$random_num = intval($_POST['random_num']);
$gfxcomment = intval($_POST['gfxcomment']);
$postname = at_htmlspecialchars(strip_tags(trim($_POST['postname'])));
$postemail = strip_tags(trim($_POST['postemail']));
if(defined('IS_USER')) {
global $mbrow;
$postname = at_htmlspecialchars(trim($mbrow['username']));
$postemail = stripslashes(trim($mbrow['user_email']));
}
$postcomment = FixQuotes(trim($_POST['postcomment']));
$error = "";
$save = intval($_POST['save']);
if($save) {
if(!isset($_SESSION['floodtime'])) {
Header("Location: modules.php?name=$module_name&op=addcomment&sid=$sid");
die();
}
$floodtime = intval($_SESSION['floodtime']);
if(time() - $floodtime < 60) {
$error = _FLOODMESS;
}
if($error=="") {
if (extension_loaded("gd")) {
$datekey = date("F j");
$rcode = hexdec(md5($_SERVER[HTTP_USER_AGENT] . $sitekey . $random_num . $datekey));
$code = substr($rcode, 2, 6);
if ($code != $gfxcomment) {
$error = _SECCODEINCOR;
}
}
}
if($error=="") {
if (strlen($postname) < 3 || (strlen($postname) > 50)) {
$error = _ERCOM1;
} elseif(!eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,6}$",$postemail)) {
$error = _ERCOM2;
} elseif(strlen($postcomment) < 3) {
$error = _ERCOM3;
} else {
$date = date("Y-m-d H:i:s");
$online = ($commentcheck) ? 0 : 1;
$db->sql_query("INSERT INTO ".$prefix."_stories_comments VALUES (
NULL, '$sid', '$date', '$postname', '$postemail', '', '$client_ip', '', '$postcomment', '$online')");
if(!$commentcheck) {
$db->sql_query("UPDATE ".$prefix."_stories SET comments=comments+1 WHERE sid='$sid'");
}
$_SESSION['floodtime'] = time();
include("header.php");
echo "<META HTTP-EQUIV=\"refresh\" content=\"2;URL=modules.php?name=$module_name&op=viewst&sid=$sid\">\n";
echo "<div style='padding: 5px' align='center'><b>"._COMGOOD."</b></div>";
include("footer.php");
exit();
}
}
}
if(!isset($_SESSION['floodtime'])) {
$_SESSION['floodtime'] = 0;
}
$title = ($error!="") ? "<font color=\"#ff0000\">".$error."</font>" : _COMMTIT.':<br />'.stripslashes(check_html($row['title'], "nohtml"));
include("header.php");
//---- form thao luan ------
echo "<script language=\"Javascript\" type=\"text/javascript\">\n";
echo " var cfilter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;\n";
echo "function checkMail(field){\n";
echo " if (cfilter.test(field)) {\n";
echo " return true;\n";
echo " }\n";
echo " return false;\n";
echo "}\n";
echo "function checkformempty(form){\n";
echo " if(form.postname.value.length < 3 || form.postname.value.length > 50){\n";
echo " alert('"._ERCOM1."');\n";
echo " form.postname.focus();\n";
echo " return false;\n";
echo " }\n";
echo " if(checkMail(form.postemail.value)==false){\n";
echo " alert('"._ERCOM2."');\n";
echo " form.postemail.focus();\n";
echo " return false;\n";
echo " }\n";
echo " if(form.postcomment.value.length < 3){\n";
echo " alert('"._ERCOM3."');\n";
echo " form.postcomment.focus();\n";
echo " return false;\n";
echo " }\n";
if (extension_loaded("gd")) {
echo " if(form.gfxcomment.value.length != 6){\n";
echo " alert('"._SECCODEINCOR."');\n";
echo " form.gfxcomment.focus();\n";
echo " return false;\n";
echo " }\n";
}
echo " return true; \n";
echo "}\n";
echo "</script>\n";
echo "<form style='padding: 0px;margin: 0px;' action='modules.php?name=$module_name&op=addcomment&sid=$sid' onsubmit='return checkformempty(this);' method='post'>\n";
echo "<div align='center'>\n";
echo "<div class='A_white1' style='padding: 5px'><b>".$title."</b></div>\n";
echo "<table bgcolor='#ccf0c1' width='100%' border='1' bordercolor='#C0C0C0' cellpadding='1' style='border-collapse: collapse'>\n";
if(!defined('IS_USER')) {
echo "<tr>\n";
echo "<td width=\"70\" align='center'><b>"._COMNAME." <font color=\"#ff0000\">*</font></b></td>\n";
echo "<td><input type='text' name='postname' id='postname' value='$postname' size='20' maxlength='50'> ("._COMNAMENOTE.")</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"70\" align='center'><b>"._COMMAIL."</b> <font color=\"#ff0000\">*</font></td>\n";
echo "<td><input type='text' name='postemail' id='postemail' value='$postemail' size='20' maxlength='60'> ("._COMMAILNOTE.")</td>\n";
echo "</tr>\n";
} else {
echo "<tr>\n";
echo "<td width=\"70\" align='center'><b>"._COMNAME." <font color=\"#ff0000\">*</font></b></td>\n";
echo "<td><input type='hidden' name='postname' id='postname' value='$postname'><b>".$postname."</b></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"70\" align='center'><b>"._COMMAIL." <font color=\"#ff0000\">*</font></b></td>\n";
echo "<td><input type='hidden' name='postemail' id='postemail' value='$postemail'><b>".$postemail."</b></td>\n";
echo "</tr>\n";
}
echo "<tr>\n";
echo "<td width=\"70\" align='center'><b>"._COMMENTND."</b><BR>("._COMCONNOTE.")</td>\n";
echo "<td><textarea wrap='virtual' cols='65' rows='11' name='postcomment' id='postcomment'>".$postcomment."</textarea></td>\n";
echo "</tr>\n";
if (extension_loaded("gd")) {
mt_srand ((double)microtime()*1000000);
$maxran = 1000000;
$random_num = mt_rand(0, $maxran);
echo "<tr>\n";
echo "<td width=\"70\" align='center'><b>"._SECURITYCODE."</b></td>\n";
echo "<td><input type='hidden' name='random_num' value='$random_num'><img width=\"73\" height=\"17\" src='?gfx=gfx&random_num=$random_num' border='1' alt='"._SECURITYCODE."' title='"._SECURITYCODE."'></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"70\" align='center'><b>"._TYPESECCODE." <font color=\"#ff0000\">*</font></b></td>\n";
echo "<td><input type='text' name='gfxcomment' id='gfxcomment' size='11' maxlength='6'></td>\n";
echo "</tr>\n";
}
echo "<tr>\n";
echo "<td align='center' colspan='2'>\n";
echo "<input type='hidden' name='save' value='1'>\n";
echo "<input type='submit' name='submit' value='"._COMSUB."'></td>\n";
echo "</tr>\n";
echo "</table>\n</form>\n";
echo "</div>\n";
//---- //form thao luan ----
include("footer.php");
}
switch($op) {//test them phan quan ly gop yes
function Commentadmin(){
global $adminfile, $db, $prefix;
include("../header.php");
newstopbanner();
OpenTable();
echo "<div align='center'><b>"._COMMENTADMIN."</b></div>\n";
CloseTable();
echo "<br>";
OpenTable();
$sql_comno = "SELECT a.tid as tid, a.sid as sid, a.name as name, b.title as title FROM ".$prefix."_stories_comments a, ".$prefix."_stories b WHERE b.sid=a.sid AND a.online=0 ORDER BY a.date DESC";
$res_comno = $db->sql_query($sql_comno);
echo "<table width='100%' border='0' cellpadding='5' style='border-collapse: collapse'>\n";
echo "<tr>\n";
echo "<td align='center'><b>"._COMMNO."</b></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align='center'>\n";
echo "<table width='90%' border='1' cellpadding='3' cellspacing='1' style='border-collapse: collapse'>\n";
echo "<tr>\n";
echo "<td width='26' align='center'><b>STT</b></td>\n";
echo "<td width='100' align='center'><b>"._COMMNAME."</b></td>\n";
echo "<td align='center'><b>"._COMMTITLE."</b></td>\n";
echo "<td width='90' align='center'><b>"._FUNCTIONS."</b></td>\n";
echo "</tr>\n";
$j=1;
while($row_comno = $db->sql_fetchrow($res_comno)){
echo "<tr>\n";
echo "<td align='center'>$j</td>\n";
echo "<td>".$row_comno['name']."</td>\n";
echo "<td>".$row_comno['title']."</td>\n";
//echo "<td align='center'><a href='".$adminfile.".php?op=Commentche&id=".$row_comno['tid']."'>"._COMMCHE."</a> | <a href='".$adminfile.".php?op=Commentdel&id=".$row_comno['tid']."'>"._DELETE."</a></td>\n";
//Cho phep admin chinh sua truoc khi dang
echo "<td align='center'><a href='".$adminfile.".php?op=Commentche&id=".$row_comno['tid']."'>"._COMMCHE."</a> | <a href='".$adminfile.".php?op=EditStoriesComment&tid=".$row_comno['tid']."'>"._EDIT."</a> | <a href='".$adminfile.".php?op=Commentdel&id=".$row_comno['tid']."'>"._DELETE."</a></td>\n";
//end
echo "</tr>\n";
$j++;
}
echo "</table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
CloseTable();
echo "<br>";
OpenTable();
$num_comok = $db->sql_fetchrow($db->sql_query("SELECT COUNT(tid) FROM ".$prefix."_stories_comments WHERE online='1'"));
$all_page = $num_comok[0] ? $num_comok[0] : 1;
$page = isset($_GET['page']) ? intval($_GET['page']) : 0;
$perpage = 10;
$base_url = "".$adminfile.".php?op=Comment";
$sql_comok = "SELECT a.tid as tid, a.sid as sid, a.name as name, b.title as title FROM ".$prefix."_stories_comments a, ".$prefix."_stories b WHERE b.sid=a.sid AND a.online=1 ORDER BY a.date DESC LIMIT $page, $perpage";
$res_comok = $db->sql_query($sql_comok);
echo "<table width='100%' border='0' cellpadding='5' style='border-collapse: collapse'>\n";
echo "<tr>\n";
echo "<td align='center'><b>"._COMMOK."</b></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align='center'>\n";
echo "<table width='90%' border='1' cellpadding='3' cellspacing='1' style='border-collapse: collapse'>\n";
echo "<tr>\n";
echo "<td width='26' align='center'><b>STT</b></td>\n";
echo "<td width='100' align='center'><b>"._COMMNAME."</b></td>\n";
echo "<td align='center'><b>"._COMMTITLE."</b></td>\n";
echo "<td width='90' align='center'><b>"._FUNCTIONS."</b></td>\n";
echo "</tr>\n";
$i=1;
while($row_comok = $db->sql_fetchrow($res_comok)){
$stt = $i + $page;
echo "<tr>\n";
echo "<td align='center'>$stt</td>\n";
echo "<td>".$row_comok['name']."</td>\n";
echo "<td>".$row_comok['title']."</td>\n";
//echo "<td align='center'><a href='".$adminfile.".php?op=Commentche&id=".$row_comok['tid']."'>"._COMMCHE2."</a> | <a href='".$adminfile.".php?op=Commentdel&id=".$row_comok['tid']."'>"._DELETE."</a></td>\n";
//Cho phep admin chinh sua truockhi dang lai
echo "<td align='center'><a href='".$adminfile.".php?op=Commentche&id=".$row_comok['tid']."'>"._COMMCHE2."</a> | <a href='".$adminfile.".php?op=EditStoriesComment&tid=".$row_comok['tid']."'>"._EDIT."</a> | <a href='".$adminfile.".php?op=Commentdel&id=".$row_comok['tid']."'>"._DELETE."</a></td>\n";
//end
echo "</tr>\n";
$i++;
}
echo "</table>\n";
echo "</td>\n";
echo "</tr>\n";
if($all_page > $perpage){
echo "<tr>\n";
echo "<td>".generate_page($base_url,$all_page,$perpage,$page)."</td>\n";
echo "</tr>\n";
}
echo "</table>\n";
CloseTable();
include("../footer.php");
}
function Commentdel($tid){
global $db, $prefix, $adminfile;
$tid = intval(isset($_GET['id']) ? $_GET['id'] : $_POST['id']);
$sql_delcom = "SELECT sid,online FROM ".$prefix."_stories_comments WHERE tid=$tid";
$res_descom = $db->sql_query($sql_delcom);
$che_com = $db->sql_numrows($res_delcom);
if($che_com ==0 || $tid==""){
header("Location: ".$adminfile.".php?op=Comment");
}
list($sid,$comonline) = $db->sql_fetchrow($res_checom);//310508 - anhtu
$res_del = $db->sql_query("DELETE FROM ".$prefix."_stories_comments WHERE tid=$tid");
if($res_del){
if($comonline) {//310508
$db->sql_query("UPDATE ".$prefix."_stories SET comments=comments-1 WHERE sid='$sid'");
}//310508
info_exit("<center><b>"._COMMERR."</b></center><META HTTP-EQUIV=\"refresh\" content=\"2;URL=".$adminfile.".php?op=Comment\">");
}else{
info_exit("<center><b>"._COMMERR2."</b></center><META HTTP-EQUIV=\"refresh\" content=\"2;URL=".$adminfile.".php?op=Comment\">");
}
}
function Commentcheck($tid){
global $db, $prefix, $adminfile;
$tid = intval($_GET['id']);
$sql_checom = "SELECT name, email, comment, online FROM ".$prefix."_stories_comments WHERE tid='$tid'";
$res_checom = $db->sql_query($sql_checom);
$che_com2 = $db->sql_numrows($res_checom);
if($che_com2 ==0 || $tid==""){
header("Location: ".$adminfile.".php?op=Comment");
}
list($comname, $comemail, $comment, $comonline) = $db->sql_fetchrow($res_checom);
if($comonline ==1){
$checkcom1 = "checked";
$checkcom2 = "";
}else{
$checkcom2 = "checked";
$checkcom1 = "";
}
include("../header.php");
newstopbanner();
OpenTable();
echo "<table width='100%' border='0' cellpadding='5' style='border-collapse: collapse'>\n";
echo "<form action='' method='POST'><tr>\n";
echo "<td colspan='2' align='center'><b>"._COMMCHE3."</b></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align='right'><b>"._COMMNAME.":</b></td>\n";
echo "<td>$comname</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align='right'><b>Email:</b></td>\n";
echo "<td>$comemail</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align='right'><b>"._COMMKIEN.":</b></td>\n";
echo "<td>$comment</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align='right'><b>"._COMMALLOW."</b></td>\n";
echo "<td><input type='radio' name='comme' $checkcom1 value='1'>"._YES." <input type='radio' name='comme' $checkcom2 value='0'>"._NO."</td>\n";
echo "</tr>\n";
echo "<input type='hidden' name='id' value='$tid'>\n";
echo "<input type='hidden' name='op' value='Commentchetrue'>\n";
echo "<tr>\n";
echo "<td colspan='2' align='center'><input type='submit' value='"._OK."'> <input type='button' value='"._DELETE."' onclick=\"window.location='".$adminfile.".php?op=Commentdel&id=$tid'; return false\"></td>\n";
echo "</form></tr>\n";
echo "</table>\n";
CloseTable();
include("../footer.php");
}
function Commentchecktrue($tid){
global $db, $prefix, $adminfile;
$tid = intval($_POST['id']);
$comme = intval($_POST['comme']);
$res_updcom = $db->sql_query("UPDATE ".$prefix."_stories_comments SET online='$comme' WHERE tid='$tid'");
if($res_updcom){
list($sid) = $db->sql_fetchrow($db->sql_query("SELECT sid FROM ".$prefix."_stories_comments WHERE tid='$tid'"));//310508
$db->sql_query("UPDATE ".$prefix."_stories SET comments=comments+1 WHERE sid='$sid'");//310508
info_exit("<center><b>"._COMMERR3."</b></center><META HTTP-EQUIV=\"refresh\" content=\"2;URL=".$adminfile.".php?op=Comment\">");
}else{
info_exit("<center><b>"._COMMERR2."</b></center><META HTTP-EQUIV=\"refresh\" content=\"2;URL=".$adminfile.".php?op=Comment\">");
}
}
//end
//Bo sung
//---- the hien comments ----------------
if(!$acomm) {
if($articlecomm==1 OR ($articlecomm==2 AND defined('IS_USER'))) {
if(!isset($_SESSION['floodtime'])) {
$_SESSION['floodtime'] = 0;
}
if($comments) {
$all_page = $comments ? $comments : 1;
$perpage = 15;
$base_url = "modules.php?name=$module_name&op=viewst&sid=$sid";
$sql_comment = "SELECT tid, name, email, comment, host_name, MONTH(date) as month, DAYOFMONTH(date) as day, YEAR(date) as year FROM ".$prefix."_stories_comments WHERE sid='$sid' AND online='1' ORDER BY date DESC LIMIT $page, $perpage";
$res_comment = $db->sql_query($sql_comment);
if ($db->sql_numrows($res_comment) > 0) {
echo "<div align='center' class='A_white1' style='padding: 1px'><b>"._COMCON."</b></div><br>\n";
echo "<center><font class='tieudiem'>("._COMCONNO.")</font></center><br>\n";
echo "<div>\n";
echo "<table width='100%' border='1' bordercolor='#C0C0C0' cellpadding='3' style='border-collapse: collapse'>\n";
$k = $all_page - $page;
while($row_comment = $db->sql_fetchrow($res_comment)) {
echo "<tr>\n";
echo "<td bgcolor='#d5df55' align='left' class='tieudiem'><span>".$k." - ".stripslashes(trim($row_comment['name']))."</span> | <span><a class='tinmoi' href='mailto:".stripslashes(trim($row_comment['email']))."'>".stripslashes(trim($row_comment['email']))."</a></span> | <span>".intval($row_comment['day']).".".intval($row_comment['month']).".".intval($row_comment['year'])."</span></td>";
echo "</tr>\n";
echo "<tr>\n";
echo "<td bgcolor='#d9ffff'>".stripslashes(trim($row_comment['comment']))."";
if(defined('IS_ADMMOD')) {
global $adminfold, $adminfile;
$ip = ($row_comment['host_name']!="") ? "IP: ".trim($row_comment['host_name'])." | " : "";
echo "<br /><div class=\"tieudiem\" style=\"text-align:right\">".$ip."<a class=\"tieudiem\" href=\"".$adminfold."/".$adminfile.".php?op=EditStoriesComment&tid=".intval($row_comment['tid'])."\">"._EDIT."</a> | \n";
echo "<a class=\"tieudiem\" href=\"".$adminfold."/".$adminfile.".php?op=Commentdel&tid=".intval($row_comment['tid'])."\">"._DELETE."</a></div>\n";
}
echo "</td>\n";
echo "</tr>\n";
$k--;
}
echo "</table>\n";
echo "</div>\n";
if($all_page > $perpage){
echo "<div style='padding-top: 5px'>".generate_page($base_url,$all_page,$perpage,$page)."</div>\n";
}
echo "<div><hr style=\"border-style: dotted; border-width: 1px\"></div>\n";
}
}
//---- form thao luan ------
echo "<script language=\"Javascript\" type=\"text/javascript\">\n";
echo " var cfilter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;\n";
echo "function checkMail(field){\n";
echo " if (cfilter.test(field)) {\n";
echo " return true;\n";
echo " }\n";
echo " return false;\n";
echo "}\n";
echo "function checkformempty(form){\n";
echo " if(form.postname.value.length < 3 || form.postname.value.length > 50){\n";
echo " alert('"._ERCOM1."');\n";
echo " form.postname.focus();\n";
echo " return false;\n";
echo " }\n";
echo " if(checkMail(form.postemail.value)==false){\n";
echo " alert('"._ERCOM2."');\n";
echo " form.postemail.focus();\n";
echo " return false;\n";
echo " }\n";
echo " if(form.postcomment.value.length < 3){\n";
echo " alert('"._ERCOM3."');\n";
echo " form.postcomment.focus();\n";
echo " return false;\n";
echo " }\n";
if (extension_loaded("gd")) {
echo " if(form.gfxcomment.value.length != 6){\n";
echo " alert('"._SECCODEINCOR."');\n";
echo " form.gfxcomment.focus();\n";
echo " return false;\n";
echo " }\n";
}
echo " return true; \n";
echo "}\n";
echo "</script>\n";
echo "<form style='padding: 0px;margin: 0px;' action='modules.php?name=$module_name&op=addcomment&sid=$sid' onsubmit='return checkformempty(this);' method='post'>\n";
echo "<div align='center'>\n";
echo "<div class='A_white1' style='padding: 5px'><b>"._COMMTIT.":<br /><font class=\"tieude_vuaphai1\">".$title."</font></b></div>\n";
echo "<table bgcolor='#ccf0c1' width='100%' border='1' bordercolor='#C0C0C0' cellpadding='1' style='border-collapse: collapse'>\n";
if(!defined('IS_USER')) {
echo "<tr>\n";
echo "<td width=\"70\" align='center'><b>"._COMNAME." <font color=\"#ff0000\">*</font></b></td>\n";
echo "<td><input type='text' name='postname' id='postname' size='20' maxlength='50'> ("._COMNAMENOTE.")</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"70\" align='center'><b>"._COMMAIL."</b> <font color=\"#ff0000\">*</font></td>\n";
echo "<td><input type='text' name='postemail' id='postemail' size='20' maxlength='60'> ("._COMMAILNOTE.")</td>\n";
echo "</tr>\n";
} else {
global $mbrow;
echo "<tr>\n";
echo "<td width=\"70\" align='center'><b>"._COMNAME." <font color=\"#ff0000\">*</font></b></td>\n";
echo "<td><input type='hidden' name='postname' id='postname' value='".stripslashes(trim($mbrow['username']))."'><b>".stripslashes(trim($mbrow['username']))."</b></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"70\" align='center'><b>"._COMMAIL." <font color=\"#ff0000\">*</font></b></td>\n";
echo "<td><input type='hidden' name='postemail' id='postemail' value='".stripslashes(trim($mbrow['user_email']))."'><b>".stripslashes(trim($mbrow['user_email']))."</b></td>\n";
echo "</tr>\n";
}
echo "<tr>\n";
echo "<td width=\"70\" align='center'><b>"._COMMENTND." <font color=\"#ff0000\">*</font></b><BR>("._COMCONNOTE.")</td>\n";
echo "<td><textarea wrap='virtual' cols='65' rows='11' name='postcomment' id='postcomment'></textarea></td>\n";
echo "</tr>\n";
if (extension_loaded("gd")) {
mt_srand ((double)microtime()*1000000);
$maxran = 1000000;
$random_num = mt_rand(0, $maxran);
echo "<tr>\n";
echo "<td width=\"70\" align='center'><b>"._SECURITYCODE."</b></td>\n";
echo "<td><input type='hidden' name='random_num' value='$random_num'><img width=\"73\" height=\"17\" src='?gfx=gfx&random_num=$random_num' border='1' alt='"._SECURITYCODE."' title='"._SECURITYCODE."'></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"70\" align='center'><b>"._TYPESECCODE." <font color=\"#ff0000\">*</font></b></td>\n";
echo "<td><input type='text' name='gfxcomment' id='gfxcomment' size='11' maxlength='6'></td>\n";
echo "</tr>\n";
}
echo "<tr>\n";
echo "<td align='center' colspan='2'>\n";
echo "<input type='hidden' name='save' value='1'>\n";
echo "<input type='submit' name='submit' value='"._COMSUB."'></td>\n";
echo "</tr>\n";
echo "</table>\n</form>\n";
echo "</div>\n";
//---- //form thao luan ----
echo "<div><hr style=\"border-style: dotted; border-width: 1px\"><br></div>\n";
}
}
//---- //the hien comments --------------





xiketuan đã viết:ngặt nổi ko có phần chỉnh sửa
xiketuan đã viết:nếu mà có thêm chức năng ngăn chặn được spam mới là nhất
xiketuan đã viết:nếu ANh Tú chỉ thêm cho phần để admin có trả lời cái phản hồi người xem thì thật là tuyệt


tienviet đã viết:To anh tu: Đã hoàn thiện phần sửa chữa của admin rồi đó. Hic
To xiketuan: các vấn đề bạn đặt ra đã được hoàn thiện
cái này có phần cho Admin trả lời cái phản hồi của người xem không...

AnhTu đã viết:...
- Sẽ rất thuận tiện nếu thêm các nút sau đây dành cho admin ở mỗi comment: IP tác giả | Sửa | Xóa...












Quay về Hỗ trợ NukeViet 2.0 beta
Đang xem chuyên mục này: Không có thành viên nào đang trực tuyến và 2 khách