chk_in(); $action = isset($action) ? trim($action) : ''; $part = isset($part) ? trim($part) : ''; $id = isset($id) ? intval($id) : ''; $inajax = isset($inajax) ? intval($inajax) : ''; if (empty($id)) { exit('Access Denied!'); } if (!in_array($part, array('information', 'news', 'store'))) { write_msg('您提交的评论所属模块不能为空!'); } $dotphpurlarray = array('information' => 'information.php', 'news' => 'news.php', 'coupon' => 'coupon.php', 'group' => 'group.php'); $commentsettings = get_commentsettings(); if (!$commentsettings[$part]) { exit(); } if ($action == 'insert') { $_COOKIE['comment' . $part . $id] == 1 && write_msg('您的语速太快了,请休息一下再发表评论...'); if (!$iflogin && !($randcode = mymps_chk_randcode($checkcode))) { write_msg('验证码输入错误,请返回重新输入'); exit(); } empty($content) && write_msg('提交失败!评论内容不能为空!'); 255 < strlen($content) && write_msg('请不要填写超过127个汉字!'); if (!$iflogin) { switch ($commentsettings[$part]) { case 1: $userid = ''; break; case 2: $loginuser = $loginuser ? mhtmlspecialchars($loginuser) : ''; $loginpwd = $loginpwd ? mhtmlspecialchars($loginpwd) : ''; if (empty($loginuser)) { write_msg('请填写你的用户帐号!'); } if (empty($loginpwd)) { write_msg('请填写你的用户密码!'); } $loginpwd = md5($loginpwd); if (!($res = $db->getOne('SELECT id FROM `' . $db_mymps . 'member` WHERE userid = \'' . $loginuser . '\' AND userpwd = \'' . $loginpwd . '\''))) { unset($res); write_msg('你的帐号或密码输入错误,或不存在该用户!'); } else { $userid = $loginuser; $member_log->in($loginuser, $loginpwd, '', 'noredirect'); } break; } } else { $userid = $s_uid; } $result = verify_badwords_filter($mymps_global['cfg_if_comment_verify'], '', $content); $content = textarea_post_change($result['content']); $comment_level = $result['level']; $db->query('INSERT INTO `' . $db_mymps . 'comment` (typeid,content,pubtime,ip,comment_level,userid,type)VALUES(\'' . $id . '\',\'' . $content . '\',\'' . $timestamp . '\',\'' . GetIP() . ('\',\'' . $comment_level . '\',\'') . $userid . ('\',\'' . $part . '\')')); setcookie('comment' . $part . $id, 1, $timestamp + 30, '/'); if ($comment_level == 1) { write_msg('', $dotphpurlarray[$part] . '?id=' . $id . '#comment_write'); } else { define('IN_AJAX', true); write_msg('您提交的留言可能含有违禁词语,审核通过后显示!', $dotphpurlarray[$part] . '?id=' . $id); } unset($loginuser); unset($loginpwd); unset($comment_level); unset($id); } $res = $db->getAll('SELECT content,userid,pubtime,ip FROM `' . $db_mymps . 'comment` WHERE typeid = \'' . $id . '\' AND comment_level = \'1\' AND type = \'' . $part . '\' ORDER BY pubtime ASC LIMIT 0,10'); foreach ($res as $k => $row) { $arr['content'] = $row['content']; $arr['pubtime'] = get_format_time($row['pubtime']); $arr['userid'] = $row['userid']; $arr['ip'] = $row['ip']; $comment_all[] = $arr; } $ajax_content = '