/** * logout页面 */ function logout() { //更新用户退出时间 $log_record = new LoginRecordModel(); $current_time = date('Y-m-d H:i:s', time()); $log['logout_date'] = $current_time; //如果是ajax传来的值 if (!empty($_POST['record_id'])) { $log_record->where('id=' . $_POST['record_id'])->save($log); } else { //如果是点击logout退出 $log_record->where('id=' . $_SESSION['record_id'])->save($log); unset($_SESSION['username']); $this->assign('jumpUrl', __APP__ . '/Index/index'); $this->success('退出成功'); } }
/** * 发送邮件 页面 * 完成页面 */ function send_email() { $id = trim($_POST['id']); $email_to = trim($_POST['email_to']); $title = trim($_POST['title']); $message = trim($_POST['description']); if (empty($title) || empty($message)) { $this->error("发送失败,请填写完全内容!"); } else { if (SendMail($email_to, $title, $message) !== false) { //发送警告成功,则将用户的警告数加1 $log_record = new LoginRecordModel(); $userinfo = $log_record->getById($id); $warn_count = $userinfo['warn_count']; $data['warn_count'] = $warn_count + 1; $log_record->where('id=' . $id)->save($data); $this->assign("jumpUrl", "__APP__/Tool/log_record"); $this->success("发送成功!"); } else { $this->assign("jumpUrl", "__APP__/Tool/log_record"); $this->error("发送失败,请联系管理员!!!"); } } }