本文整理匯總了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;
}
}