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


PHP Generic::isValidUserName方法代码示例

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


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

示例1: userSignUp

 public function userSignUp()
 {
     if (Efiwebsetting::getData('checkOAuth') == 'yes') {
         IMBAuth::checkOAuth();
     }
     $update = !Generic::IsNullOrEmptyString($_POST['id_user']);
     $idUser = Generic::IsNullOrEmptyString($_POST['id_user']) ? "" : $_POST['id_user'];
     $fullName = Generic::mustCheck($_POST['full_name'], Keys::$ERR_USER_EMPTY_FULL_NAME);
     $userName = Generic::mustCheck($_POST['user_name'], Keys::$ERR_USER_EMPTY_NICK_NAME);
     $email = Generic::mustCheck($_POST['email'], Keys::$ERR_USER_EMPTY_EMAIL);
     $password = Generic::mustCheck($_POST['pwd'], Keys::$ERR_USER_EMPTY_PASSWORD);
     //        $password2 = Generic::mustCheck($_POST['pwd2'], Keys::$ERR_USER_EMPTY_PASSWORD_2);
     $idCuisine = Generic::mustCheck($_POST['pref_cuisine'], Keys::$ERR_USER_EMPTY_CUISINE);
     $birthday = Generic::mustCheck($_POST['birthday'], Keys::$ERR_USER_EMPTY_BIRTHDAY);
     $phoneNo = Generic::mustCheck($_POST['phone_no'], Keys::$ERR_USER_EMPTY_PHONE);
     $fbId = Generic::IsNullOrEmptyString($_POST['fb_id']) ? "" : $_POST['fb_id'];
     $latitude = Generic::getOrDefault($_POST['lat'], Keys::$DEFAULT_LATITUDE);
     $longitude = Generic::getOrDefault($_POST['long'], Keys::$DEFAULT_LONGITUDE);
     $district = Generic::getOrDefault($_POST['district'], Keys::$EMPTY);
     $city = Generic::getOrDefault($_POST['city'], Keys::$EMPTY);
     $pic = Generic::getOrDefault($_POST['pic'], Keys::$EMPTY);
     ///START OF LOVELY VALIDATION TIME
     if (!Generic::isValidUserName($userName)) {
         Generic::errorMsg(Keys::$ERR_USER_INVALID_USERNAME);
     }
     if (!Generic::isValidUserNameLength($userName)) {
         Generic::errorMsg(Keys::$ERR_USER_USERNAME_TOO_LONG);
     }
     if (!Generic::isValidEmail($email)) {
         Generic::errorMsg(Keys::$ERR_USER_INVALID_EMAIL);
     }
     if (!Generic::isValidPassword($password)) {
         Generic::errorMsg(Keys::$ERR_USER_INVALID_PASSWORD);
     }
     //        if ($password != $password2)
     //            Generic::errorMsg(Keys::$ERR_USER_CONFIRM_PASSWORD_NOT_MATCH);
     $u = new UserModel();
     $arrU = $u->getWhere("user_name='{$userName}'");
     if (count($arrU) > 0) {
         Generic::errorMsg(Keys::$ERR_USER_DUPLICATE_USERNAME);
     }
     $u1 = new UserModel();
     $arrU = $u1->getWhere("email='{$email}'");
     if (count($arrU) > 0) {
         Generic::errorMsg(Keys::$ERR_USER_DUPLICATE_EMAIL);
     }
     if ($fbId != "") {
         $u2 = new UserModel();
         $arrU = $u2->getWhere("fb_id='{$fbId}'");
         if (count($arrU) > 0) {
             Generic::errorMsg(Keys::$ERR_USER_DUPLICATE_FB_ID);
         }
     }
     ///END OF LOVELY VALIDATION TIME, HOW SAD :(
     //pagar untuk regis
     if (Efiwebsetting::getData('Doku_switch')) {
         $doku = new PaymentDoku();
         $dokuId = $doku->registerCustomer($fullName, $email, $phoneNo);
         if (!$dokuId) {
             Generic::errorMsg(Keys::$ERR_USER_FAILED_CREATE_DOKU);
         }
     }
     $user = new UserModel();
     $user->full_name = $fullName;
     $user->user_name = $userName;
     $user->email = $email;
     $user->password = $password;
     $user->id_cuisine = $idCuisine;
     $user->birthday = $birthday;
     if ($pic == "") {
         $user->pic = "";
     } else {
         $user->pic = Util::savePic($pic);
     }
     $user->phone_no = $phoneNo;
     $user->fb_id = $fbId;
     $user->latitude = $latitude;
     $user->longitude = $longitude;
     $user->district = $district;
     $user->city = $city;
     $user->last_lat = $latitude;
     $user->last_long = $longitude;
     $user->last_district = $district;
     $user->last_city = $city;
     $user->status = "1";
     $user->payment_id = $dokuId;
     //        $user->load = 1;
     $uid = $user->save();
     if (!$uid) {
         Generic::errorMsg(Keys::$ERR_USER_FAILED_CREATE);
     } else {
         Generic::saveDistrictCityFromLatLng($latitude, $longitude, $uid, false);
         $results['fb_id'] = $fbId;
         $results['id_user'] = $uid;
         //$user->id_user;
         $results['user_name'] = $userName;
         $results['full_name'] = $fullName;
         $results['email'] = $email;
         $results['pic'] = Generic::insertImageUrl($pic);
         Generic::finish($results);
//.........这里部分代码省略.........
开发者ID:CapsuleCorpIndonesia,项目名称:martabak_revolution,代码行数:101,代码来源:FEU.php

示例2: userUpdateProfile

 public function userUpdateProfile()
 {
     if (Efiwebsetting::getData('checkOAuth') == 'yes') {
         IMBAuth::checkOAuth();
     }
     $idUser = Generic::mustCheck($_POST['id_user'], "ID user required");
     $fullName = Generic::mustCheck($_POST['full_name'], "Empty Full Name");
     $userName = Generic::mustCheck($_POST['user_name'], "Empty User Name");
     $email = Generic::mustCheck($_POST['email'], "Empty Email");
     $password = Generic::mustCheck($_POST['pwd'], "Empty Password");
     $idCuisine = Generic::mustCheck($_POST['pref_cuisine'], "Cuisine Not Selected");
     $birthday = Generic::mustCheck($_POST['birthday'], "Empty Birthday");
     $phoneNo = Generic::mustCheck($_POST['phone_no'], "Empty Phone Number");
     $fbId = Generic::IsNullOrEmptyString($_POST['fb_id']) ? "" : $_POST['fb_id'];
     $latitude = Generic::IsNullOrEmptyString($_POST['lat']) ? "" : $_POST['lat'];
     $longitude = Generic::IsNullOrEmptyString($_POST['long']) ? "" : $_POST['long'];
     $district = Generic::IsNullOrEmptyString($_POST['district']) ? "" : $_POST['district'];
     $city = Generic::IsNullOrEmptyString($_POST['city']) ? "" : $_POST['city'];
     $pic = Generic::IsNullOrEmptyString($_POST['pic']) ? "" : MasterRestaurant::savePic($_POST['pic']);
     ///START OF LOVELY VALIDATION TIME
     if (!Generic::isValidUserName($userName)) {
         Generic::errorMsg("Username must only contains alphanumeric (and/or) \\'.\\', \\'-\\', \\'_\\'");
     }
     if (!Generic::isValidUserNameLength($userName)) {
         Generic::errorMsg("Max username length is 20");
     }
     if (!Generic::isValidEmail($email)) {
         Generic::errorMsg("Email format not valid");
     }
     if (!Generic::isValidPassword($password)) {
         Generic::errorMsg("Password must contain minimum 5 character and no whitespace");
     }
     $user = new UserModel();
     $user->getByID($idUser);
     if ($birthday != $user->birthday) {
         Generic::errorMsg("Birthday cannot be changed");
     }
     if ($userName != $user->user_name) {
         Generic::errorMsg("Username cannot be changed");
     }
     if (!Generic::IsNullOrEmptyString($user->fb_id) && $fbId != $user->fb_id) {
         Generic::errorMsg("Facebook cannot be changed");
     } else {
         $user->fb_id = $fbId;
     }
     ///END OF LOVELY VALIDATION TIME, HOW SAD :(
     $user->full_name = $fullName;
     $user->email = $email;
     $user->password = $password;
     $user->id_cuisine = $idCuisine;
     $user->phone_no = $phoneNo;
     if (!Generic::IsNullOrEmptyString($pic)) {
         $user->pic = $pic;
     }
     if (!Generic::IsNullOrEmptyString($latitude)) {
         $user->latitude = $latitude;
         $user->last_lat = $latitude;
     }
     if (!Generic::IsNullOrEmptyString($longitude)) {
         $user->longitude = $longitude;
         $user->last_long = $longitude;
     }
     if (!Generic::IsNullOrEmptyString($district)) {
         $user->district = $district;
         $user->last_district = $district;
     }
     if (!Generic::IsNullOrEmptyString($city)) {
         $user->city = $city;
         $user->last_city = $city;
     }
     $user->status = "1";
     $uid = $user->save();
     if (!$uid) {
         Generic::errorMsg("Failed Creating User");
     } else {
         $json['status_code'] = 1;
         $json['results']['fb_id'] = $user->fb_id;
         $json['results']['id_user'] = $idUser;
         $json['results']['user_name'] = $user->user_name;
         $json['results']['full_name'] = $user->full_name;
         $json['results']['email'] = $user->email;
         $json['results']['pic'] = Generic::insertImageUrl($user->pic);
         echo json_encode($json);
         die;
     }
 }
开发者ID:CapsuleCorpIndonesia,项目名称:martabak_revolution,代码行数:86,代码来源:User.php


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