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


PHP MySQLDatabase::GetRow方法代碼示例

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


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

示例1: Process


//.........這裏部分代碼省略.........
                         $barID = array_shift($path);
                         if (!array_key_exists($barID, $this->Bars)) {
                             $this->RefreshBars();
                         }
                         if (array_key_exists($barID, $this->Bars)) {
                             $this->Bars[$barID]->Process($server, $path, $headers);
                         } else {
                             APIResponse(RESPONSE_404, "Bar {$barID} not found.");
                         }
                     }
                     break;
                 case 'ingredients':
                     if (empty($path)) {
                         switch ($method) {
                             case "GET":
                             case "POST":
                                 $handler = $method . "_Ingredients";
                                 if (method_exists($this, $handler)) {
                                     $this->{$handler}();
                                 } else {
                                     APIResponse(RESPONSE_404, "Could not find ingredients handler {$handler}.");
                                 }
                                 break;
                             default:
                                 APIResponse(RESPONSE_400, "Bad ingredient request method.");
                                 break;
                         }
                     } else {
                         $ingredientID = array_shift($path);
                         if (!array_key_exists($ingredientID, $this->Ingredients)) {
                             $this->RefreshIngredients();
                         }
                         if (array_key_exists($ingredientID, $this->Ingredients)) {
                             $this->Ingredients[$ingredientID]->Process($server, $path, $headers);
                         } else {
                             APIResponse(RESPONSE_404, "Ingredient {$ingredientID} not found.");
                         }
                     }
                     break;
                 case 'logout':
                     $this->auth = false;
                     header("Clear-Authorization: true");
                     APIResponse(RESPONSE_200);
                     //TODO: Destroy the session as well.
                     break;
                 default:
                     break;
             }
         } else {
             switch ($method) {
                 case "GET":
                 case "PUT":
                     $handler = $method;
                     if (method_exists($this, $handler)) {
                         $this->{$handler}();
                     } else {
                         APIResponse(RESPONSE_404, "Could not find session handler {$handler}.");
                     }
                     break;
             }
         }
     } else {
         if (!empty($path)) {
             $item = array_shift($path);
             switch ($item) {
                 case 'login':
                     $username = getParam('username');
                     $password = getParam('password');
                     if ($username && $password) {
                         $username = $this->DB->Quote($username);
                         $password = $this->DB->Quote($password);
                         $login = $this->DB->GetRow("SELECT * FROM tblUsers WHERE username={$username} AND password={$password};");
                         if ($login && (int) $login['id']) {
                             $this->auth = sha1(uniqid('randomsalt', true));
                             $this->ID = (int) $login['id'];
                             $this->Username = $login['username'];
                             $this->DisplayName = $login['displayName'];
                             header("Set-Authorization: {$this->auth}");
                             APIResponse(RESPONSE_200, "Your name is {$this->DisplayName}");
                         } else {
                             APIResponse(RESPONSE_401, 'Invalid Credentials');
                         }
                     } else {
                         APIResponse(RESPONSE_401, 'No user or password given.  ' . file_get_contents('php://input'));
                     }
                     break;
                 default:
                     APIResponse(RESPONSE_401, 'You are not logged in.');
                     break;
             }
         } else {
             switch ($method) {
                 default:
                     APIResponse(RESPONSE_401, 'You are not logged in.');
                     break;
             }
         }
     }
     APIResponse(RESPONSE_400);
 }
開發者ID:bnorm-software,項目名稱:barkeep-backend,代碼行數:101,代碼來源:CLASS_Session.php


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