function addInterview() { $_POST['created'] = time(); $_POST['company_id'] = $_SESSION['uid']; $company = $this->company->getCompanyDataById($_SESSION['uid'], 'name'); $_POST['company_name'] = $company['name']; $db = M('interview'); $con = 'created >' . strtotime(date('Y-m-d')) . ' AND recruit_id=' . $_POST['recruit_id'] . ' AND uid=' . $_POST['uid']; if ($db->where($con)->count()) { //如果今天已经邀请面试,则不添加数据 echo 1; exit; } $point = getPointRule('interview'); //获得应扣取积分 if ($_SESSION['point'] < abs($point)) { $this->error('亲爱的用户,你的积分不够啦。请联系管理员充值'); } $result = $db->insert($_POST); if ($result) { deductPoint($point); ////扣取积分 $con = '邀请用户' . $_POST['username'] . '面试 <a href="' . __WEB__ . '/index/search/jobs/id/' . $_POST['recruit_id'] . '" target="_blank">' . $_POST['recruit_name'] . '</a>'; writeOptLog($con, $point); //写入日志 echo 1; exit; } echo 0; exit; }
function login() { if (!$this->auth->is_logged_in()) { //验证字段 if ($_SERVER['REQUEST_METHOD'] == 'POST') { $code = isset($_POST['code']) ? $_POST['code'] : FALSE; // 如果尝试登录次数大于配置次数设置验证码规则 if ($this->auth->is_max_login_attempts_exceeded() or C('AUTH_CAPTCHA_LOGIN') or $code != FALSE) { if (!$this->_captcha_check($_POST['code'])) { $this->error(L('validata_error'), 'index'); } } $username = isset($_POST['name']) ? addslashes($_POST['name']) : FALSE; $password = isset($_POST['pwd']) ? $_POST['pwd'] : FALSE; $remember = isset($_POST['remember']) ? $_POST['remember'] : FALSE; if ($this->auth->auth_user_login($username, $password, $remember)) { // 验证成功重定向至首页 //查找用户积分 $_SESSION['point'] = $this->_getUserPoint($_SESSION['uid']); if ($_SESSION['last_login'] < strtotime(date('Y-m-d'))) { //每天登录+积分 $point = getPointRule('firstLogin'); //获得应扣取积分 deductPoint($point); //增加积分 $con = date('Y-m-d') . ' 第一次登录,(积分剩余:' . $_SESSION['point'] . ')'; writeOptLog($con, $point); //写入日志 } if (in_array('3', $_SESSION['role']['rid'])) { //如果是企业用户 $this->success('登录成功', __WEB__ . '/index/company.html'); } else { if (in_array('4', $_SESSION['role']['rid'])) { //如果是个人用户 $this->success('登录成功', __WEB__ . '/index/profile.html'); } else { $this->success('登录成功', __WEB__); } } } else { //检查用户无法登录是否因为用户是被禁止的或没有用户 if ($this->auth->is_banned()) { $this->error('对不起,你已被禁止登录,禁止原因:' . $this->auth->get_ban_reason(), __WEB__); } else { $this->error($this->auth->error); } } } else { //默认不显示验证码,直到登录错误到了最大值 $show_captcha = FALSE; // 如果登录错误大于配置文件中的最大登录错误次数或默认开启显示验证码则显示验证码 if ($this->auth->is_max_login_attempts_exceeded() || C('AUTH_CAPTCHA_LOGIN')) { $show_captcha = TRUE; } //加载登录页面 $this->assign('show_captcha', $show_captcha); $this->display('login'); } } else { $this->success('你已经登录了', __ROOT__); } }