当前位置: 首页>>代码示例>>PHP>>正文


PHP UserModel::update方法代码示例

本文整理汇总了PHP中UserModel::update方法的典型用法代码示例。如果您正苦于以下问题:PHP UserModel::update方法的具体用法?PHP UserModel::update怎么用?PHP UserModel::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserModel的用法示例。


在下文中一共展示了UserModel::update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: indexAction

 public function indexAction()
 {
     $p = $_REQUEST;
     $pNewptxt = empty($p['newptxt']) ? '' : trim($p['newptxt']);
     $pOldptxt = empty($p['oldptxt']) ? '' : trim($p['oldptxt']);
     $tTime = time();
     if (empty($pOldptxt)) {
         Tool_Fnc::ajaxMsg('请输入旧密码');
     }
     if (empty($pNewptxt)) {
         Tool_Fnc::ajaxMsg('请输入新密码');
     }
     $tUMO = new UserModel();
     $tRow = $tUMO->field('id,passwd,private_key')->where('id = ' . $this->tUid)->fRow();
     if (!count($tRow)) {
         Tool_Fnc::ajaxMsg('读取信息失败');
     }
     $tOldptxt = Tool_Fnc::markmd5($pOldptxt, $tRow['private_key']);
     if ($tRow['passwd'] != $tOldptxt) {
         Tool_Fnc::ajaxMsg('旧密码不正确');
     }
     $tKey = Tool_Fnc::newrand(4);
     $tMd5str = Tool_Fnc::markmd5($pNewptxt, $tKey);
     $tData = array('id' => $tRow['id'], 'passwd' => $tMd5str, 'private_key' => $tKey, 'updated' => $tTime);
     if ($tUMO->update($tData)) {
         Tool_Fnc::ajaxMsg('密码修改成功', 1);
     }
     Tool_Fnc::ajaxMsg('密码修改失败');
 }
开发者ID:tanqinwang,项目名称:test_own,代码行数:29,代码来源:Editpwd.php

示例2: updateUser

 public function updateUser($inputData)
 {
     //TODO::datacheck
     $data = ['name' => $inputData['name'], 'email' => $inputData['email']];
     $where = ['id' => $inputData['id']];
     return $this->userDao->update($data, $where);
 }
开发者ID:loncool,项目名称:yaf-admin,代码行数:7,代码来源:Manage.php

示例3: indexAction

 public function indexAction()
 {
     $p = $_REQUEST;
     $pPhone = empty($p['phone']) ? '' : trim($p['phone']);
     $pNewptxt = empty($p['newptxt']) ? '' : trim($p['newptxt']);
     $pCode = empty($p['code']) ? '' : intval(trim($p['code']));
     $tTime = time();
     if (empty($pPhone)) {
         Tool_Fnc::ajaxMsg('请输入手机号码');
     }
     if (empty($pNewptxt)) {
         Tool_Fnc::ajaxMsg('请输入新密码');
     }
     if (!Tool_Validate::mo($pPhone)) {
         Tool_Fnc::ajaxMsg('手机号不正确');
     }
     $tMO = new UserModel();
     $tRow = $tMO->field('*')->where('phone = \'' . $pPhone . '\'')->fRow();
     if (empty($tRow['id'])) {
         Tool_Fnc::ajaxMsg('用户不存在');
     }
     $tCodeMO = new PhonecodeModel();
     $tCodeCRow = $tCodeMO->check($pPhone, 2, $pCode);
     if ($tCodeCRow['status'] == 0) {
         Tool_Fnc::ajaxMsg($tCodeCRow['msg']);
     }
     $tKey = Tool_Fnc::newrand(4);
     $tMd5str = Tool_Fnc::markmd5($pNewptxt, $tKey);
     $tData = array('passwd' => $tMd5str, 'id' => $tRow['id'], 'private_key' => $tKey);
     if ($tMO->update($tData)) {
         Tool_Fnc::ajaxMsg('密码修改成功', 1);
     }
     Tool_Fnc::ajaxMsg('密码修改失败');
 }
开发者ID:tanqinwang,项目名称:test_own,代码行数:34,代码来源:Repwd.php

