Esempio n. 1
0
 private function _activeUser()
 {
     $validationID = HTTP::_GP('i', 0);
     $validationKey = HTTP::_GP('k', '');
     $userData = $GLOBALS['DATABASE']->getFirstRow("SELECT * FROM " . USERS_VALID . " WHERE validationID = " . $validationID . " AND validationKey = '" . $GLOBALS['DATABASE']->escape($validationKey) . "';");
     if (!isset($userData)) {
         $this->printMessage(t('vertifyNoUserFound'));
     }
     $GLOBALS['DATABASE']->query("DELETE FROM " . USERS_VALID . " WHERE validationID = " . $validationID . ";");
     list($userID, $planetID) = PlayerUtil::createPlayer($userData['universe'], $userData['userName'], $userData['password'], $userData['email'], $userData['race'], $userData['language']);
     if (Config::get('mail_active', $userData['universe']) == 1) {
         require 'includes/classes/Mail.class.php';
         $MailSubject = t('registerMailCompleteTitle', Config::get('game_name', $userData['universe']));
         $MailRAW = $GLOBALS['LNG']->getTemplate('email_reg_done');
         $MailContent = str_replace(array('{USERNAME}', '{GAMENAME}', '{GAMEMAIL}'), array($userData['email'], Config::get('game_name') . ' - ' . Config::get('uni_name'), Config::get('smtp_sendmail')), $MailRAW);
         try {
             Mail::send($userData['email'], $userData['userName'], $MailSubject, $MailContent);
         } catch (Exception $e) {
             // This mail is wayne.
         }
     }
     if (!empty($userData['referralID'])) {
         $GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET\n\t\t\t`ref_id`\t= " . $userData['referralID'] . ",\n\t\t\t`ref_bonus`\t= 1\n\t\t\tWHERE\n\t\t\t`id`\t\t= " . $userID . ";");
     }
     if (!empty($userData['externalAuthUID'])) {
         $GLOBALS['DATABASE']->query("INSERT INTO " . USERS_AUTH . " SET\n\t\t\t`id`\t\t= " . $userID . ",\n\t\t\t`account`\t= '" . $GLOBALS['DATABASE']->escape($userData['externalAuthUID']) . "',\n\t\t\t`mode`\t\t= '" . $GLOBALS['DATABASE']->escape($userData['externalAuthMethod']) . "';");
     }
     $nameSender = t('registerWelcomePMSenderName');
     $subject = t('registerWelcomePMSubject');
     $message = t('registerWelcomePMText', Config::get('game_name', $userData['universe']));
     SendSimpleMessage($userID, 1, TIMESTAMP, 1, $nameSender, $subject, $message);
     return array('userID' => $userID, 'userName' => $userData['userName'], 'planetID' => $planetID);
 }
Esempio n. 2
0
 private function _activeUser()
 {
     $validationID = HTTP::_GP('i', 0);
     $validationKey = HTTP::_GP('k', '');
     $userData = $GLOBALS['DATABASE']->getFirstRow("SELECT * FROM " . USERS_VALID . " WHERE validationID = " . $validationID . " AND validationKey = '" . $GLOBALS['DATABASE']->escape($validationKey) . "';");
     if (!isset($userData)) {
         $this->printMessage(t('vertifyNoUserFound'));
     }
     $GLOBALS['DATABASE']->query("DELETE FROM " . USERS_VALID . " WHERE validationID = " . $validationID . ";");
     list($userID, $planetID) = PlayerUtil::createPlayer($userData['universe'], $userData['userName'], $userData['password'], $userData['email'], $userData['language'], $userData['planetName']);
     if (!empty($userData['referralID'])) {
         $GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET\n\t\t\t`ref_id`\t= " . $userData['referralID'] . ",\n\t\t\t`ref_bonus`\t= 1\n\t\t\tWHERE\n\t\t\t`id`\t\t= " . $userID . ";");
     }
     if (!empty($userData['externalAuthUID'])) {
         $GLOBALS['DATABASE']->query("INSERT INTO " . USERS_AUTH . " SET\n\t\t\t`id`\t\t= " . $userID . ",\n\t\t\t`account`\t= '" . $GLOBALS['DATABASE']->escape($userData['externalAuthUID']) . "',\n\t\t\t`mode`\t\t= '" . $GLOBALS['DATABASE']->escape($userData['externalAuthMethod']) . "';");
     }
     $nameSender = t('registerWelcomePMSenderName');
     $subject = t('registerWelcomePMSubject');
     $message = t('registerWelcomePMText', Config::get('game_name', $userData['universe']));
     return array('userID' => $userID, 'userName' => $userData['userName'], 'planetID' => $planetID);
 }
