當前位置: 首頁>>代碼示例>>PHP>>正文


PHP is_password函數代碼示例

本文整理匯總了PHP中is_password函數的典型用法代碼示例。如果您正苦於以下問題:PHP is_password函數的具體用法?PHP is_password怎麽用?PHP is_password使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了is_password函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _validate_form

 private function _validate_form()
 {
     // 先驗證用戶名和密碼
     $this->load->library('form_validation');
     $this->form_validation->set_message('required', '請輸入{field}');
     $this->form_validation->set_rules('username', '用戶名', array('required', array('is_username', function ($str) {
         if (is_username($str) || is_email($str) || is_phone($str)) {
             return true;
         }
         $this->form_validation->set_message('is_username', '無效{field}');
         return false;
     })));
     $this->form_validation->set_rules('password', '密碼', array('required', array('is_password', function ($str) {
         if (!is_password($str)) {
             $this->form_validation->set_message('is_password', '無效{field}');
             return false;
         }
         return true;
     })));
     if (!$this->form_validation->run()) {
         return FALSE;
     }
     $this->form_validation->reset_validation();
     $this->form_validation->set_message('required', '請輸入{field}');
     $this->form_validation->set_rules('captcha', '驗證碼', 'trim|required|callback_check_captcha');
     return $this->form_validation->run();
 }
開發者ID:super-d2,項目名稱:codeigniter_demo,代碼行數:27,代碼來源:Login.php

示例2: checkpasswd

/**
 * 檢查管理員密碼合法性
 * @param string $password 密碼
 */
function checkpasswd($password)
{
    if (!is_password($password)) {
        return false;
    }
    return true;
}
開發者ID:ahmatjan,項目名稱:huluphp,代碼行數:11,代碼來源:admin.func.php

示例3: edit_password

	public function edit_password($userid, $password){
		$userid = intval($userid);
		if($userid < 1) return false;
		if(!is_password($password))
		{
			showmessage(L('pwd_incorrect'));
			return false;
		}
		$passwordinfo = password($password);
		return $this->db->update($passwordinfo,array('userid'=>$userid));
	}
開發者ID:panhongsheng,項目名稱:zl_cms,代碼行數:11,代碼來源:admin_op.class.php

示例4: edit_password

 /**
  * 修改密碼
  * @param unknown $userid 	用戶ID
  * @param unknown $password	密碼
  * @return boolean
  */
 public function edit_password($userid, $password)
 {
     $userid = intval($userid);
     if ($userid < 1) {
         return false;
     }
     if (!is_password($password)) {
         return false;
     }
     $passwordinfo = password($password);
     return $this->where('userid=' . $userid)->save($passwordinfo);
 }
開發者ID:shenyangchong,項目名稱:bjui_php,代碼行數:18,代碼來源:AdminModel.class.php

示例5: __construct

 /**
  * 構造函數
  */
 public function __construct()
 {
     $this->db = pc_base::load_model('member_model');
     pc_base::load_app_func('global');
     /*獲取係統配置*/
     $this->settings = getcache('settings', 'admin');
     $this->applist = getcache('applist', 'admin');
     if (isset($_GET) && is_array($_GET) && count($_GET) > 0) {
         foreach ($_GET as $k => $v) {
             if (!in_array($k, array('m', 'c', 'a'))) {
                 $_POST[$k] = $v;
             }
         }
     }
     if (isset($_POST['appid'])) {
         $this->appid = intval($_POST['appid']);
     } else {
         exit('0');
     }
     if (isset($_POST['data'])) {
         parse_str(sys_auth($_POST['data'], 'DECODE', $this->applist[$this->appid]['authkey']), $this->data);
         if (empty($this->data) || !is_array($this->data)) {
             exit('0');
         }
         if (!get_magic_quotes_gpc()) {
             $this->data = new_addslashes($this->data);
         }
         if (isset($this->data['username']) && $this->data['username'] != '' && is_username($this->data['username']) == false) {
             exit('-5');
         }
         if (isset($this->data['email']) && $this->data['username'] != '' && is_email($this->data['email']) == false) {
             exit('-5');
         }
         if (isset($this->data['password']) && $this->data['password'] != '' && (is_password($this->data['password']) == false || is_badword($this->data['password']))) {
             exit('-5');
         }
         if (isset($this->data['newpassword']) && $this->data['newpassword'] != '' && (is_password($this->data['newpassword']) == false || is_badword($this->data['newpassword']))) {
             exit('-5');
         }
     } else {
         exit('0');
     }
     if (isset($GLOBALS['HTTP_RAW_POST_DATA'])) {
         $this->data['avatardata'] = $GLOBALS['HTTP_RAW_POST_DATA'];
         //if($this->applist[$this->appid]['authkey'] != $this->data['ps_auth_key']) {
         //	exit('0');
         //}
     }
 }
