prepare("SELECT * FROM games WHERE id = :id;");
$stmt->bindParam(':id', $id, PDO::PARAM_INT);
$stmt->execute();
if ($stmt->rowCount() == 0) {
echo 'Server not found';
exit;
}
$result = $stmt->fetch(PDO::FETCH_ASSOC);
$id = $result['id'];
if ($result['public'] == 0) {
$gameKey = $result['key'];
$stmtU = $dbcon->prepare("SELECT * FROM gameKeys WHERE userid=:id AND `key` = :key;");
$stmtU->bindParam(':id', $GLOBALS['userTable']['id'], PDO::PARAM_INT);
$stmtU->bindParam(':key', $gameKey, PDO::PARAM_STR);
$stmtU->execute();
if ($GLOBALS['loggedIn']) {
if ($stmtU->rowCount() == 0 and $result['creator_uid'] != $GLOBALS['userTable']['id'] and $GLOBALS['userTable']['rank'] == 0) {
echo 'Server not found';
exit;
}
}else{
echo 'Server not found';
exit;
}
}
$stmt = $dbcon->prepare("SELECT username, id, imgTime FROM users WHERE id = :id");
$stmt->bindParam(':id', $result['creator_uid'], PDO::PARAM_INT);
$stmt->execute();
$resultuser = $stmt->fetch(PDO::FETCH_ASSOC);
?>
Creator:
Date Created:
Description: None';
}else{
echo '
Description: '.user::filter(context::secureString($result['description'])).'
';
}
if ($GLOBALS['loggedIn']) {
if ($result['version'] == 0) echo '
Play';
if ($result['version'] == 1) echo '
Play';
if ($result['version'] == 2) echo '
Play';
}else{
echo '
Play';
}
if ($GLOBALS['loggedIn']) {
if ($GLOBALS['userTable']['rank'] > 0 or $GLOBALS['userTable']['id'] == $result['creator_uid']) {
if ($result['dedi'] == 0) echo '
';
}
if ($result['dedi'] == 1) {
if ($GLOBALS['userTable']['rank'] == 1 || $GLOBALS['userTable']['id'] == $result['creator_uid']) echo '
';
}
}
?>
Online Players
prepare("SELECT lastSeen, inGame, username, imgTime, id FROM users WHERE inGameId = :id ORDER BY id");
$stmt->bindParam(':id', $id, PDO::PARAM_INT);
$stmt->execute();
$count = 0;
foreach($stmt as $resultk) {
$from_time = strtotime($resultk['lastSeen']);
$to_time = strtotime(context::getCurrentTime());
$timeSince = round(abs($to_time - $from_time) / 60,2);
if ($timeSince < 2 and $resultk['inGame'] == 1) {
$count++;
$username = $resultk['username'];
if (strlen($username) > 10) {
$username = substr($username, 0, 7) . '...';
}
echo '
';
}
}
if ($count == 0) {
echo 'There is nobody online.';
}
echo '';
?>
Command
Use this command to start your server
dofile("http://api.xdiscuss.net/serverscripts/server.php?key='.$result['privatekey'].'") ';
}
if ($result['public'] == 0) {
echo '
Invites
Use this key to invite people to your server
'.$result['key'].'';
}
}
?>