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


PHP UserAccount::LoadByUsername方法代碼示例

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


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

示例1: btnLogin_Click

 protected function btnLogin_Click($strFormId, $strControlId, $strParameter)
 {
     $blnError = false;
     $strUsername = $this->txtUsername->Text;
     $strPassword = $this->txtPassword->Text;
     $objUserAccount = UserAccount::LoadByUsername($strUsername);
     $errorMessage = 'Invalid username or password.';
     $objHasher = new PasswordHash(8, PORTABLE_PASSWORDS);
     // Check if that username exists
     if (!$objUserAccount) {
         $blnError = true;
         $this->txtPassword->Warning = $errorMessage;
     } elseif (!$objUserAccount->ActiveFlag) {
         $blnError = true;
         $this->txtPassword->Warning = $errorMessage;
     } elseif (!$objHasher->CheckPassword(sha1($strPassword), $objUserAccount->PasswordHash)) {
         $blnError = true;
         $this->txtPassword->Warning = $errorMessage;
     } else {
         QApplication::Login($objUserAccount);
         $objAssetRoleModule = RoleModule::LoadByRoleIdModuleId($objUserAccount->RoleId, 2);
         $objInventoryRoleModule = RoleModule::LoadByRoleIdModuleId($objUserAccount->RoleId, 3);
         $objContactsRoleModule = RoleModule::LoadByRoleIdModuleId($objUserAccount->RoleId, 4);
         $objShippingRoleModule = RoleModule::LoadByRoleIdModuleId($objUserAccount->RoleId, 5);
         $objReceivingRoleModule = RoleModule::LoadByRoleIdModuleId($objUserAccount->RoleId, 6);
         $objReportsRoleModule = RoleModule::LoadByRoleIdModuleId($objUserAccount->RoleId, 7);
         if (array_key_exists('strReferer', $_GET)) {
             QApplication::Redirect($_GET['strReferer']);
         } else {
             if ($objAssetRoleModule->AccessFlag) {
                 // If the user has access to the assets module, send them there, otherwise...
                 QApplication::Redirect('./assets/');
             } else {
                 if ($objInventoryRoleModule->AccessFlag) {
                     Qapplication::Redirect('./inventory/');
                 } else {
                     if ($objContactsRoleModule->AccessFlag) {
                         Qapplication::Redirect('./contacts/');
                     } else {
                         if ($objShippingRoleModule->AccessFlag) {
                             Qapplication::Redirect('./shipping/');
                         } else {
                             if ($objReceivingRoleModule->AccessFlag) {
                                 Qapplication::Redirect('./receiving/');
                             } else {
                                 if ($objReportsRoleModule->AccessFlag) {
                                     Qapplication::Redirect('./reports/');
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
開發者ID:jdellinger,項目名稱:tracmor,代碼行數:56,代碼來源:login.php

示例2: btnLogin_Click

 protected function btnLogin_Click($strFormId, $strControlId, $strParameter)
 {
     if ($_SERVER['REMOTE_ADDR'] != "127.0.0.1" && substr($_SERVER['REMOTE_ADDR'], 0, 8) != "192.168.") {
         $ip_array = json_decode(file_get_contents("http://192.168.1.168:8888/eBayBO/service.php?action=getClientIp"));
         //file_put_contents("/tmp/xx.log", print_r($ip_array, true));
         if (!in_array($_SERVER['REMOTE_ADDR'], $ip_array)) {
             $blnError = true;
             $this->txtUsername->Warning = QApplication::Translate('Invalid username or password.');
             return 0;
         }
     }
     $blnError = false;
     $strUsername = $this->txtUsername->Text;
     $strPassword = $this->txtPassword->Text;
     $objUserAccount = UserAccount::LoadByUsername($strUsername);
     $errorMessage = QApplication::Translate('Invalid username or password.');
     // Check if that username exists
     if (!$objUserAccount) {
         $blnError = true;
         $this->txtUsername->Warning = $errorMessage;
     } elseif (!$objUserAccount->ActiveFlag) {
         $blnError = true;
         $this->txtUsername->Warning = $errorMessage;
     } elseif (sha1($strPassword) != $objUserAccount->PasswordHash) {
         $blnError = true;
         $this->txtPassword->Warning = $errorMessage;
     } else {
         QApplication::Login($objUserAccount);
         // If the user has access to the assets module, send them there. Otherwise, send them to the home module.
         $objRoleModule = RoleModule::LoadByRoleIdModuleId($objUserAccount->RoleId, 2);
         if ($objRoleModule->AccessFlag) {
             QApplication::Redirect('./inventory/');
         } else {
             Qapplication::Redirect('./home/');
         }
     }
 }
開發者ID:heshuai64,項目名稱:einv2,代碼行數:37,代碼來源:login.php

示例3: btnLogin_Click

 protected function btnLogin_Click($strFormId, $strControlId, $strParameter)
 {
     $blnError = false;
     $strUsername = $this->txtUsername->Text;
     $strPassword = $this->txtPassword->Text;
     $objUserAccount = UserAccount::LoadByUsername($strUsername);
     $errorMessage = 'Invalid username or password.';
     // Check if that username exists
     if (!$objUserAccount) {
         $blnError = true;
         $this->txtPassword->Warning = $errorMessage;
     } elseif (!$objUserAccount->ActiveFlag) {
         $blnError = true;
         $this->txtPassword->Warning = $errorMessage;
     } elseif (!QApplication::CheckPassword(sha1($strPassword), $objUserAccount->PasswordHash)) {
         $blnError = true;
         $this->txtPassword->Warning = $errorMessage;
     } else {
         QApplication::Login($objUserAccount);
         $objAssetRoleModule = RoleModule::LoadByRoleIdModuleId($objUserAccount->RoleId, 2);
         $objInventoryRoleModule = RoleModule::LoadByRoleIdModuleId($objUserAccount->RoleId, 3);
         $objContactsRoleModule = RoleModule::LoadByRoleIdModuleId($objUserAccount->RoleId, 4);
         $objShippingRoleModule = RoleModule::LoadByRoleIdModuleId($objUserAccount->RoleId, 5);
         $objReceivingRoleModule = RoleModule::LoadByRoleIdModuleId($objUserAccount->RoleId, 6);
         $objReportsRoleModule = RoleModule::LoadByRoleIdModuleId($objUserAccount->RoleId, 7);
         $strRedirect = '';
         $intModule = null;
         if (array_key_exists('strReferer', $_GET)) {
             $strRedirect = $_GET['strReferer'];
         } else {
             if ($objAssetRoleModule->AccessFlag) {
                 // If the user has access to the assets module, send them there, otherwise...
                 $strRedirect = __SUBDIRECTORY__ . '/assets/';
                 $intModule = 2;
             } else {
                 if ($objInventoryRoleModule->AccessFlag) {
                     $strRedirect = __SUBDIRECTORY__ . '/inventory/';
                     $intModule = 3;
                 } else {
                     if ($objContactsRoleModule->AccessFlag) {
                         $strRedirect = __SUBDIRECTORY__ . '/contacts/';
                         $intModule = 4;
                     } else {
                         if ($objShippingRoleModule->AccessFlag) {
                             $strRedirect = __SUBDIRECTORY__ . '/shipping/';
                             $intModule = 5;
                         } else {
                             if ($objReceivingRoleModule->AccessFlag) {
                                 $strRedirect = __SUBDIRECTORY__ . '/receiving/';
                                 $intModule = 6;
                             } else {
                                 if ($objReportsRoleModule->AccessFlag) {
                                     $strRedirect = __SUBDIRECTORY__ . '/reports/';
                                     $intModule = 7;
                                 }
                             }
                         }
                     }
                 }
             }
         }
         QApplication::Redirect($strRedirect);
     }
 }
開發者ID:proxymoron,項目名稱:tracmor,代碼行數:64,代碼來源:login.php


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