開發者ID:boylzj,項目名稱:omguitar,代碼行數:52,代碼來源:phpsso.class.php

示例6: save

 public function save()
 {
     $id = (int) $this->input->get_post('id');
     $data['user_name'] = trim($this->input->get_post('user_name'));
     //判斷名稱是否有重複
     $item = $this->model->getOne(array('user_name' => $data['user_name']));
     if ($item && intval($item->uid) != intval($id)) {
         ajax_return(lang('service_user_name_exist'));
     }
     $data['pid'] = $this->user_info->uid;
     //地區
     $data['district'] = $this->input->get_post('district');
     if (!$id) {
         if (!is_username($data['user_name'])) {
             ajax_return('賬號隻允許字母開頭,允許5-16字節,允許字母數字下劃線');
         }
         $password = $this->input->get_post('password');
         if (!is_password($password)) {
             ajax_return('密碼隻允許6到20個字母、數字字符');
         }
         $data['password'] = md5($password);
     }
     $data['gid'] = (int) $this->input->get_post('gid');
     $data['email'] = $this->input->get_post('email');
     if (!is_email($data['email']) and trim($data['email'])) {
         ajax_return('E-mail不是有效的郵箱格式!');
     }
     $data['nickname'] = htmlspecialchars($this->input->get_post('nickname'));
     //保存信息
     if ($id > 0) {
         $data['token'] = '';
         $result = $this->model->update($data, array('uid' => $id));
     } else {
         $data['regip'] = $this->egetip();
         $data['regtime'] = time();
         $result = $this->model->add($data);
     }
     //信息返回操作
     if ($result) {
         ajax_return(lang('save_success'), 0, '', '/admin/user/index');
     } else {
         ajax_return(lang('save_failed'));
     }
 }
開發者ID:cordova2009,項目名稱:SMA,代碼行數:44,代碼來源:index.php

示例7: reset_password_deal

 /**
  * 重置密碼處理
  *
  * @return void
  */
 public function reset_password_deal()
 {
     /* 教師信息 */
     $teacher = $this->session->userdata('teacher');
     if (!$teacher) {
         message('會話已失效,請重新提交', 'student/teacher_download/login');
     }
     $old_password = $this->input->post('old_password');
     $new_password = $this->input->post('new_password');
     $repeat_password = $this->input->post('repeat_password');
     if (my_md5($old_password) != $teacher['password']) {
         message('密碼錯誤!請重試!');
     }
     if (is_string($passwd_msg = is_password($new_password))) {
         message($passwd_msg);
     }
     if ($new_password != $repeat_password) {
         message('您兩次輸入密碼不一致!請重試!');
     }
     $rst = $this->db->update('teacher_download', array('password' => my_md5($new_password)), array('id' => $teacher['id']));
     message('您的新密碼已設置成功,重新登陸後生效', 'student/teacher_download/reset_password', 'success');
 }
開發者ID:Vincent-Shen,項目名稱:origin,代碼行數:27,代碼來源:teacher_download.php

