欢迎访问 舍力博客(www.shuyong.net)
function isCommentExist($blogId, $name, $content) { $data = $this->db->once_fetch_array("SELECT COUNT(*) AS total FROM ".DB_PREFIX."comment WHERE gid=$blogId AND poster='$name' AND comment='$content'"); if ($data['total'] > 0) { return true; }else { return false; } }在其后面加入代码
function dqname($blogId,$name){$data = $this->db->once_fetch_array("SELECT COUNT(*) AS total FROM ".DB_PREFIX."comment WHERE gid=$blogId AND poster='$name'");if($data['total'] > 0){return true;}else{return false;}}//昵称 function dqurl($blogId,$url){$data = $this->db->once_fetch_array("SELECT COUNT(*) AS total FROM ".DB_PREFIX."comment WHERE gid=$blogId AND url='$url'");if($data['total'] > 0){return true;}else{return false;}}//网址2、在include/controller/comment_controller.php文件中找到
} elseif ($Comment_Model->isCommentExist($blogId, $name, $content) === true) { emMsg('评论失败:已存在相同内容评论');在其后面加入代码
} elseif ($Comment_Model->dqname($blogId,$name) === true) { emMsg('提交失败:你提交的【网站名称】已经存在,请不要重复提交'); } elseif ($Comment_Model->dqurl($blogId,$url) === true) { emMsg('提交失败:你提交的【网站地址】已经存在,请不要重复提交,');重用就搞定了,大家防代码的时候要注意闭合哦,有问题请在本页反馈。第二步中的$blogId 可以直接改为对应的文章ID
留言/评论:◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。