示例4: editAction

 public function editAction()
 {
     if (!isset($_POST['name']) && !isset($_POST['firstname']) && !isset($_POST['pseudo']) && !isset($_POST['mdp']) && !isset($_POST['email']) && !isset($_SESSION['id_user'])) {
         return json_encode(["error" => "something is missing"]);
     }
     //$id_user = $_POST['id_user']; // A mettre quand connexion
     $id_user = 1;
     // A enlever quand connexion good
     $name_user = strip_tags($_POST['name']);
     $name_user = htmlentities($name_user);
     $name_user = trim($name_user);
     $firstname_user = strip_tags($_POST['firstname']);
     $firstname_user = htmlentities($firstname_user);
     $firstname_user = trim($firstname_user);
     $pseudo_user = strip_tags($_POST['pseudo']);
     $pseudo_user = htmlentities($pseudo_user);
     $pseudo_user = trim($pseudo_user);
     $mdp_user = strip_tags($_POST['password_user']);
     $mdp_user = htmlentities($mdp_user);
     $mdp_user = trim($mdp_user);
     $email_user = strip_tags($_POST['email']);
     $email_user = htmlentities($email_user);
     $email_user = trim($email_user);
     $id_article = UserModel::update($this->pdo, $name_user, $firstname_user, $pseudo_user, $mdp_user, $email_user, $id_user);
     return json_encode(["message" => "Connecté !", "id_user" => $id_user, "name_user" => $name_user, "password_user" => $mdp_user]);
 }
开发者ID:Sladeck,项目名称:Blog,代码行数:26,代码来源:UserController.php

示例5: editAction

 public function editAction()
 {
     $p = $_REQUEST;
     $pWeight = empty($p['weight']) ? Tool_Fnc::ajaxMsg('干体重不能为空') : floatval($p['weight']);
     $tTime = time();
     $tDWLMO = new DryweightlogModel();
     $tDWLRow = $tDWLMO->field('id')->where('uid = ' . $this->tUid . ' and date = \'' . date('Y-m-d', $tTime) . '\'')->fRow();
     $tUMO = new UserModel();
     $tURow = $tUMO->field('user_type')->where(' id = ' . $this->tUid)->fRow();
     if ($tURow['user_type'] == 1) {
         Tool_Fnc::ajaxMsg('操作异常');
     }
     $tData = array('weight' => $pWeight);
     if (empty($tDWLRow['id'])) {
         $tData = array_merge($tData, array('created' => $tTime, 'uid' => $this->tUid, 'date' => date('Y-m-d', $tTime), 'year' => date('Y', $tTime), 'month' => date('Y-m', $tTime)));
     } else {
         $tData = array_merge($tData, array('updated' => $tTime, 'id' => $tDWLRow['id']));
     }
     $tUMO->begin();
     if (!$tDWLMO->save($tData)) {
         $tUMO->back();
         Tool_Fnc::ajaxMsg('修改失败 001');
     }
     $tUData = array('id' => $this->tUid, 'dry_weight' => $pWeight, 'updated' => $tTime);
     if (!$tUMO->update($tUData)) {
         $tUMO->back();
         Tool_Fnc::ajaxMsg('修改失败 002');
     }
     $tUMO->commit();
     Tool_Fnc::ajaxMsg('操作成功', 1);
 }
开发者ID:tanqinwang,项目名称:test_own,代码行数:31,代码来源:Dryweight.php

示例6: onsetting

 function onsetting()
 {
     $email = $_POST['eamil'];
     $user = new UserModel();
     if ($user->update(array("email" => $email), array("uid" => $_SESSION['uid']))) {
         cpmsg("更新成功");
     }
 }
开发者ID:QardenEden,项目名称:xssing,代码行数:8,代码来源:Xing.Action.php

示例7: modify

 static function modify($id, $data)
 {
     if (!$id || !$data) {
         return false;
     }
     $model = new UserModel();
     $result = $model->update($id, $data);
     return $result;
 }
开发者ID:jianchengdu,项目名称:dangjia,代码行数:9,代码来源:UserData.php

示例8: LoginByPass

 public static function LoginByPass($login, $pass)
 {
     $user = UserModel::Login($login, $pass);
     if ($user->id > 0) {
         self::$id = $user->id;
         self::$login = $user->login;
         self::$company_id = $user->companyid;
         $hash = self::NewHash($arr['id']);
         setcookie('userid', $hash, time() + 360000, '/');
         UserModel::update(['hash' => $hash])->id($user->id);
     }
 }