示例8: update_action

 public function update_action()
 {
     if (!$this->input->is_ajax_request()) {
         show_404();
     }
     $uid = (int) $this->input->post('uid');
     $e = $this->input->post('email', true);
     $u = $this->input->post('username', true);
     $u = trim($u);
     $e = strtolower(trim($e));
     if (!is_email($e)) {
         JSON('error', '對不起,請填寫用個可以的電子郵件!');
     }
     if ($this->user_model->get_info(array('uid !=' => $uid, 'email' => $e))) {
         JSON('error', '該電子郵件已在存,請換一個!');
     }
     if (!is_username($u)) {
         JSON('error', '用戶姓名可以由漢字、字母或數字組成,長度不保持 4-16 個字符!');
     }
     if ($this->user_model->get_info(array('uid !=' => $uid, 'username' => $u))) {
         JSON('error', '該用戶名稱已存在,請換一個!');
     }
     $p = $this->input->post('password', true);
     $r = $this->input->post('repassword', true);
     $p = strtolower(trim($p));
     $r = strtolower(trim($r));
     if ($p !== '') {
         if (!is_password($p)) {
             JSON('error', '密碼必須由字母、數字和下劃線組成,長度保持 6-16 個字符!');
         }
         if ($p !== $r) {
             JSON('error', '兩次輸入的密碼不一致,請重新確認密碼!');
         }
         $this->load->library('phpass');
         $data['password'] = $this->phpass->HashPassword($p);
     }
     $data['email'] = $e;
     $data['username'] = $u;
     $data['intro'] = $this->input->post('intro', true);
     $data['state'] = (int) $this->input->post('state');
     $this->db->update('user', $data, array('uid' => $uid));
     unset($data);
     if ($this->db->affected_rows()) {
         JSON('success', '恭喜,用戶 ' . $u . ' 更新成功!');
     } else {
         JSON('error', '對不起,用戶沒有更新或更新失敗!');
     }
 }
開發者ID:ruoL,項目名稱:fun-x,代碼行數:48,代碼來源:user.php

示例9: reset_password

 /**
  * 重置密碼
  *
  * @return  void
  */
 public function reset_password()
 {
     if (!$this->check_power('teacher_download_manage')) {
         return;
     }
     $new_password = $this->input->post('new_password');
     $new_confirm_password = $this->input->post('confirm_password');
     $id = intval($this->input->post('uid'));
     if (is_string($passwd_msg = is_password($new_password))) {
         output_json(CODE_ERROR, $passwd_msg);
     }
     if (!strlen(trim($new_confirm_password))) {
         output_json(CODE_ERROR, '確認密碼不能為空.');
     }
     if ($new_confirm_password != $new_password) {
         output_json(CODE_ERROR, '兩次密碼輸入不一致.');
     }
     //檢查舊密碼是否正確
     $passwd = TeacherDownloadModel::get_by_id($id, 'password');
     if (!count($passwd)) {
         output_json(CODE_ERROR, '不存在該監考人員.');
     }
     //檢查帳號密碼是否正確
     $flag = TeacherDownloadModel::reset_password($id, my_md5($new_password));
     if (!$flag) {
         output_json(CODE_ERROR, '密碼修改失敗,請重試');
     }
     output_json(CODE_SUCCESS, '密碼修改成功.');
 }
開發者ID:Vincent-Shen,項目名稱:origin,代碼行數:34,代碼來源:teacher_download.php

示例10: account_change_mobile

 public function account_change_mobile()
 {
     $memberinfo = $this->memberinfo;
     if (isset($_POST['dosubmit'])) {
         if (!is_password($_POST['password'])) {
             showmessage(L('password_format_incorrect'), HTTP_REFERER);
         }
         if ($this->memberinfo['password'] != password($_POST['password'], $this->memberinfo['encrypt'])) {
             showmessage(L('old_password_incorrect'));
         }
         $sms_report_db = pc_base::load_model('sms_report_model');
         $mobile_verify = $_POST['mobile_verify'];
         $mobile = $_POST['mobile'];
         if ($mobile) {
             if (!preg_match('/^1([0-9]{10})$/', $mobile)) {
                 exit('check phone error');
             }
             $posttime = SYS_TIME - 600;
             $where = "`mobile`='{$mobile}' AND `send_userid`='" . $memberinfo['userid'] . "' AND `posttime`>'{$posttime}'";
             $r = $sms_report_db->get_one($where, 'id,id_code', 'id DESC');
             if ($r && $r['id_code'] == $mobile_verify) {
                 $sms_report_db->update(array('id_code' => ''), $where);
                 $this->db->update(array('mobile' => $mobile), array('userid' => $memberinfo['userid']));
                 showmessage("手機號碼更新成功!", '?m=member&c=index&a=account_change_mobile&t=1');
             } else {
                 showmessage("短信驗證碼錯誤!請重新獲取!");
             }
         } else {
             showmessage("短信驗證碼已過期!請重新獲取!");
         }
     } else {
         include template('member', 'account_change_mobile');
     }
 }
