本文整理汇总了PHP中School::verify方法的典型用法代码示例。如果您正苦于以下问题:PHP School::verify方法的具体用法?PHP School::verify怎么用?PHP School::verify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类School
的用法示例。
在下文中一共展示了School::verify方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: POST_verifyAction
/**
* 验证找回密码
* @method POST_verifyAction
* @author NewFuture
*/
public function POST_verifyAction()
{
$response['status'] = 0;
if (!Input::post('number', $number, 'card')) {
$response['info'] = '学号格式有误';
}
if (!Input::post('password', $password, 'trim')) {
$response['info'] = '密码无效';
} elseif (!Input::post('sch_id', $sch_id, 'int')) {
$response['info'] = '学校ID无效';
} elseif (!($id = UserModel::where('number', $number)->get('id'))) {
$response['info'] = '学号错误或者尚未注册过';
} else {
$info = ['number' => $number, 'password' => $password, 'sch_id' => $sch_id];
if (Input::post('code', $code, 'ctype_alnum')) {
/*验证码*/
$info['code'] = $code;
}
/*学校系统验证*/
if (School::verify($info)) {
/*验证成功*/
$user['id'] = $id;
$user['number'] = $number;
Session::set('find_user', $user);
$response['status'] = 1;
$response['info'] = '验证成功,请重置密码';
} else {
$response['info'] = '验证失败';
}
}
$this->response = $response;
}
示例2: verify
/**
* 验证准备注册
* @method verify
* @access public
* @author NewFuture[newfuture@yunyin.org]
* @return bool|null
*/
public function verify($number, $password, $sch_id = null, $code = null)
{
$info = array('number' => $number, 'password' => $password, 'sch_id' => $sch_id);
$code and $info['code'] = $code;
//验证码
/*黑名单*/
$black = isset($this->reg_schools) ? $this->reg_schools : [];
if (!($result = School::verify($info, $black))) {
return false;
} elseif ($result = array_filter($result)) {
/*验证成功*/
$reg = array('number' => $info['number'], 'password' => md5($info['password']), 'name' => current($result), 'sch_id' => key($result));
$sid = Session::start();
Session::set('reg', $reg);
unset($reg['password']);
$reg['school'] = SchoolModel::getName($reg['sch_id']);
$this->response(2, ['sid' => $sid, 'user' => $reg, 'msg' => '验证成功', 'url' => '/user/']);
return true;
}
}