added server Method getServerLoginByIndex

This commit is contained in:
kremsy 2015-06-16 21:40:56 +02:00
parent d887488f04
commit e5278e6987

View File

@ -226,6 +226,30 @@ class Server implements CallbackListener {
return $servers;
}
/** Get Server Login by Index
*
* @param int $index
* @return string
*/
public function getServerLoginByIndex($index) {
$mysqli = $this->maniaControl->getDatabase()->getMysqli();
$query = "SELECT * FROM `" . self::TABLE_SERVERS . "` WHERE `index`=" . $index . ";";
$result = $mysqli->query($query);
if (!$result) {
trigger_error($mysqli->error);
return "";
}
if ($result->num_rows != 1) {
return "";
}
$row = $result->fetch_object();
return $row->login;
}
/**
* Handle OnInit Callback
*/