本文整理汇总了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);
}