开发者ID:kekstlt,项目名称:promspace,代码行数:12,代码来源:user.php

示例9: review

 public function review()
 {
     if ($this->isLogged()) {
         $this->load->model('UserModel');
         $user = new UserModel();
         $data = $user->search($this->session->userdata('userid'));
         $data['help'] = true;
         if ($user->update($data)) {
             redirect(base_url('help'));
         }
     }
 }
开发者ID:asvinicius,项目名称:ccb,代码行数:12,代码来源:Help.php

示例10: updateMissingData

 public function updateMissingData($user, array $me)
 {
     $updateData = array();
     if (empty($user['name'])) {
         $updateData['name'] = $me['first_name'];
     }
     if (empty($user['fbuid'])) {
         $updateData['fbuid'] = $me['id'];
     }
     if (!empty($updateData)) {
         UserModel::update($user['id'], $updateData);
     }
 }
开发者ID:oaki,项目名称:demoshop,代码行数:13,代码来源:FacebookAuthenticator.php

示例11: indexAction

 public function indexAction()
 {
     echo '<pre>';
     $tTime = time();
     $tH = date('H', $tTime);
     $tWhere = ' and PUNCTURE_NURSE is not NULL';
     if ($tH >= 22 && $tH <= 23) {
         $tWhere = '';
     }
     $tTRMO = new BqetreatmentrecordModel();
     $tUAMO = new UserassessmentModel();
     $tDWLMO = new DryweightlogModel();
     $tUMO = new UserModel();
     $tOci = new Orm_Oci();
     $tHSql = 'select patient_id,treatment_times,fluid_volume,dialyzer,dialysis_mach,volume_na,volume_ca,volume_hc,volume_quantity,vascular_access,body_weight,bodyweight_bef,bodyweight_increase,ultrafilt_quantity,ufr,treat_time,blood_quantity,first_agent,maitain,additional,total_quantity,t,p,r,bp1,bp2,actual_treat_time,bodyweight_after,actual_ultrafilt_quantity,t_after,p_after,bp1_after,bp2_after,treate_summary,puncture_nurse,treate_nurse,doctor_user,to_char(treate_date,\'YYYY-mm-dd\') treate_date,treate_mode,dfz,vein_puncture,artery_puncture,kidney_solidification,dialyze_allergy,takeoff_needle from  treatment_record where to_char(TREATE_DATE,\'YYYY-mm-dd\')  = \'' . date('Y-m-d', $tTime) . '\' ' . $tWhere;
     #$tHSql = 'select patient_id,treatment_times,fluid_volume,dialyzer,dialysis_mach,volume_na,volume_ca,volume_hc,volume_quantity,vascular_access,body_weight,bodyweight_bef,bodyweight_increase,ultrafilt_quantity,ufr,treat_time,blood_quantity,first_agent,maitain,additional,total_quantity,t,p,r,bp1,bp2,actual_treat_time,bodyweight_after,actual_ultrafilt_quantity,t_after,p_after,bp1_after,bp2_after,treate_summary,puncture_nurse,treate_nurse,doctor_user,to_char(treate_date,\'YYYY-mm-dd\') treate_date,treate_mode,dfz,vein_puncture,artery_puncture,kidney_solidification,dialyze_allergy,takeoff_needle from  treatment_record where to_char(TREATE_DATE,\'YYYY-mm-dd\')  between \'2015-10-08\' and \'2015-12-08\'';
     $tDatas = $tOci->getAll($tHSql);
     foreach ($tDatas as $tRow) {
         $tTRRow = $tTRMO->field('count(0) c')->where('patient_id = \'' . $tRow['PATIENT_ID'] . '\' and treate_date = \'' . $tRow['TREATE_DATE'] . '\'')->fRow();
         if (!empty($tTRRow['c'])) {
             continue;
         }
         foreach ($tRow as $k => $v) {
             $k = strtolower($k);
             $tData[$k] = $v;
         }
         $tUARow = $tUAMO->field('uid')->where('patient_id = \'' . $tRow['PATIENT_ID'] . '\'')->fRow();
         $tData['uid'] = empty($tUARow['uid']) ? 0 : $tUARow['uid'];
         echo $tTRMO->insert($tData);
         echo "\r\n";
         if (empty($tRow['BODY_WEIGHT'])) {
             continue;
         }
         if (!empty($tUid) && date('Y-m-d', $tTime) == $tRow['TREATE_DATE']) {
             #用户存在 并且干体重记录日期是今日 的话更新用户信息表
             $tData = array('id' => $tUid, 'dry_weight' => $tRow['BODY_WEIGHT']);
             $tUMO->update($tData);
         }
         $tDWLRow = $tDWLMO->field('id')->where('patient_id = \'' . $tRow['PATIENT_ID'] . '\' and date = \'' . $tRow['TREATE_DATE'] . '\'')->fRow();
         if (!empty($tDWLRow['id'])) {
             $tData = array('id' => $tDWLRow['id'], 'weight' => $tRow['BODY_WEIGHT'], 'updated' => $tTime);
             $tDWLMO->update($tData);
         } else {
             #干体重log
             $tData = array('weight' => $tRow['BODY_WEIGHT'], 'created' => $tTime, 'date' => $tRow['TREATE_DATE'], 'month' => date('Y-m', strtotime($tRow['TREATE_DATE'])), 'year' => date('Y', strtotime($tRow['TREATE_DATE'])), 'patient_id' => $tRow['PATIENT_ID']);
             $tDWLMO->insert($tData);
         }
     }
     exit;
 }
