本文整理匯總了PHP中Model\User::isPassword方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::isPassword方法的具體用法?PHP User::isPassword怎麽用?PHP User::isPassword使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Model\User
的用法示例。
在下文中一共展示了User::isPassword方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: isset
use Model\User;
use Util\Token;
use Form\Response;
if (strtolower($_SERVER['REQUEST_METHOD']) == 'post') {
$userPostData = isset($_POST['user']) && is_array($_POST['user']) ? $_POST['user'] : array();
$userPostData = array_map('trim', $userPostData);
$username = isset($userPostData['name']) ? $userPostData['name'] : '';
$password = isset($userPostData['pass']) ? $userPostData['pass'] : '';
//進行表單令牌驗證
if (Token::validate($_POST['token']) === false) {
Response::json(array('msg' => '非法訪問,請刷新表單'), 1);
}
if (User::isUsername($username) == false) {
Response::json(array('msg' => '賬號不符合規則,請重新輸入'), 1);
}
if (User::isPassword($password) == false) {
Response::json(array('msg' => '密碼不符合規則,請重新輸入'), 1);
}
$userData = User::getUserDataByUsername('user_id,user_pass', $username);
if (isset($userData['user_id']) == false) {
Response::json(array('msg' => '您輸入的帳號不存在,請重新輸入'), 1);
}
if (md5($password) != $userData['user_pass']) {
Response::json(array('msg' => '您輸入的密碼有誤,請重新輸入'), 1);
}
$_SESSION['user_id'] = $userData['user_id'];
$_SESSION['user_name'] = $username;
Response::json(array('msg' => '係統登錄成功'), 0);
}
?>
<!DOCTYPE html>
示例2: isset
$eid = isset($_GET['eid']) ? intval($_GET['eid']) : '';
$act = isset($_GET['act']) ? $_GET['act'] : '';
if ($act == 'save') {
$userData = isset($_POST['user']) && is_array($_POST['user']) ? $_POST['user'] : array();
$data = array('user_name' => isset($userData['name']) ? $userData['name'] : '', 'user_pass' => isset($userData['pass']) && $userData['pass'] != '' ? md5($userData['pass']) : '', 'user_real_name' => isset($userData['real_name']) ? $userData['real_name'] : '', 'user_sex' => isset($userData['sex']) && $userData['sex'] != '' ? $userData['sex'] : 1, 'user_age' => isset($userData['age']) && $userData['age'] != '' ? $userData['age'] : 0, 'user_email' => isset($userData['email']) ? $userData['email'] : '', 'user_qq' => isset($userData['qq']) && $userData['qq'] != '' ? $userData['qq'] : 0, 'user_phone' => isset($userData['phone']) && $userData['phone'] != '' ? $userData['phone'] : 0, 'user_mobile' => isset($userData['mobile']) && $userData['mobile'] != '' ? $userData['mobile'] : 0);
//去除數據兩側空字符
$data = array_map('trim', $data);
if (User::isUsername($data['user_name']) == false) {
Response::json(array('msg' => '用戶名不符合規則,請重新輸入'), 1);
}
if ($eid > 0) {
if ($data['user_pass'] != '' && User::isPassword($data['user_pass']) == false) {
Response::json(array('msg' => '密碼不符合規則,請重新輸入'), 1);
}
} else {
if (User::isPassword($data['user_pass']) == false) {
Response::json(array('msg' => '密碼不符合規則,請重新輸入'), 1);
}
}
//真實姓名
if ($data['user_real_name'] != '' && User::isRealName($data['user_real_name']) == false) {
Response::json(array('msg' => '輸入的名字不符合規則,請重新輸入'), 1);
}
//性別
if ($data['user_sex'] != '' && User::isSex($data['user_sex']) == false) {
Response::json(array('msg' => '輸入的性別不符合規則,請重新輸入'), 1);
}
//年齡
if ($data['user_age'] != 0 && User::isAge($data['user_age']) == false) {
Response::json(array('msg' => '輸入的年齡不符合規則,請重新輸入'), 1);
}