当前位置: 首页>>代码示例>>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;未经允许,请勿转载。