开发者ID:tanqinwang,项目名称:test_own,代码行数:50,代码来源:Bqetreatmentrecord.php

示例12: updateMissingData

 public function updateMissingData($user, array $google_user)
 {
     $updateData = array();
     if (empty($user['name'])) {
         $updateData['name'] = $google_user['name'];
     }
     if (empty($user['surname']) or $user['surname'] == '') {
         $updateData['surname'] = $google_user['family_name'];
     }
     if (empty($user['google_id'])) {
         $updateData['google_id'] = $google_user['id'];
     }
     if (!empty($updateData)) {
         UserModel::update($user['id'], $updateData);
     }
 }
开发者ID:oaki,项目名称:demoshop,代码行数:16,代码来源:GoogleAccountAuthenticator.php

示例13: profile_update

 /**
  * Updates the user data
  *
  * @global type $STRINGS
  * @param type $params
  */
 public function profile_update($params)
 {
     global $STRINGS;
     $userid = array_shift($params);
     //remove url params
     $params = array_slice($params, 1);
     //check if the password is set
     if (empty($params['password'])) {
         //no password is provided -> remove key
         unset($params['password']);
     } else {
         //compute new password and store
         $params['password'] = sha1($params['password']);
     }
     $success = UserModel::update($userid, $params);
     $success == true ? $alert = BootstrapHelper::alert('success', $STRINGS['event:success'], $STRINGS['user:update:success']) : ($alert = BootstrapHelper::alert('error', $STRINGS['event:error'], $STRINGS['user:update:failed']));
     //refresh the user data
     $this->_data->user = UserModel::find($userid);
     new UserProfileView($this->_data, $alert);
 }
开发者ID:robertboloc,项目名称:presence-manager,代码行数:26,代码来源:UserController.php

