本文整理汇总了PHP中check_verify函数的典型用法代码示例。如果您正苦于以下问题:PHP check_verify函数的具体用法?PHP check_verify怎么用?PHP check_verify使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了check_verify函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: grade_login
public function grade_login()
{
if (!check_verify(I('code', ''))) {
$this->error('验证码错误');
}
$username = I('username');
$user = M('user')->where(array('username' => $username))->find();
$pwd = I('password', '', 'md5');
if (!$user | $user['password'] != $pwd) {
$this->error('用户名或密码错误');
}
if ($user['lock']) {
$this->error('用户被锁定,请联系管理员解锁');
}
$data = array('id' => $user['id'], 'logintime' => time(), 'loginip' => get_client_ip());
M('user')->save($data);
session(C('USER_AUTH_KEY'), $user['id']);
session('username', $user['username']);
session('lastlogintime', date('Y-m-d H:i', $user['logintime']));
session('lastloginip', $user['loginip']);
if ($user['username'] == C('RBAC_SUPERADMIN')) {
session(C('ADMIN_AUTH_KEY'), true);
}
import('Org.Util.Rbac');
Rbac::saveAccessList();
// dump($_SESSION);die;
$this->redirect('Grade/Grade/grade_index');
}
示例2: send
public function send()
{
if (IS_POST) {
$post_data = I('post.');
if (!check_verify($post_data['verify'])) {
$this->error('验证码输入错误!');
}
$post_data['send_from_id'] = $this->UserInfo['username'];
$data = $this->Model->create($post_data);
if ($data) {
$result = $this->Model->add($data);
if ($result) {
$this->success("操作成功!", U('outbox'));
} else {
$error = $this->Model->getError();
$this->error($error ? $error : "操作失败!");
}
} else {
$error = $this->Model->getError();
$this->error($error ? $error : "操作失败!");
}
} else {
$this->display();
}
}
示例3: login
public function login($username = null, $password = null, $verify = null)
{
if (IS_POST) {
$verify = I("post.verify", "", "trim");
if (!check_verify($verify)) {
$this->error('验证码输入错误!');
}
$username = I("post.username", "", "trim");
$password = md5(I("post.password", "", "trim"));
if (empty($username) || empty($password)) {
$this->error("用户名或者密码不能为空,请重新输入!", U(C('AUTH_USER_GATEWAY')));
}
$map = array('username' => $username, 'password' => $password, 'status' => 1);
$userinfo = M('User')->where($map)->find();
if ($userinfo) {
$AGA_Data = M('AuthGroupAccess')->where(array('uid' => $userinfo['id']))->find();
$AG_Data = M('AuthGroup')->where(array('id' => $AGA_Data['group_id']))->find();
$userinfo['group_title'] = $AG_Data['title'];
session(C('AUTH_KEY'), $userinfo['id']);
session('UserInfo', $userinfo);
session('ModelKey.User', 1);
//action_log('Admin_Login', 'User', $userinfo ['id']);
$this->success("登录成功!", U(C('AUTH_USER_INDEX')));
} else {
$this->error("用户名密码错误或者此用户已被禁用!", U(C('AUTH_USER_GATEWAY')));
}
} else {
$ModelKey = session('ModelKey.User');
if (is_login() && $ModelKey == 1) {
$this->redirect('Index/index');
} else {
$this->display();
}
}
}
示例4: login
public function login()
{
//判断是否已经登录
$sessionuser['username'] = session('username');
if (!empty($sessionuser['username'])) {
$this->redirect('Index/index');
}
if ($_POST) {
//登陆方法
$user = D("admin");
if (!check_verify($_POST['verify'])) {
$this->error('验证码输入错误!');
}
if (!$user->create($_POST)) {
// 如果创建失败 表示验证没有通过 输出错误提示信息
$this->error($user->getError());
//getError() \ThinkPHP\Library\Think\Model.class.php 返回模型的错误信息
} else {
$map['username'] = $_POST['username'];
$map['password'] = hash('sha256', $_POST['password']);
$result = $user->where($map)->select();
if ($result) {
session('username', $map['username']);
$this->success('登陆成功', U('Index/index'));
} else {
$this->error("用户名密码错误!");
}
}
} else {
$this->display();
//登陆界面
}
}
示例5: run
/**
* 入口函数。此函数会被自动调用
* */
public function run()
{
//检查验证码
if (!(APP_DEBUG && C('Not_VerifyCode'))) {
check_verify(I('post.verifycode')) or drop(EC_4741);
}
//尝试创建数据对象
//users表
$usersMo = new UsersModel();
$usersMo->field('qq,password');
$usersMo->create(I('post.'), Model::MODEL_INSERT) or drop($usersMo->getError());
//invite_code表
$icMo = new InviteCodeModel();
$icMo->field('uid,invite_code');
$icMo->create(array('invite_code' => I('post.invite_code'), 'uid' => $usersMo->getUid()), Model::MODEL_INSERT) or drop($icMo->getError());
//数据检查
if (I('post.password') != I('post.re_password')) {
drop(EC_4742);
}
$this->checkInviteCode_0(I('post.invite_code')) or drop(EC_4751);
$this->checkInviteCode_1(I('post.invite_code')) or drop(EC_4752);
//注册信息
$usersMo->add() or drop(EC_4761);
$icMo->save() or drop(EC_4762);
//生成登陆信息
log_in($usersMo->getUid());
//返回成功信息
echo drop('1200,' . $usersMo->getUid(), true);
}
示例6: login
/**
* 后台登录入口
* @author lck
*/
public function login()
{
if (IS_POST) {
$_POST = I('post.');
$where['user'] = $_POST['user'];
$res = M('Manager_shop')->where($where)->find();
if (!$res) {
$this->error('用户名不存在!');
} elseif ($res['pass'] != md5($_POST['pass'])) {
$this->error('密码不正确!');
} else {
$res['data'] = $res;
$res['status'] = 1;
}
if (!$res['status']) {
$this->error($res['error']);
} elseif (!check_verify($_POST['verify'])) {
$this->error('验证码错误!');
} else {
D('Manager')->sign_account_shop(array('id' => $res['data']['id'], 'user' => $res['data']['user'], 'shopid' => $res['data']['shopid']));
$arr['lastlogintime'] = time();
$arr['lastloginip'] = get_client_ip();
$arr['logintimes'] = $res['data']['logintimes'] + 1;
M('Manager_shop')->where('id=' . $res['data']['id'])->save($arr);
$this->redirect('Index/index');
}
} else {
$this->display();
}
}
示例7: login
/**
* 用户登录
*/
public function login()
{
if (I('get.dosubmit')) {
$admin_db = D('Admin');
$username = I('post.username', '', 'trim') ? I('post.username', '', 'trim') : $this->error('用户名不能为空', HTTP_REFERER);
$password = I('post.password', '', 'trim') ? I('post.password', '', 'trim') : $this->error('密码不能为空', HTTP_REFERER);
//验证码判断
$code = I('post.code', '', 'trim') ? I('post.code', '', 'trim') : $this->error('请输入验证码', HTTP_REFERER);
if (!check_verify($code, 'admin')) {
$this->error('验证码错误!', HTTP_REFERER);
}
if ($admin_db->login($username, $password, $info)) {
session('userid', $info['userid']);
session('roleid', $info['roleid']);
$save_time = 3600 * 7 * 24;
cookie('username', $username, $save_time);
if (I('post.savepwd')) {
cookie('password', $password, $save_time);
} else {
cookie('password', null);
}
$this->success('登录成功', U('Index/index'));
} else {
$this->error($admin_db->error, HTTP_REFERER);
}
} else {
$this->display();
}
}
示例8: login
public function login()
{
if (isset($_POST['userid']) && !empty($_POST['userid']) && isset($_POST['userpwd']) && !empty($_POST['userpwd']) && isset($_POST['logincode']) && !empty($_POST['logincode'])) {
$code = $_POST['logincode'];
$userid = $_POST['userid'];
$userpwd = $_POST['userpwd'];
if (!check_verify($code)) {
echo 2;
exit;
}
$rsa = M("admin")->where("admin_name='{$userid}'")->count();
if ($rsa == 0) {
//账号不存在
echo 3;
exit;
} else {
$rsb = M("admin")->where("admin_name='{$userid}' and admin_pwd='" . md5($userpwd) . "'")->count();
if ($rsb == 0) {
//账号或密码错误
echo 4;
} else {
$_SESSION['userid'] = $userid;
echo 1;
}
}
} else {
echo '0';
}
}
示例9: login
/**
* 后台用户登录
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
*/
public function login($username = null, $password = null, $verify = null)
{
/* 读取数据库中的配置 */
$config = S('DB_CONFIG_DATA');
if (!$config) {
$config = D('Config')->lists();
S('DB_CONFIG_DATA', $config);
}
C($config);
//添加配置
if (IS_POST) {
/* 检测验证码 TODO: */
if (C('WEB_SITE_VERIFY') && !check_verify($verify)) {
$this->error('验证码输入错误!');
}
/* 登录用户 */
$User = D('Common/User');
if ($User->login($username, $password, 'admin_login')) {
//登录用户
//TODO:跳转到登录前页面
$this->success('登录成功!', U('Index/index'));
} else {
$this->error($User->getError());
}
} else {
if (is_login()) {
$this->redirect('Index/index');
} else {
$this->display();
}
}
}
示例10: loginAuth
/**
* [loginAuth 后台用户登录]
* @param [type] $username [用户名]
* @param [type] $password [密码]
* @param [type] $verify [验证码]
* @return [type] [description]
*/
public function loginAuth($username = null, $password = null, $verify = null)
{
if (IS_AJAX) {
/* 检测验证码 TODO: */
if (!check_verify($verify)) {
$this->error('验证码输入错误!');
}
$User = D('Users');
$uid = $User->login($username, $password);
if (0 < $uid) {
//登录成功
$this->ajaxReturn(array('status' => 1, 'info' => '登录成功!', 'url' => U('Index/index')));
} else {
//登录失败
switch ($uid) {
case -1:
$error = '用户不存在或被禁用!';
break;
//系统级别禁用
//系统级别禁用
case -2:
$error = '密码错误!';
break;
case -3:
$error = '用户组不存在或被禁用!';
break;
default:
$error = '未知错误!';
break;
// 0-接口参数错误(调试阶段使用)
}
$this->ajaxReturn(array('status' => 0, 'info' => $error));
}
}
}
示例11: login
public function login($username = null, $password = null, $verify = null)
{
$error = '';
if (IS_POST && check_verify($verify)) {
$Man = D('Manage');
$mid = $Man->login($username, $password);
if ($mid > 0) {
session('user_auth', $mid);
session('user_auth_sign', data_auth_sign($mid));
$this->success('登录成功!', U('Index/index'));
} else {
switch ($mid) {
case -1:
$error = '用户不存在或被禁用!';
break;
case -2:
$error = '密码错误!';
break;
default:
$error = '未知错误!';
break;
}
}
} elseif (IS_POST) {
$error = '验证码输入错误!';
}
$this->assign("error", $error);
$this->display();
}
示例12: login
public function login($username = null, $password = null, $verify = null, $autologin = false)
{
if (IS_POST || $autologin) {
/* 检测验证码 TODO: */
if (!check_verify($verify) && !$autologin) {
$this->error('验证码输入错误!');
}
//自动判断用户名是哪个字段的
$map[get_account_type($username)] = $username;
$map['password'] = ainiku_ucenter_md5($password);
$map['status'] = 1;
//$map['member_group_id']=1;
$map['is_adminlogin'] = 1;
$user = D('MemberView')->where($map)->find();
if (empty($user)) {
//登录失败
cookie('__uid__', null);
return $autologin ? false : $this->error('用户名或密码错误!');
} else {
//登陆成功
/* 记录登录SESSION和COOKIES */
$auth = array('uid' => $user['member_id'], 'username' => $user['username'], 'last_login_time' => $user['update_time']);
session('user_auth', $auth);
session('uinfo', $user);
session('user_auth_sign', data_auth_sign($auth));
//更新用户登录信息
$this->updateLogin($user['member_id']);
//把用户密码加密保存到cookie中
if (!$autologin) {
$u['u'] = ainiku_encrypt($username);
$u['p'] = ainiku_encrypt($password);
//如果有验证码的话就再次设置记录时间cookie
$a = I('post.remember');
$b = 0;
switch ($a) {
case 1:
$b = 24 * 3600;
break;
case 2:
$b = 24 * 3600 * 7;
break;
case 3:
$b = 24 * 3600 * 30;
break;
default:
$b = -1;
}
cookie('__uid__', $u, $b);
}
return $autologin ? $user['member_id'] : $this->success('登录成功!', U($user['admin_index'], array('mainmenu' => 'true')));
}
} else {
if (is_login() || $this->autologin()) {
$user = session('uinfo');
redirect(U($user['admin_index'], array('mainmenu' => 'true')));
} else {
$this->display();
}
}
}
示例13: login
/**
* 后台用户登录
*/
public function login($username = null, $password = null, $verify = null)
{
if (IS_POST) {
/* 检测验证码 TODO: */
if (!check_verify($verify)) {
$this->error('验证码输入错误!');
}
$db = M('user');
$map['username'] = $username;
$map['status'] = 1;
$user = $db->where($map)->find();
if (!$user) {
$userExit = $db->where('username' . "='{$username}'")->find();
if ($userExit) {
$this->error('帐号被禁用');
} else {
$this->error('帐号不存在');
}
}
if ($user['password'] != md5($password)) {
$this->error('密码错误');
}
/* 记录登录SESSION和COOKIES */
$auth = array('uid' => $user['id'], 'username' => $user['username'], 'fullname' => $user['fullname'], 'rid' => $user['role_id']);
session('user', $auth);
$this->success('登录成功!', U('Index/index'));
} else {
if (is_login()) {
$this->redirect('Index/index');
} else {
$this->display();
}
}
}
示例14: run
/**
* 入口函数。此函数会被自动调用
* */
public function run()
{
//检查验证码
if (!(APP_DEBUG && C('Not_VerifyCode'))) {
check_verify(I('post.verifycode')) or drop(EC_4841);
}
//校验登陆信息
test_token() or drop(EC_4842);
//校验是否需要登记信息
get_state() == '100' or drop(EC_4843);
//获取uid
$_POST['uid'] = cookie('uid');
//尝试创建数据对象
//user_inf表
$uiMo = new UserInfModel();
$uiMo->create(I('post.'), Model::MODEL_INSERT) or drop($uiMo->getError());
//users表
$uMo = new UsersModel();
$uMo->field('uid,state');
$uMo->create(array('uid' => $_POST['uid'], 'state' => 200), Model::MODEL_UPDATE) or drop($uMo->getError());
//注册信息
$uiMo->add() or drop(EC_4861);
$uMo->save() or drop(EC_4862);
//End 注册信息
drop(true);
}
示例15: chuanciquery
public function chuanciquery()
{
if (IS_POST) {
//注册用户
/* 检测验证码 */
if (!check_verify($verify)) {
$this->error('验证码输入错误!');
}
/* 检测密码 */
if ($password != $repassword) {
$this->error('密码和重复密码不一致!');
}
/* 调用注册接口注册用户 */
$User = new UserApi();
$uid = $User->register($username, $password, $email);
if (0 < $uid) {
//注册成功
//TODO: 发送验证邮件
$this->success('注册成功!', U('login'));
} else {
//注册失败,显示错误信息
$this->error($this->showRegError($uid));
}
} else {
//显示注册表单
$this->display();
}
}