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


PHP UserClass::getByEmail方法代碼示例

本文整理匯總了PHP中UserClass::getByEmail方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserClass::getByEmail方法的具體用法?PHP UserClass::getByEmail怎麽用?PHP UserClass::getByEmail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UserClass的用法示例。


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

示例1: handler

 function handler()
 {
     $messages = parent::handler();
     if ($messages["status"] == "success" && !empty($this->_FORMDATA)) {
         foreach ($this->_FORMDATA as $name => $value) {
             if ($name == "email") {
                 $user = UserClass::getByEmail($value);
                 if ($user !== false) {
                     $error_message[] = "Пользователь с таким email уже зарегистрирован";
                 }
             } else {
                 if ($name == "login") {
                     $user = UserClass::getByLogin($value);
                     if ($user !== false) {
                         $error_message[] = "Пользователь с таким логином уже зарегистрирован";
                     }
                 }
             }
         }
         if ($error_message) {
             $messages["status"] = "error";
             $messages["error"] = $error_message;
             unset($messages["success"]);
         } else {
             $arFields = array("login" => $this->_FORMDATA["login"], "email" => $this->_FORMDATA["email"], "full_name" => $this->_FORMDATA["full_name"], "pass" => $this->_FORMDATA["pass"], "active" => false, "code" => md5(date("Y-m-d H:i:s")));
             UserClass::createUser($arFields);
             $messages["success"] = "Спасибо за регистрацию. На Ваш email выслано письмо для активации аккаунта.";
             MailController::RegisterMail($this->_FORMDATA["email"], $arFields["code"]);
         }
     }
     return $messages;
 }
開發者ID:Nimoto,項目名稱:rss-reader,代碼行數:32,代碼來源:RegisterFormController.php

示例2: handler

 function handler()
 {
     $messages = parent::handler();
     $_USER = UserClass::getById($this->_FORMDATA["id"]);
     if ($messages["status"] == "success" && !empty($this->_FORMDATA)) {
         foreach ($this->_FORMDATA as $name => $value) {
             if ($name == "email" && $value != $_USER->getProperty("email")) {
                 $user = UserClass::getByEmail($value);
                 if ($user !== false) {
                     $error_message[] = "Пользователь с таким email уже зарегистрирован";
                 }
             } else {
                 if ($name == "login" && $value != $_USER->getProperty("login")) {
                     $user = UserClass::getByLogin($value);
                     if ($user !== false) {
                         $error_message[] = "Пользователь с таким логином уже зарегистрирован";
                     }
                 }
             }
         }
         if ($error_message) {
             $messages["status"] = "error";
             $messages["error"] = $error_message;
             unset($messages["success"]);
         } else {
             $arFields = array("id" => $this->_FORMDATA["id"], "login" => $this->_FORMDATA["login"], "email" => $this->_FORMDATA["email"], "full_name" => $this->_FORMDATA["full_name"], "pass" => $this->_FORMDATA["pass"], "active" => 1);
             UserClass::updateUser($arFields);
             $messages["success"] = "Информация обновлена.";
         }
     }
     return $messages;
 }
開發者ID:Nimoto,項目名稱:rss-reader,代碼行數:32,代碼來源:UpdateFormController.php


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