Esempio n. 3
0
 private function _activeUser()
 {
     global $LNG;
     $validationID = HTTP::_GP('i', 0);
     $validationKey = HTTP::_GP('k', '');
     $db = Database::get();
     $sql = "SELECT * FROM %%USERS_VALID%%\n\t\tWHERE validationID\t= :validationID\n\t\tAND validationKey\t= :validationKey\n\t\tAND universe\t\t= :universe;";
     $userData = $db->selectSingle($sql, array(':validationKey' => $validationKey, ':validationID' => $validationID, ':universe' => Universe::current()));
     if (empty($userData)) {
         $this->printMessage($LNG['vertifyNoUserFound']);
     }
     $config = Config::get();
     $sql = "DELETE FROM %%USERS_VALID%% WHERE validationID = :validationID;";
     $db->delete($sql, array(':validationID' => $validationID));
     list($userID, $planetID) = PlayerUtil::createPlayer($userData['universe'], $userData['userName'], $userData['password'], $userData['email'], $userData['language']);
     if ($config->mail_active == 1) {
         require 'includes/classes/Mail.class.php';
         $MailSubject = sprintf($LNG['registerMailCompleteTitle'], $config->game_name, Universe::current());
         $MailRAW = $LNG->getTemplate('email_reg_done');
         $MailContent = str_replace(array('{USERNAME}', '{GAMENAME}', '{GAMEMAIL}'), array($userData['userName'], $config->game_name . ' - ' . $config->uni_name, $config->smtp_sendmail), $MailRAW);
         try {
             Mail::send($userData['email'], $userData['userName'], $MailSubject, $MailContent);
         } catch (Exception $e) {
             // This mail is wayne.
         }
     }
     if (!empty($userData['referralID'])) {
         $sql = "UPDATE %%USERS%% SET\n\t\t\t`ref_id`\t= :referralId,\n\t\t\t`ref_bonus`\t= 1\n\t\t\tWHERE\n\t\t\t`id`\t\t= :userID;";
         $db->update($sql, array(':referralId' => $userData['referralID'], ':userID' => $userID));
     }
     if (!empty($userData['externalAuthUID'])) {
         $sql = "INSERT INTO %%USERS_AUTH%% SET\n\t\t\t`id`\t\t= :userID,\n\t\t\t`account`\t= :externalAuthUID,\n\t\t\t`mode`\t\t= :externalAuthMethod;";
         $db->insert($sql, array(':userID' => $userID, ':externalAuthUID' => $userData['externalAuthUID'], ':externalAuthMethod' => $userData['externalAuthMethod']));
     }
     $senderName = $LNG['registerWelcomePMSenderName'];
     $subject = $LNG['registerWelcomePMSubject'];
     $message = sprintf($LNG['registerWelcomePMText'], $config->game_name, $userData['universe']);
     PlayerUtil::sendMessage($userID, 1, $senderName, 1, $subject, $message, TIMESTAMP);
     return array('userID' => $userID, 'userName' => $userData['userName'], 'planetID' => $planetID);
 }