開發者ID:shenhua4286,項目名稱:gxw,代碼行數:34,代碼來源:indexs.php

示例11: reset_student_password

 /**
  * 修改考生密碼
  */
 public function reset_student_password()
 {
     $exam_ticket = trim($this->input->post('account'));
     $password = $this->input->post('password');
     $confirm_password = $this->input->post('confirm_password');
     if (!strlen($exam_ticket)) {
         output_json(CODE_ERROR, '請輸入正確的準考證號.');
     }
     if (is_string($passwd_msg = is_password($password))) {
         output_json(CODE_ERROR, $passwd_msg);
     }
     if (!strlen($confirm_password)) {
         output_json(CODE_ERROR, '確認密碼不能為空.');
     }
     if ($confirm_password != $password) {
         output_json(CODE_ERROR, '兩次密碼不一致.');
     }
     //檢查帳號密碼是否正確
     $this->load->model('exam/student_model');
     $student = $this->student_model->is_valid_student($exam_ticket);
     if (!$student) {
         output_json(CODE_ERROR, '該考生不存在.');
     }
     //判斷該考生是否在當前考場中
     $this->load->model('exam/exam_place_model');
     $exam_place_model = $this->exam_place_model;
     $place_id = $this->session->userdata('exam_i_place_id');
     $user_id = $student['uid'];
     if (!$exam_place_model->check_exam_place_student($place_id, $user_id)) {
         output_json(CODE_ERROR, '很抱歉,該考生不在本場考試中,有問題請聯係係統管理員.');
     }
     //重置考生密碼
     try {
         $this->student_model->reset_password($user_id, $password);
         output_json(CODE_SUCCESS, '修改成功, 該考生考試信息為:<p><strong>準考證號:</strong>' . $exam_ticket . ' </p><p><strong>新密碼為:</strong> ' . $password . '  </p><font color="red">請記下該考生新密碼, 以防丟失.</font>');
     } catch (Exception $e) {
         output_json(CODE_ERROR, '密碼修改失敗,請重試(如多次出現類似情況,請聯係係統管理員)');
     }
 }
開發者ID:Vincent-Shen,項目名稱:origin,代碼行數:42,代碼來源:invigilate.php

示例12: _validate_userinfo

 private function _validate_userinfo(&$data)
 {
     if (isset($data['username'])) {
         $data['username'] = strtolower(trim($data['username']));
         if (!is_username($data['username'])) {
             return '用戶名不合法';
         }
     }
     if (isset($data['email'])) {
         $data['email'] = strtolower(trim($data['email']));
         if (!$data['email']) {
             return 'Email不合法';
         }
     }
     if (isset($data['phone'])) {
         $data['phone'] = (int) $data['phone'];
         if (!is_phone($data['phone'])) {
             return '手機號不合法';
         }
     }
     if (isset($data['password'])) {
         if (!is_password($data['password'])) {
             return '密碼不合法';
         }
     }
     if (isset($data['qq'])) {
         $data['qq'] = (int) $data['qq'];
         !is_qq($data['qq']) && ($data['qq'] = 0);
     }
     isset($data['wechat']) && !is_wechat($data['wechat']) && ($data['wechat'] = '');
     return true;
 }
開發者ID:super-d2,項目名稱:codeigniter_demo,代碼行數:32,代碼來源:User_model.php

