public function __construct($id) { if (UserManager::existsById($id)) { $con = Database::getCon(); $res = $con->query("SELECT * FROM users WHERE id = {$id}"); $this->Data = $res->fetch_array(); $this->Data["settings"] = unserialize($this->Data["settings"]); $this->Data["gameServerCount"] = Database::getRowCount("gameserver", array("userID" => $this->getData("id"))); } else { trigger_error("User existiert nicht"); } }
public function isInstalledOnServer($server, $gameserver = null) { if ($this->isBaseTemplate() || $this->isStaticTemplate()) { $cond = array(); $cond["templateID"] = $this->getData("id"); $cond["serverID"] = $server->getData("id"); return Database::getRowCount("physicalserver_templates", $cond); } //Todo: Check when Server files are per user }
error_reporting(0); require "../configs.php"; require "../include/CDatabase.php"; $lid = $_REQUEST['lid']; //map id $id = $_REQUEST['id']; //asset id if (isset($lid) && is_numeric($lid) && isset($id) && is_numeric($id)) { //Cross check request with map data $db = new Database($config['driver'], $config['host'], $config['dbname'], $config['user'], $config['password']); $stmt = $db->prepare("SELECT dataId FROM " . $config['table_map'] . "\n\t\tWHERE `id`=:id\n\t\tAND `dataId`=:dataId"); $stmt->bindParam(':id', $lid, PDO::PARAM_INT); $stmt->bindParam(':dataId', $id, PDO::PARAM_INT); $stmt->execute(); //Invalid lid and id pair if ($stmt == false || $db->getRowCount($stmt) <= 0) { die; } //Retrieve map file $stmt = $db->prepare("SELECT fileName FROM " . $config['table_assets'] . "\n\t\tWHERE `id`=:id"); $stmt->bindParam(':id', $id, PDO::PARAM_INT); $stmt->execute(); //Shouldn't happen at this point, but asset id doesn't exist. if ($stmt == false || $db->getRowCount($stmt) <= 0) { die; } $row = $stmt->fetch(); $file = $row['fileName']; if (file_exists("./{$file}")) { echo file_get_contents("./{$file}"); }
/** * refresh: * Refreshes or reloads the record from the database. */ function refresh() { $id = $this->getId(); $res = Database::query("SELECT * " . "FROM `" . static::$_tableName . "` " . "WHERE `" . static::$_keyField . "` = '{$id}'"); if ($res && Database::getRowCount($res) == 1) { // Fetch the row from the DB. $row = Database::fetchMap($res); $this->_recordExists = true; if (method_exists($this, 'recordLoaded')) { $this->recordLoaded($row); } foreach ($row as $column => $value) { $this->{$column} = $value; } } else { // Nothing found; this empty record remains intact. $this->_recordExists = false; } }
public static function getAllNonStaticTemplatesCount() { return Database::getRowCount("templates", array("baseTemplate" => "1")); }
public static function getTaskCount() { return Database::getRowCount("tasks", array("done" => 0)); }
public static function getServerCount() { return Database::getRowCount("gameserver"); }
function testNewKompo($oid) { try { $db = new Database(); $id = $oid * 1000 + 1; $rowCount = $db->getRowCount("SELECT * FROM komponentti WHERE id = {$id}"); while ($rowCount > 0) { ++$id; $rowCount = $db->getRowCount("SELECT * FROM komponentti WHERE id = {$id}"); } return $id; } catch (Exception $e) { return $e->getMessage(); } }
public static function getCount() { return Database::getRowCount("physicalserver"); }