Esempio n. 4
0
function ShowCreatorPage()
{
    global $LNG, $USER;
    $template = new template();
    switch ($_GET['mode']) {
        case 'user':
            $LNG->includeData(array('PUBLIC'));
            if ($_POST) {
                $UserName = HTTP::_GP('name', '', UTF8_SUPPORT);
                $UserPass = HTTP::_GP('password', '');
                $UserPass2 = HTTP::_GP('password2', '');
                $UserMail = HTTP::_GP('email', '');
                $UserMail2 = HTTP::_GP('email2', '');
                $UserAuth = HTTP::_GP('authlevel', 0);
                $Galaxy = HTTP::_GP('galaxy', 0);
                $System = HTTP::_GP('system', 0);
                $Planet = HTTP::_GP('planet', 0);
                $Language = HTTP::_GP('lang', '');
                $ExistsUser = $GLOBALS['DATABASE']->getFirstCell("SELECT (SELECT COUNT(*) FROM " . USERS . " WHERE universe = " . Universe::getEmulated() . " AND username = '******'DATABASE']->sql_escape($UserName) . "') + (SELECT COUNT(*) FROM " . USERS_VALID . " WHERE universe = " . Universe::getEmulated() . " AND username = '******'DATABASE']->sql_escape($UserName) . "')");
                $ExistsMails = $GLOBALS['DATABASE']->getFirstCell("SELECT (SELECT COUNT(*) FROM " . USERS . " WHERE universe = " . Universe::getEmulated() . " AND (email = '" . $GLOBALS['DATABASE']->sql_escape($UserMail) . "' OR email_2 = '" . $GLOBALS['DATABASE']->sql_escape($UserMail) . "')) + (SELECT COUNT(*) FROM " . USERS_VALID . " WHERE universe = " . Universe::getEmulated() . " AND email = '" . $GLOBALS['DATABASE']->sql_escape($UserMail) . "')");
                $errors = "";
                $config = Config::get(Universe::getEmulated());
                if (!PlayerUtil::isMailValid($UserMail)) {
                    $errors .= $LNG['invalid_mail_adress'];
                }
                if (empty($UserName)) {
                    $errors .= $LNG['empty_user_field'];
                }
                if (strlen($UserPass) < 6) {
                    $errors .= $LNG['password_lenght_error'];
                }
                if ($UserPass != $UserPass2) {
                    $errors .= $LNG['different_passwords'];
                }
                if ($UserMail != $UserMail2) {
                    $errors .= $LNG['different_mails'];
                }
                if (!PlayerUtil::isNameValid($UserName)) {
                    $errors .= $LNG['user_field_specialchar'];
                }
                if ($ExistsUser != 0) {
                    $errors .= $LNG['user_already_exists'];
                }
                if ($ExistsMails != 0) {
                    $errors .= $LNG['mail_already_exists'];
                }
                if (!PlayerUtil::isPositionFree(Universe::getEmulated(), $Galaxy, $System, $Planet)) {
                    $errors .= $LNG['planet_already_exists'];
                }
                if ($Galaxy > $config->max_galaxy || $System > $config->max_system || $Planet > $config->max_planets) {
                    $errors .= $LNG['po_complete_all2'];
                }
                if (!empty($errors)) {
                    $template->message($errors, '?page=create&mode=user', 10, true);
                    exit;
                }
                $Language = array_key_exists($Language, $LNG->getAllowedLangs(false)) ? $Language : $config->lang;
                PlayerUtil::createPlayer(Universe::getEmulated(), $UserName, PlayerUtil::cryptPassword($UserPass), $UserMail, $Language, $Galaxy, $System, $Planet, $LNG['fcm_planet'], $UserAuth);
                $template->message($LNG['new_user_success'], '?page=create&mode=user', 5, true);
                exit;
            }
            $AUTH = array();
            $AUTH[AUTH_USR] = $LNG['user_level'][AUTH_USR];
            if ($USER['authlevel'] >= AUTH_OPS) {
                $AUTH[AUTH_OPS] = $LNG['user_level'][AUTH_OPS];
            }
            if ($USER['authlevel'] >= AUTH_MOD) {
                $AUTH[AUTH_MOD] = $LNG['user_level'][AUTH_MOD];
            }
            if ($USER['authlevel'] >= AUTH_ADM) {
                $AUTH[AUTH_ADM] = $LNG['user_level'][AUTH_ADM];
            }
            $template->assign_vars(array('admin_auth' => $USER['authlevel'], 'new_add_user' => $LNG['new_add_user'], 'new_creator_refresh' => $LNG['new_creator_refresh'], 'new_creator_go_back' => $LNG['new_creator_go_back'], 'universe' => $LNG['mu_universe'], 'user_reg' => $LNG['user_reg'], 'pass_reg' => $LNG['pass_reg'], 'pass2_reg' => $LNG['pass2_reg'], 'email_reg' => $LNG['email_reg'], 'email2_reg' => $LNG['email2_reg'], 'new_coord' => $LNG['new_coord'], 'new_range' => $LNG['new_range'], 'lang_reg' => $LNG['lang_reg'], 'new_title' => $LNG['new_title'], 'Selector' => array('auth' => $AUTH, 'lang' => $LNG->getAllowedLangs(false))));
            $template->show('CreatePageUser.tpl');
            break;
        case 'moon':
            if ($_POST) {
                $PlanetID = HTTP::_GP('add_moon', 0);
                $MoonName = HTTP::_GP('name', '', UTF8_SUPPORT);
                $Diameter = HTTP::_GP('diameter', 0);
                $MoonPlanet = $GLOBALS['DATABASE']->getFirstRow("SELECT temp_max, temp_min, id_luna, galaxy, system, planet, planet_type, destruyed, id_owner FROM " . PLANETS . " WHERE id = '" . $PlanetID . "' AND universe = '" . Universe::getEmulated() . "' AND planet_type = '1' AND destruyed = '0';");
                if (!isset($MoonPlanet)) {
                    $template->message($LNG['mo_planet_doesnt_exist'], '?page=create&mode=moon', 3, true);
                    exit;
                }
                $moonId = PlayerUtil::createMoon(Universe::getEmulated(), $MoonPlanet['galaxy'], $MoonPlanet['system'], $MoonPlanet['planet'], $MoonPlanet['id_owner'], 20, $_POST['diameter_check'] == 'on' ? NULL : $Diameter, $MoonName);
                if ($moonId !== false) {
                    $template->message($LNG['mo_moon_added'], '?page=create&mode=moon', 3, true);
                } else {
                    $template->message($LNG['mo_moon_unavaible'], '?page=create&mode=moon', 3, true);
                }
                exit;
            }
            $template->assign_vars(array('admin_auth' => $USER['authlevel'], 'universum' => $LNG['mu_universe'], 'po_add_moon' => $LNG['po_add_moon'], 'input_id_planet' => $LNG['input_id_planet'], 'mo_moon_name' => $LNG['mo_moon_name'], 'mo_diameter' => $LNG['mo_diameter'], 'mo_temperature' => $LNG['mo_temperature'], 'mo_fields_avaibles' => $LNG['mo_fields_avaibles'], 'button_add' => $LNG['button_add'], 'new_creator_refresh' => $LNG['new_creator_refresh'], 'mo_moon' => $LNG['fcm_moon'], 'new_creator_go_back' => $LNG['new_creator_go_back']));
            $template->show('CreatePageMoon.tpl');
            break;
        case 'planet':
            if ($_POST) {
                $id = HTTP::_GP('id', 0);
                $Galaxy = HTTP::_GP('galaxy', 0);
                $System = HTTP::_GP('system', 0);
                $Planet = HTTP::_GP('planet', 0);
                $name = HTTP::_GP('name', '', UTF8_SUPPORT);
                $field_max = HTTP::_GP('field_max', 0);
                $config = Config::get(Universe::getEmulated());
                if ($Galaxy > $config->max_galaxy || $System > $config->max_system || $Planet > $config->max_planets) {
                    $template->message($LNG['po_complete_all2'], '?page=create&mode=planet', 3, true);
                    exit;
                }
                $ISUser = $GLOBALS['DATABASE']->getFirstRow("SELECT id, authlevel FROM " . USERS . " WHERE id = '" . $id . "' AND universe = '" . Universe::getEmulated() . "';");
                if (!PlayerUtil::checkPosition(Universe::getEmulated(), $Galaxy, $System, $Planet) || !isset($ISUser)) {
                    $template->message($LNG['po_complete_all'], '?page=create&mode=planet', 3, true);
                    exit;
                }
                $planetId = PlayerUtil::createPlanet($Galaxy, $System, $Planet, Universe::getEmulated(), $id, NULL, false, $ISUser['authlevel']);
                $SQL = "UPDATE " . PLANETS . " SET ";
                if ($_POST['diameter_check'] != 'on' || $field_max > 0) {
                    $SQL .= "field_max = '" . $field_max . "' ";
                }
                if (!empty($name)) {
                    $SQL .= ", name = '" . $GLOBALS['DATABASE']->sql_escape($name) . "' ";
                }
                $SQL .= "WHERE ";
                $SQL .= "id = '" . $planetId . "'";
                $GLOBALS['DATABASE']->query($SQL);
                $template->message($LNG['po_complete_succes'], '?page=create&mode=planet', 3, true);
                exit;
            }
            $template->assign_vars(array('admin_auth' => $USER['authlevel'], 'po_add_planet' => $LNG['po_add_planet'], 'po_galaxy' => $LNG['po_galaxy'], 'po_system' => $LNG['po_system'], 'po_planet' => $LNG['po_planet'], 'input_id_user' => $LNG['input_id_user'], 'new_creator_coor' => $LNG['new_creator_coor'], 'po_name_planet' => $LNG['po_name_planet'], 'po_fields_max' => $LNG['po_fields_max'], 'button_add' => $LNG['button_add'], 'po_colony' => $LNG['fcp_colony'], 'new_creator_refresh' => $LNG['new_creator_refresh'], 'new_creator_go_back' => $LNG['new_creator_go_back']));
            $template->show('CreatePagePlanet.tpl');
            break;
        default:
            $template->assign_vars(array('new_creator_title_u' => $LNG['new_creator_title_u'], 'new_creator_title_p' => $LNG['new_creator_title_p'], 'new_creator_title_l' => $LNG['new_creator_title_l'], 'new_creator_title' => $LNG['new_creator_title']));
            $template->show('CreatePage.tpl');
            break;
    }
}
Esempio n. 5
0
                break;
            case 7:
                $template->show('ins_acc.tpl');
                break;
            case 8:
                $username = HTTP::_GP('username', '', UTF8_SUPPORT);
                $password = HTTP::_GP('password', '', true);
                $mail = HTTP::_GP('email', '');
                // Get Salt.
                require 'includes/config.php';
                require 'includes/vars.php';
                $hashPassword = PlayerUtil::cryptPassword($password);
                if (empty($username) || empty($password) || empty($mail)) {
                    $template->assign(array('message' => $LNG['step8_need_fields'], 'username' => $username, 'mail' => $mail));
                    $template->show('ins_step8error.tpl');
                    exit;
                }
                list($userId, $planetId) = PlayerUtil::createPlayer(Universe::current(), $username, $hashPassword, $mail, $LNG->getLanguage(), 1, 1, 2, NULL, AUTH_ADM);
                $session = Session::create();
                $session->userId = $userId;
                $session->adminAccess = 1;
                @unlink($enableInstallToolFile);
                $template->show('ins_step8.tpl');
                break;
        }
        break;
    default:
        $template->assign(array('intro_text' => $LNG['intro_text'], 'intro_welcome' => $LNG['intro_welcome'], 'intro_install' => $LNG['intro_install']));
        $template->show('ins_intro.tpl');
        break;
}
Esempio n. 6
0
function ShowUniversePage()
{
    global $LNG, $USER;
    $template = new template();
    $action = HTTP::_GP('action', '');
    $universe = HTTP::_GP('uniID', 0);
    switch ($action) {
        case 'open':
            $config = Config::get($universe);
            $config->game_disable = 1;
            $config->save();
            break;
        case 'closed':
            $config = Config::get($universe);
            $config->game_disable = 0;
            $config->save();
            break;
        case 'delete':
            if (!empty($universe) && $universe != ROOT_UNI && $universe != Universe::current()) {
                $GLOBALS['DATABASE']->query("DELETE FROM " . ALLIANCE . ", " . ALLIANCE_RANK . ", " . ALLIANCE_REQUEST . " \n\t\t\t\tUSING " . ALLIANCE . " \n\t\t\t\tLEFT JOIN " . ALLIANCE_RANK . " ON " . ALLIANCE . ".id = " . ALLIANCE_RANK . ".allianceID\n\t\t\t\tLEFT JOIN " . ALLIANCE_REQUEST . " ON " . ALLIANCE . ".id = " . ALLIANCE_REQUEST . " .allianceID\n\t\t\t\tWHERE ally_universe = " . $universe . ";");
                $GLOBALS['DATABASE']->query("DELETE FROM " . BANNED . " WHERE universe = " . $universe . ";");
                $GLOBALS['DATABASE']->query("DELETE FROM " . BUDDY . ", " . BUDDY_REQUEST . "\n\t\t\t\tUSING " . BUDDY . "\n\t\t\t\tLEFT JOIN " . BUDDY_REQUEST . " ON " . BUDDY . ".id = " . BUDDY_REQUEST . ".id\n\t\t\t\tWHERE " . BUDDY . ".universe = " . $universe . ";");
                $GLOBALS['DATABASE']->query("DELETE FROM " . CONFIG . " WHERE uni = " . $universe . ";");
                $GLOBALS['DATABASE']->query("DELETE FROM " . DIPLO . " WHERE universe = " . $universe . ";");
                $GLOBALS['DATABASE']->query("DELETE FROM " . FLEETS . ", " . FLEETS_EVENT . ", " . AKS . ", " . LOG_FLEETS . "\n\t\t\t\tUSING " . FLEETS . "\n\t\t\t\tLEFT JOIN " . FLEETS_EVENT . " ON " . FLEETS . ".fleet_id = " . FLEETS_EVENT . ".fleetID\n\t\t\t\tLEFT JOIN " . AKS . " ON " . FLEETS . ".fleet_group = " . AKS . ".id\n\t\t\t\tLEFT JOIN " . LOG_FLEETS . " ON " . FLEETS . ".fleet_id = " . LOG_FLEETS . ".fleet_id\n\t\t\t\tWHERE " . FLEETS . ".fleet_universe = " . $universe . ";");
                $GLOBALS['DATABASE']->query("DELETE FROM " . MESSAGES . " WHERE message_universe = " . $universe . ";");
                $GLOBALS['DATABASE']->query("DELETE FROM " . NOTES . " WHERE universe = " . $universe . ";");
                $GLOBALS['DATABASE']->query("DELETE FROM " . PLANETS . " WHERE universe = " . $universe . ";");
                $GLOBALS['DATABASE']->query("DELETE FROM " . STATPOINTS . " WHERE universe = " . $universe . ";");
                $GLOBALS['DATABASE']->query("DELETE FROM " . TICKETS . ", " . TICKETS_ANSWER . "\n\t\t\t\tUSING " . TICKETS . "\n\t\t\t\tLEFT JOIN " . TICKETS_ANSWER . " ON " . TICKETS . ".ticketID = " . TICKETS_ANSWER . ".ticketID\n\t\t\t\tWHERE universe = " . $universe . ";");
                $GLOBALS['DATABASE']->query("DELETE FROM " . TOPKB . " WHERE universe = " . $universe . ";");
                $GLOBALS['DATABASE']->query("DELETE FROM " . USERS . ", " . USERS_ACS . ", " . USERS_AUTH . ", " . TOPKB_USERS . ", " . SESSION . ", " . SHORTCUTS . ", " . RECORDS . "\n\t\t\t\tUSING " . USERS . "\n\t\t\t\tLEFT JOIN " . USERS_ACS . " ON " . USERS . ".id = " . USERS_ACS . ".userID\n\t\t\t\tLEFT JOIN " . USERS_AUTH . " ON " . USERS . ".id = " . USERS_AUTH . ".id\n\t\t\t\tLEFT JOIN " . TOPKB_USERS . " ON " . USERS . ".id = " . TOPKB_USERS . ".uid\n\t\t\t\tLEFT JOIN " . SESSION . " ON " . USERS . ".id = " . SESSION . ".userID\n\t\t\t\tLEFT JOIN " . SHORTCUTS . " ON " . USERS . ".id = " . SHORTCUTS . ".ownerID\n\t\t\t\tLEFT JOIN " . RECORDS . " ON " . USERS . ".id = " . RECORDS . ".userID\n\t\t\t\tLEFT JOIN " . LOSTPASSWORD . " ON " . USERS . ".id = " . LOSTPASSWORD . ".userID\n\t\t\t\tWHERE " . USERS . ".universe = " . $universe . ";");
                $GLOBALS['DATABASE']->query("DELETE FROM " . USERS_VALID . " WHERE universe = " . $universe . ";");
                if (Universe::getEmulated() == $universe) {
                    Universe::setEmulated(Universe::current());
                }
                if (count(Universe::availableUniverses()) == 2) {
                    // Hack The Session
                    setcookie(session_name(), session_id(), SESSION_LIFETIME, HTTP_BASE, NULL, HTTPS, true);
                    HTTP::redirectTo("../admin.php?reload=r");
                }
            }
            break;
        case 'create':
            $universeCount = count(Universe::availableUniverses());
            // Check Multiuniverse Support
            $ch = curl_init();
            if ($universeCount == 1) {
                curl_setopt($ch, CURLOPT_URL, PROTOCOL . HTTP_HOST . HTTP_BASE . "uni" . ROOT_UNI . "/");
            } else {
                curl_setopt($ch, CURLOPT_URL, PROTOCOL . HTTP_HOST . HTTP_BASE);
            }
            curl_setopt($ch, CURLOPT_HTTPGET, true);
            curl_setopt($ch, CURLOPT_AUTOREFERER, true);
            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; 2Moons/" . Config::get()->VERSION . "; +http://2moons.cc)");
            curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3", "Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4"));
            curl_exec($ch);
            $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            curl_close($ch);
            if ($httpCode != 302) {
                $template = new template();
                $template->message(str_replace(array('{NGINX-CODE}'), array('rewrite /(.*)/?uni[0-9]+/?(.*) /$1/$2 break;'), $LNG->getTemplate('createUniverseInfo')) . '<a href="javascript:window.history.back();"><button>' . $LNG['uvs_back'] . '</button></a>' . '<a href="javascript:window.location.reload();"><button>' . $LNG['uvs_reload'] . '</button></a>');
                exit;
            }
            $config = Config::get();
            $configSQL = array();
            foreach (Config::getGlobalConfigKeys() as $basicConfigKey) {
                $configSQL[] = '`' . $basicConfigKey . '` = "' . $config->{$basicConfigKey} . '"';
            }
            $configSQL[] = '`uni_name` = "' . $LNG['fcm_universe'] . ' ' . ($universeCount + 1) . '"';
            $configSQL[] = '`close_reason` = ""';
            $configSQL[] = '`OverviewNewsText` = "' . $GLOBALS['DATABASE']->escape($config->OverviewNewsText) . '"';
            $GLOBALS['DATABASE']->query("INSERT INTO " . CONFIG . " SET " . implode(', ', $configSQL) . ";");
            $newUniverse = $GLOBALS['DATABASE']->GetInsertID();
            Config::reload();
            list($userID, $planetID) = PlayerUtil::createPlayer($newUniverse, $USER['username'], '', $USER['email'], $USER['lang'], 1, 1, 1, NULL, AUTH_ADM);
            $GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET password = '******'password'] . "' WHERE id = " . $userID . ";");
            if ($universeCount === 1) {
                // Hack The Session
                setcookie(session_name(), session_id(), SESSION_LIFETIME, HTTP_ROOT . 'uni' . $USER['universe'] . '/', NULL, HTTPS, true);
                HTTP::redirectTo("uni" . $USER['universe'] . "/admin.php?reload=r");
            }
            break;
    }
    $uniList = array();
    $uniResult = $GLOBALS['DATABASE']->query("SELECT uni, users_amount, game_disable, energySpeed, halt_speed, resource_multiplier, fleet_speed, game_speed, uni_name, COUNT(DISTINCT inac.id) as inactive, COUNT(planet.id) as planet\n\tFROM " . CONFIG . " conf\n\tLEFT JOIN " . USERS . " as inac ON uni = inac.universe AND inac.onlinetime < " . (TIMESTAMP - INACTIVE) . "\n\tLEFT JOIN " . PLANETS . " as planet ON uni = planet.universe\n\tGROUP BY conf.uni, inac.universe, planet.universe\n\tORDER BY uni ASC;");
    while ($uniRow = $GLOBALS['DATABASE']->fetch_array($uniResult)) {
        $uniList[$uniRow['uni']] = $uniRow;
    }
    $template->assign_vars(array('uniList' => $uniList, 'SID' => session_id()));
    $template->show('UniversePage.tpl');
}