public function update() { if ($_SERVER['HTTP_REFERER'] == NULL) { die("<meta charset='utf-8'><h1>非法访问</h1>"); } //防止浏览器地址访问 $tokenName = C('TOKEN_NAME', null, 'token'); if (Behavior\CheckIslogin::checkIsUser() & IS_POST & I('post.tokenforResume') == $_SESSION[$tokenName][md5('forResumeUpdate')]) { //校验token成功后,清除 unset($_SESSION[$tokenName][md5('forResumeUpdate')]); $Resume = M('Resume'); // 实例化User对象 $Resume->create(I('post.')); $condition['oid'] = md5(session('uid')); if (!$Resume->where($condition)->find()) { //如果没有找到简历就创建 $Resume->oid = $condition['oid']; $Resume->head = session('head'); $Resume->add(); $this->success('添加成功'); } else { $Resume->create(I('post.')); $Resume->where($condition)->save(); $this->success('保存成功', U('/Admin/Index/resumeUpdate')); } } else { $this->error('超时,请刷新页面', U('/Admin/Index/resumeUpdate')); } }
public function resume($uid = null, $secret = null, $rid = null) { $uid = $uid ? $uid : md5(session('uid')); /* 校验条件:已登录,且参数不空,且(是企业用户或者是自己) */ if ($uid != null && (Behavior\CheckIslogin::checkIsEnterprise() || $uid === md5(session('uid')))) { $Resume = new \Admin\Model\ResumeModel(); $condition['oid'] = $uid; if ($result = $Resume->where($condition)->find()) { $this->assign($result); $this->display(); } else { $this->error('没有找到合适的简历', U('/Home')); } } else { $this->error(Behavior\CheckIslogin::getError(), U('/Home')); } }
public function userFavorite() { if (Behavior\CheckIslogin::checkIsUser()) { //校验用户类型 $this->display(); } else { //取回cookie['uid'],和数据库的值进行比较,然后取得用户数据 $this->success(Behavior\CheckIslogin::getError(), U('/Admin/Index/index')); } }
public function update() { if ($_SERVER['HTTP_REFERER'] == NULL) { die("<meta charset='utf-8'><h1>非法访问</h1>"); } //防止浏览器地址访问 $tokenName = C('TOKEN_NAME', null, 'token'); if (Behavior\CheckIslogin::checkIsLogin() & IS_POST & I('post.tokenforUpdate') == $_SESSION[$tokenName][md5('forUpdate')]) { //校验token成功后,清除 unset($_SESSION[$tokenName][md5('forUpdate')]); $User = M("User"); // 实例化User对象 // 要修改的数据对象属性赋值,暂未进行格式验证 $data['name'] = I('post.name'); $data['email'] = I('post.email'); $data['tel'] = I('post.tel'); if ($User->create($data)) { $condition['uid'] = session('uid'); $User->where($condition)->save(); // 根据条件更新记录 session('name', $data['name']); session('email', $data['email']); session('tel', $data['tel']); $this->success('更新成功', U('/Admin/Index/userUpdate')); } else { $this->error($User->getError()); } } else { $this->error('页面超时', U('/Admin/Index/')); } }