示例13: resetpwd

 public function resetpwd()
 {
     Fn::ajax_call($this, 'login', 'logout');
     $hash = $this->input->get('code');
     $uid = email_hash('decode', $hash, 1800);
     $uid && ($student = StudentModel::get_student($uid));
     if (!$student) {
         message('重置鏈接已失效,請重新提交申請', 'student/index/forget');
     }
     if ($this->input->post('act') == 'submit') {
         $password = $this->input->post('password');
         $newpwd_confirm = $this->input->post('password_confirm');
         if (is_string($passwd_msg = is_password($password))) {
             message($passwd_msg);
         }
         if ($password != $newpwd_confirm) {
             message('您兩次輸入密碼不一致,返回請確認!');
         }
         $this->db->update('student', array('password' => my_md5($password)), array('uid' => $uid));
         $now_time = time() - 1800;
         $sql = "UPDATE  {pre}user_resetpassword SET expiretime='{$now_time}' WHERE uid='{$uid}' and  hash = '{$hash}'";
         $row = $this->db->query($sql);
         message('您的新密碼已設置成功.', 'student/index/login', 'success');
     } else {
         $data = array();
         $data['uinfo'] = StudentModel::studentLoginUInfo();
         $data['hash'] = $hash;
         // 模版
         $this->load->view('index/resetpwd', $data);
     }
 }
開發者ID:Vincent-Shen,項目名稱:origin,代碼行數:31,代碼來源:index.php

示例14: editpwd

 /**
  * 修改密碼
  */
 public function editpwd()
 {
     Fn::ajax_call($this, 'login', 'logout');
     if (!$this->_uinfo['uid']) {
         redirect('student/index/login');
     }
     $data = array();
     $data['uinfo'] = $this->_uinfo;
     $uid = $this->_uinfo['uid'];
     if ($oldpwd = $this->input->post('oldpwd')) {
         $newpwd = $this->input->post('newpwd');
         $newpwd_confirm = $this->input->post('newpwd_confirm');
         if (is_string($passwd_msg = is_password($newpwd))) {
             message($passwd_msg);
         }
         if ($newpwd != $newpwd_confirm) {
             message('新密碼兩次輸入不一致!');
         }
         $query = $this->db->select('password')->get_where('student', array('uid' => $uid));
         $user = $query->row_array();
         if ($user['password'] !== my_md5($oldpwd)) {
             message('原密碼錯誤!');
         }
         $this->db->update('student', array('password' => my_md5($newpwd)), array('uid' => $uid));
         message('密碼修改成功!', 'student/profile/preview', 'success');
     } else {
         $this->load->view('profile/editpwd', $data);
     }
 }
開發者ID:Vincent-Shen,項目名稱:origin,代碼行數:32,代碼來源:profile.php

示例15: message

         $mobile = $user['authvalue'];
         $r = $db->get_one("SELECT userid FROM {$DT_PRE}member WHERE mobile='{$mobile}' AND vmobile=1 AND userid<>{$_userid}");
         if ($r) {
             message($L['send_mobile_exist'], $MOD['linkurl']);
         }
         $db->query("UPDATE {$DT_PRE}member SET mobile='{$mobile}',vmobile=1,auth='',authvalue='',authtime=0 WHERE username='{$username}'");
         userclean($username);
         $db->query("INSERT INTO {$DT_PRE}validate (type,username,ip,addtime,status,title,editor,edittime) VALUES ('mobile','{$username}','{$DT_IP}','{$DT_TIME}','3','{$mobile}','system','{$DT_TIME}')");
         message($L['send_mobile_success'], $MOD['linkurl']);
     }
     message($L['send_mobile_code_error']);
 } else {
     $DT['sms'] or message($L['send_sms_close']);
     if ($submit) {
         is_mobile($mobile) or message($L['send_mobile_bad']);
         if (!is_password($username, $password)) {
             message($L['member_login_password_bad']);
         }
         $r = $db->get_one("SELECT userid FROM {$DT_PRE}member WHERE mobile='{$mobile}' AND vmobile=1 AND userid<>{$_userid}");
         if ($r) {
             message($L['send_mobile_exist']);
         }
         if (max_sms($mobile)) {
             message($L['sms_msg_max']);
         }
         $auth = random(6, '0123456789');
         $content = lang('sms->sms_code', array($auth, $MOD['auth_days'] * 10)) . $DT['sms_sign'];
         $sms_code = send_sms($mobile, $content);
         if (1 || strpos($sms_code, $DT['sms_ok']) !== false) {
             $db->query("UPDATE {$DT_PRE}member SET auth='{$auth}',authvalue='{$mobile}',authtime='{$DT_TIME}' WHERE username='{$username}'");
             userclean($username);
開發者ID:hiproz,項目名稱:zhaotaoci.cc,代碼行數:31,代碼來源:send.inc.php


注:本文中的is_password函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。