示例14: authenticate

    /**
     * Performs an authentication
     *
     * @param  array
     * @return void
     * @throws AuthenticationException
     */
    public function authenticate(array $credentials)
    {
        $username = $credentials[self::USERNAME];
        $password = $credentials[self::PASSWORD];
        $sql = dibi::query('
			SELECT *,
				' . TABLE_USERS . '.id AS id
			FROM
				[' . TABLE_USERS . ']
				LEFT JOIN [' . TABLE_USERS_INFO . '] ON (' . TABLE_USERS . '.id = ' . TABLE_USERS_INFO . '.user_id)
			WHERE login=%s;', $username);
        $sql->setType('permission', Dibi::BOOL);
        $row = $sql->fetch();
        /*if (count($sql)==0) {
              throw new AuthenticationException('Unknown user', self::IDENTITY_NOT_FOUND);
          }*/
        /*if ($row->password !== md5($password)) {
              throw new AuthenticationException('Password not match', self::INVALID_CREDENTIAL);
          }*/
        /* ak to bolo stratene heslo */
        if (count($sql) == 1 and $row->new_password == self::getHash($password)) {
            UserModel::update($row->id, array('password' => self::getHash($password), 'new_password' => NULL));
            $row->password = $row->new_password;
        }
        if (count($sql) == 0 or $row->password !== self::getHash($password)) {
            throw new NAuthenticationException('Nespráne heslo alebo meno.', self::INVALID_CREDENTIAL);
        }
        // get roles
        $sql = dibi::query('SELECT r.key_name
                                FROM [' . TABLE_ROLES . '] AS r
                                RIGHT JOIN [' . TABLE_USERS_ROLES . '] AS us ON r.id=us.role_id
                                WHERE us.user_id=%i;', $row->id);
        $roles = $sql->fetchPairs();
        unset($row->password);
        return new NIdentity($username, $roles, $row);
    }
开发者ID:oaki,项目名称:demoshop,代码行数:43,代码来源:UserModel.php

示例15: editAction

 public function editAction()
 {
     $p = $_REQUEST;
     $tUMO = new UserModel();
     $tURow = $tUMO->field('user_type')->where(' id = ' . $this->tUid)->fRow();
     if ($tURow['user_type'] == 1) {
         Tool_Fnc::ajaxMsg('操作异常');
     }
     $tData = array();
     if (isset($p['name'])) {
         $tData = array_merge($tData, array('nickname' => Tool_Fnc::safe_string($p['name'])));
     }
     if (isset($p['date_of_birth'])) {
         $tData = array_merge($tData, array('date_of_birth' => date('Y-m-d', strtotime($p['date_of_birth']))));
     }
     if (isset($p['sex'])) {
         $tData = array_merge($tData, array('sex' => intval($p['sex'])));
     }
     $tTime = time();
     //存在干体重修改,则更新干体重记录
     $pDryWeight = !isset($p['dry_weight']) ? '' : floatval($p['dry_weight']);
     $tUMO->begin();
     if (!empty($pDryWeight)) {
         $tData = array_merge($tData, array('dry_weight' => $pDryWeight));
         $tDWLMO = new DryweightlogModel();
         $tDWLRow = $tDWLMO->field('id')->where('uid = ' . $this->tUid . ' and date = \'' . date('Y-m-d', $tTime) . '\'')->fRow();
         if (empty($tDWLRow['id'])) {
             $tDWLData = array('weight' => $pDryWeight, 'uid' => $this->tUid, 'created' => $tTime, 'date' => date('Y-m-d', $tTime), 'month' => date('Y-m', $tTime), 'year' => date('Y', $tTime));
         } else {
             $tDWLData = array('weight' => $pDryWeight, 'updated' => $tTime, 'id' => $tDWLRow['id']);
         }
         if (!$tDWLMO->save($tDWLData)) {
             $tUMO->back();
             Tool_Fnc::ajaxMsg('修改失败 001');
         }
     }
     //存在名字修改,则更新健康档案中的名字字段
     if (isset($p['name']) && !empty($p['name'])) {
         $tUAMO = new UserassessmentModel();
         $tUARow = $tUAMO->field('id,name')->where('uid = ' . $this->tUid)->fRow();
         if (!empty($tUARow['id'])) {
             $tUADatas = array('id' => $tUARow['id'], 'name' => Tool_Fnc::safe_string($p['name']), 'updated' => $tTime);
             if (!$tUAMO->update($tUADatas)) {
                 $tUMO->back();
                 Tool_Fnc::ajaxMsg('修改失败 002');
             }
         } else {
             $tUADatas = array('uid' => $this->tUid, 'name' => Tool_Fnc::safe_string($p['name']), 'created' => $tTime);
             if (!$tUAMO->insert($tUADatas)) {
                 $tUMO->back();
                 Tool_Fnc::ajaxMsg('修改失败 002');
             }
         }
     }
     $tData = array_merge($tData, array('id' => $this->tUid, 'updated' => $tTime));
     if (!$tUMO->update($tData)) {
         $tUMO->back();
         Tool_Fnc::ajaxMsg('修改失败 003');
     }
     $tUMO->commit();
     Tool_Fnc::ajaxMsg('操作成功', 1);
 }
开发者ID:tanqinwang,项目名称:test_own,代码行数:62,代码来源:User.php


注:本文中的UserModel::update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。