<?php include dirname(dirname(dirname(__FILE__))) . '/common/config.php'; include dirname(dirname(dirname(__FILE__))) . '/common/server.php'; include dirname(dirname(dirname(__FILE__))) . '/common/session.php'; include 'apishared.php'; $call = api_checkarg_post('fn'); $db = getsql(); if ($call == 'create') { $binary = $db->real_escape_string(api_checkarg_post_required('binary', 'Zandronum version')); $hostname = $db->real_escape_string(api_checkarg_post_required('hostname', 'Host name')); $iwad = $db->real_escape_string(api_checkarg_post_required('iwad', 'IWAD')); $gamemode = $db->real_escape_string(api_checkarg_post_required('gamemode', 'Game mode')); $instagib = $db->real_escape_string(api_checkarg_post_required('instagib', 'Instagib') == 'true'); $buckshot = $db->real_escape_string(api_checkarg_post_required('buckshot', 'Buckshot') == 'true'); $stdata = $db->real_escape_string(api_checkarg_post_required('stdata', 'Skulltag data') == 'true'); $skill = intval(api_checkarg_post('skill', 0)); $dmflags = intval(api_checkarg_post('dmflags', 0)); $dmflags2 = intval(api_checkarg_post('dmflags2', 0)); $zadmflags = intval(api_checkarg_post('zadmflags', 0)); $compatflags = intval(api_checkarg_post('compatflags', 0)); $zacompatflags = intval(api_checkarg_post('zacompatflags', 0)); $wads = api_checkarg_post('wads', array()); $optwads = api_checkarg_post('optwads', array()); $binary = disciple_json()->main_binary; $iwad = data_dir('/iwads/') . $iwad . '.wad'; $s = new server($binary, $wads, $optwads, $iwad, $hostname, false, $gamemode, '', $skill, $stdata, $instagib, $buckshot, $dmflags, $dmflags2, $zadmflags, $compatflags, $zacompatflags); $s->start(); echo "1 " . $s->id; }
include dirname(dirname(dirname(__FILE__))) . '/common/config.php'; include dirname(dirname(dirname(__FILE__))) . '/common/session.php'; include 'apishared.php'; // A list of MD5s for all known commercial // IWADs. $iwadmd5 = array('740901119ba2953e3c7f3764eca6e128', 'b6afa12a8b22e2726a8ff5bd249223de', '9c877480b8ef33b7074f1f0c07ed6487', '049e32f18d9c9529630366cfc72726ea', '981b03e6d1dc033301aa3095acc437ce', '792fd1fea023d61210857089a7c1e351', '54978d12de87f162b9bcc011676cb3c0', '11e1cd216801ea2657723abc86ecb01f', '1cd63c5ddff1bf8ce844237f580e9cf3', 'c4fe9fd920207691a9f493668e0a2083', 'e4f120eab6fb410a5b6e11c947832357', '0c8758f102ccafe26a3040bee8ba5021', '72286ddc680d47b9138053dd944b2a3d', 'fb35c4a5a9fd49ec29ab6e900572c524', '7912931e44c7d56e021084a256659800', '3e410ecd27f61437d53fa5c279536e88', '30e3c2d0350b67bfbf47271970b74b2f', 'd9153ced9fd5b898b36cc5844e35b520', 'ea74a47a791fdef2e9f2ea8b8a9da13b', 'd7a07e5d3f4625074312bc299d7ed33f', 'c236745bb01d89bbb866c8fed81b6f8c', '3cb02349b3df649c86290907eed64e7b', '25e1459ca71d321525f84628f45ca8cd', 'a793ebcdd790afad4a1f39cc39a893bd', '43c2df32dc6c740cb11f34dc5ab693fa', 'c3bea40570c23e511a7ed3ebcd9865f7', 'f617591a6c5d07037eb716dc4863e26b', '43c2df32dc6c740cb11f34dc5ab693fa', 'a793ebcdd790afad4a1f39cc39a893bd', '4c3db5f23b145fccd24c9b84aba3b7dd', '9640fc4b2c8447bbd28f2080725d5c51', '75c8cf89566741fa9d22447604053bd7', '3493be7e1e2588bc9c8b31eab2587a04', 'b77ca6a809c4fae086162dad8e7a1335', '4e158d9953c79ccf97bd0663244cc6b6', '1d39e405bf6ee3df69a8d2646c8d5c49', 'be626c12b7c9d94b1dfb9c327566b4ff', '3117e399cdb4298eaa3941625f4b2923', '1e4cb4ef075ad344dd63971637307e04', '66d686b1ed6d35ff103f15dbd30e0341', '66d686b1ed6d35ff103f15dbd30e0341', 'c88a2bb3d783e2ad7b599a8e301e099e', 'b2543a03521365261d0a0f74d5dd90f0', 'abb033caf81e26f12a2103e1fa25453f', 'b68140a796f6fd7f3a5d3226a32b93be', '1077432e2690d390c256ac908b5f4efa', '78d5898e99e220e4de64edaa0e479593', '8f2d3a6a289f5d2f2f9c1eec02b47299', '2fed2031a5b03892106e0f117f17901f', '25485721882b050afa96a56e5758dd52'); $call = api_checkarg_post('fn'); if ($call == 'upload') { if (is_authed()) { if (intval($_SERVER['CONTENT_LENGTH']) > 0 && count($_POST) === 0) { Header("Location: /wads?toobig=" . $fn); exit; } if (isset($_POST['doup'])) { $target_dir = data_dir('/wads/'); $fn = basename($_FILES['file']['name']); $ext = pathinfo($fn, PATHINFO_EXTENSION); $fn = preg_replace('/[^a-zA-Z0-9_\\-\\.]+/', '', pathinfo($fn, PATHINFO_FILENAME)) . '.' . $ext; $target_file = $target_dir . $fn; $uploadOk = 1; $tmploc = $_FILES['file']['tmp_name']; $lext = strtolower($ext); if (!($lext == 'wad' || $lext == 'pk3' || $lext == 'pk7')) { Header("Location: /wads?badext={$ext}"); exit; } $md5 = md5_file($tmploc); if (in_array($md5)) { Header("Location: /wads?iwad"); exit;
<?php include 'postcfglock.php'; include dirname(dirname(__FILE__)) . '/api/apishared.php'; include dirname(dirname(__DIR__)) . '/common/config.php'; $site_name = api_checkarg_post_required('site_name', 'Site name'); $site_shortname = api_checkarg_post_required('site_shortname', 'Site short name'); $main_version_binary = api_checkarg_post_required('binary', 'Zandronum server binary location'); $serverlimit = intval(api_checkarg_post_required('serverlimit', 'Server limit')); $serverdata = api_checkarg_post_required('serverdata', 'Server data location'); $rootuser = api_checkarg_post_required('rootuser', 'Root username'); $rootpass = api_checkarg_post_required('rootpass', 'Root password'); $hostpref = api_checkarg_post_required('hostpref', 'Server hostname prefix'); $out = array('site_name' => $site_name, 'site_shortname' => $site_shortname, 'main_binary' => $main_version_binary, 'serverlimit' => $serverlimit, 'serverdata' => $serverdata, 'hostname_prefix' => $hostpref); $file = dirname(dirname(dirname(__FILE__))) . '/config/config.json'; $r = file_put_contents($file, json_encode($out)); if ($r === FALSE) { api_error(SN_FAILED_FILE_WRITE, sprintf("Failed to write to file %s.", $file)); exit; } $db = new mysqli($disciple_config['mysql_hostname'], $disciple_config['mysql_user'], $disciple_config['mysql_pass'], $disciple_config['mysql_database']); $db->query(sprintf("INSERT INTO `users` (username, password, serverlimit, activated, imported, userlevel) VALUES ('%s', '%s', 65565, 1, 0, %d)", $db->real_escape_string($rootuser), password_hash($rootpass, PASSWORD_BCRYPT, array('cost' => 14)), UL_OPERATOR)); data_dir('/wads/'); Header("Content-Type: text/plain"); echo 1;