/** * 退出登录 */ public function outLogin() { unset($_SESSION['login']); if (empty($_SESSION['login'])) { sucMsg('/'); } else { errMsg("退出失败!"); } }
public function setHide() { if (!empty($_GET['cid']) || !empty($_GET['hide'])) { $r = $this->D('Comment')->setHide($_GET['hide'], $_GET['cid']); if ($r > 0) { sucMsg('/admin.php?c=Comment&a=show'); } else { errMsg('修改失败!'); } } }
/** * 评论提交验证 */ public function add_verify() { if (empty($_POST) || empty($_POST['aid'])) { exit('非法提交!'); } is_str_verify($_POST['verify_code'], 'verify_code'); is_str_verify($_POST['poster'], 'user'); is_str_verify($_POST['email'], 'email'); is_str_verify($_POST['url'], 'url'); is_str_verify($_POST['content'], 'strlen', 2, 1000); $data = array(':aid' => I($_POST['aid']), ':gid' => 0, ':date' => date("Y-m-d", time()), ':poster' => I($_POST['poster']), ':content' => I($_POST['content']), ':email' => I($_POST['email']), ':url' => I($_POST['url']), ':hide' => 'n', ':ip' => '127.0.0.1'); $c_model = $this->D('Comment'); $_r = $c_model->add($data); if ($_r > 0) { $this->D('Article')->commentCount($_POST['aid']); unset($_SESSION['code']); $url = "/Article/show/id/" . I($_POST['aid']) . ""; sucMsg($url); } else { errMsg('评论失败!'); } }