示例#1
0
function UpdateNote($player_id, $note_id, $subj, $text, $prio)
{
    global $db_prefix, $loca_lang;
    // Чужие заметки трогать нельзя
    $note = LoadNote($player_id, $note_id);
    if ($note['owner_id'] != $player_id) {
        return;
    }
    $user = LoadUser($player_id);
    $loca_lang = $user['lang'];
    loca_add("notes", $user['lang']);
    // Проверить параметры.
    if ($subj === "") {
        $subj = loca("NOTE_NO_SUBJ");
    }
    if ($text === "") {
        $text = loca("NOTE_NO_TEXT");
    }
    $text = mb_substr($text, 0, 5000, "UTF-8");
    $subj = mb_substr($subj, 0, 30, "UTF-8");
    if ($prio < 0) {
        $prio = 0;
    }
    if ($prio > 2) {
        $prio = 2;
    }
    $query = "UPDATE " . $db_prefix . "notes SET subj = '" . $subj . "', text = '" . $text . "', textsize = '" . mb_strlen($text, "UTF-8") . "', prio = '" . $prio . "', date = '" . time() . "' WHERE owner_id = {$player_id} AND note_id = {$note_id}";
    dbquery($query);
}
<?php

// Технологии (детали).
loca_add("menu", $GlobalUni['lang']);
loca_add("techtree", $GlobalUni['lang']);
if (key_exists('cp', $_GET)) {
    SelectPlanet($GlobalUser['player_id'], intval($_GET['cp']));
}
$GlobalUser['aktplanet'] = GetSelectedPlanet($GlobalUser['player_id']);
$now = time();
UpdateQueue($now);
$aktplanet = GetPlanet($GlobalUser['aktplanet']);
$aktplanet = ProdResources($aktplanet, $aktplanet['lastpeek'], $now);
UpdatePlanetActivity($aktplanet['planet_id']);
UpdateLastClick($GlobalUser['player_id']);
$session = $_GET['session'];
PageHeader("techtreedetails");
echo "<!-- CONTENT AREA -->\n";
echo "<div id='content'>\n";
echo "<center>\n";
// **************************************************************************************
// Список объектов что-чему требуется.
$reqs = array(1 => array(), 2 => array(), 3 => array(), 4 => array(), 12 => array(3 => 5, 113 => 3), 14 => array(), 15 => array(14 => 10, 108 => 10), 21 => array(14 => 2), 22 => array(), 23 => array(), 24 => array(), 31 => array(), 33 => array(15 => 1, 113 => 12), 34 => array(), 44 => array(21 => 1), 106 => array(31 => 3), 108 => array(31 => 1), 109 => array(31 => 4), 110 => array(113 => 3, 31 => 6), 111 => array(31 => 2), 113 => array(31 => 1), 114 => array(113 => 5, 110 => 5, 31 => 7), 115 => array(113 => 1), 117 => array(113 => 1, 31 => 2), 118 => array(114 => 3), 120 => array(113 => 2), 121 => array(31 => 4, 120 => 5, 113 => 4), 122 => array(113 => 8, 120 => 10, 121 => 5), 123 => array(31 => 10, 108 => 8, 114 => 8), 124 => array(106 => 4, 117 => 3), 199 => array(31 => 12), 202 => array(21 => 2, 115 => 2), 203 => array(21 => 4, 115 => 6), 204 => array(21 => 1, 115 => 1), 205 => array(21 => 3, 111 => 2, 117 => 2), 206 => array(21 => 5, 117 => 4, 121 => 2), 207 => array(21 => 7, 118 => 4), 208 => array(21 => 4, 117 => 3), 209 => array(21 => 4, 115 => 6, 110 => 2), 210 => array(21 => 3, 115 => 3, 106 => 2), 211 => array(117 => 6, 21 => 8, 122 => 5), 212 => array(21 => 1), 213 => array(21 => 9, 118 => 6, 114 => 5), 214 => array(21 => 12, 118 => 7, 114 => 6, 199 => 1), 215 => array(114 => 5, 120 => 12, 118 => 5, 21 => 8), 401 => array(21 => 1), 402 => array(113 => 1, 21 => 2, 120 => 3), 403 => array(113 => 3, 21 => 4, 120 => 6), 404 => array(21 => 6, 113 => 6, 109 => 3, 110 => 1), 405 => array(21 => 4, 121 => 4), 406 => array(21 => 8, 122 => 7), 407 => array(110 => 2, 21 => 1), 408 => array(110 => 6, 21 => 6), 502 => array(44 => 2, 21 => 1), 503 => array(44 => 4, 21 => 1, 117 => 1), 41 => array(), 42 => array(41 => 1), 43 => array(41 => 1, 114 => 7));
// **************************************************************************************
$tree = array();
$filter = array();
$reclevel = -1;
$maxreclevel = -1;
function walk_tree($arr, $id)
{
    global $reqs, $reclevel, $maxreclevel, $tree;
示例#3
0
<?php

// Флот 2: подготавливает координаты цели
loca_add("menu", $GlobalUni['lang']);
loca_add("fleetorder", $GlobalUni['lang']);
loca_add("fleet", $GlobalUni['lang']);
if (key_exists('cp', $_GET)) {
    SelectPlanet($GlobalUser['player_id'], intval($_GET['cp']));
}
$GlobalUser['aktplanet'] = GetSelectedPlanet($GlobalUser['player_id']);
$now = time();
UpdateQueue($now);
$aktplanet = GetPlanet($GlobalUser['aktplanet']);
$aktplanet = ProdResources($aktplanet, $aktplanet['lastpeek'], $now);
UpdatePlanetActivity($aktplanet['planet_id']);
UpdateLastClick($GlobalUser['player_id']);
$session = $_GET['session'];
if (method() !== "POST") {
    MyGoto("flotten1");
}
PageHeader("flotten2");
?>

<!-- CONTENT AREA -->
<div id='content'>
<center>


  <script language="JavaScript" src="js/flotten.js"></script>
  <script language="JavaScript" src="js/ocnt.js"></script>
示例#4
0
// - Контроль полётов (все)
// - История переходов (только админ)
// - Жалобы (все)
// - Баны (все)
// - Пользователи (операторы могут только смотреть и часть изменять (например отключать проверку IP), админ может изменять)
// - Планеты (операторы могут только смотреть и часть изменять (например названия планет), админ может изменять)
// - Задания (только админ)
// - Настройки Вселенной (только админ)
// - Ошибки (только админ)
if ($GlobalUser['admin'] == 0) {
    RedirectHome();
}
// обычным пользователям доступ запрещен
loca_add("menu", $GlobalUser['lang']);
loca_add("fleetorder", $GlobalUser['lang']);
loca_add("admin", $GlobalUser['lang']);
$AdminMessage = "";
$AdminError = "";
$session = $_GET['session'];
$mode = $_GET['mode'];
// Админ-панель для быстрого перехода.
function AdminPanel()
{
    global $session;
    ?>

<table><tr><td>

<a href="index.php?page=admin&session=<?php 
    echo $session;
    ?>
示例#5
0
<?php

require_once "config.php";
require_once "db.php";
require_once "loca.php";
require_once "uni.php";
if (!key_exists('ogamelang', $_COOKIE)) {
    $loca_lang = "ru";
} else {
    $loca_lang = $_COOKIE['ogamelang'];
}
if (!key_exists($loca_lang, $Languages)) {
    $GlobalUser['lang'] = $loca_lang = 'en';
}
loca_add("maintain", $loca_lang);
// Format string, according to tokens from the text. Tokens are represented as #1, #2 and so on.
function va($subject)
{
    $num_arg = func_num_args();
    $pattern = array();
    for ($i = 1; $i < $num_arg; $i++) {
        $pattern[$i - 1] = "/#{$i}/";
        $replace[$i - 1] = func_get_arg($i);
    }
    return preg_replace($pattern, $replace, $subject);
}
// Соединиться с базой данных
dbconnect($db_host, $db_user, $db_pass, $db_name);
dbquery("SET NAMES 'utf8';");
dbquery("SET CHARACTER SET 'utf8';");
dbquery("SET SESSION collation_connection = 'utf8_general_ci';");
示例#6
0
/*
Список типов заданий:
1 - Атака
2 - Совместная атака
3 - Транспорт
4 - Оставить
5 - Держаться
6 - Шпионаж
7 - Колонизировать
8 - Переработать
9 - Уничтожить
15 - Экспедиция
*/
loca_add("menu", $GlobalUser['lang']);
loca_add("fleetorder", $GlobalUser['lang']);
loca_add("fleet", $GlobalUser['lang']);
if (key_exists('cp', $_GET)) {
    SelectPlanet($GlobalUser['player_id'], intval($_GET['cp']));
}
$GlobalUser['aktplanet'] = GetSelectedPlanet($GlobalUser['player_id']);
$now = time();
UpdateQueue($now);
$aktplanet = GetPlanet($GlobalUser['aktplanet']);
$aktplanet = ProdResources($aktplanet, $aktplanet['lastpeek'], $now);
UpdatePlanetActivity($aktplanet['planet_id']);
UpdateLastClick($GlobalUser['player_id']);
$session = $_GET['session'];
if (method() !== "POST") {
    MyGoto("flotten1");
}
$uni = LoadUniverse();
loca_add("JOIN_PASS", "Пароль:");
loca_add("JOIN_ADVICE", "Мы советуем вселенную");
loca_add("JOIN_TIP", "очень советуем!");
loca_add("JOIN_UNIS", "Особенности во вселенных");
loca_add("JOIN_IACCEPT", "Я принимаю");
loca_add("JOIN_TAC", "Основные положения");
loca_add("JOIN_REGISTER", "Отправить регистрацию");
loca_add("INSTALL_MDB", "Настройки центральной базы данных");
loca_add("INSTALL_MDB_TIP", "Центральная база данных может находится на другом сервере (обычно там же, где и стартовая страница) и хранит информацию обо всех вселенных, купоны и пр. общую информацию");
loca_add("INSTALL_MDB_HOST", "Хост");
loca_add("INSTALL_MDB_USER", "Пользователь");
loca_add("INSTALL_MDB_PASS", "Пароль");
loca_add("INSTALL_MDB_NAME", "Название БД");
loca_add("INSTALL_INSTALL", "Инсталлировать");
loca_add("INSTALL_ERROR1", "Не удалось сохранить файл конфигурации.");
loca_add("INSTALL_DONE", "Установка завершена. Файл конфигурации создан.");
/*
    // "tr"
    $LocaLang = "tr";
    {
        loca_add("SERVERNAME" , "OGame Open Source");
        loca_add("SERVERADDR" , "oldogame.ru");
        loca_add("BOARDADDR"  , "http://board.oldogame.ru");

        loca_add("META_CHARSET" , "utf-8");
        loca_add("META_KEYWORDS" , "OGame, Browsergame, Onlinegame, Browsergames, Browsergame, Spiel, Spiele, Onlinespiel, Onlinespiele, old, old design");
        loca_add("META_DESCRIPTION" , "ОГейм - легендарная космическая стратегия! Откройте вселенную вместе с тысячами игроков!");

        loca_add("ERROR_0" , "OK");
        loca_add("ERROR_101" , "Bu oyuncu ismi zaten kullanılıyor!");
        loca_add("ERROR_102" , "Bu email adresi zaten kullanılıyor!");
<?php

// Технологии (детали).
loca_add("menu", $GlobalUser['lang']);
loca_add("techtree", $GlobalUser['lang']);
if (key_exists('cp', $_GET)) {
    SelectPlanet($GlobalUser['player_id'], intval($_GET['cp']));
}
$GlobalUser['aktplanet'] = GetSelectedPlanet($GlobalUser['player_id']);
$now = time();
UpdateQueue($now);
$aktplanet = GetPlanet($GlobalUser['aktplanet']);
$aktplanet = ProdResources($aktplanet, $aktplanet['lastpeek'], $now);
UpdatePlanetActivity($aktplanet['planet_id']);
UpdateLastClick($GlobalUser['player_id']);
$session = $_GET['session'];
PageHeader("techtreedetails");
echo "<!-- CONTENT AREA -->\n";
echo "<div id='content'>\n";
echo "<center>\n";
// **************************************************************************************
// Список объектов что-чему требуется.
$reqs = array(1 => array(), 2 => array(), 3 => array(), 4 => array(), 12 => array(3 => 5, 113 => 3), 14 => array(), 15 => array(14 => 10, 108 => 10), 21 => array(14 => 2), 22 => array(), 23 => array(), 24 => array(), 31 => array(), 33 => array(15 => 1, 113 => 12), 34 => array(), 44 => array(21 => 1), 106 => array(31 => 3), 108 => array(31 => 1), 109 => array(31 => 4), 110 => array(113 => 3, 31 => 6), 111 => array(31 => 2), 113 => array(31 => 1), 114 => array(113 => 5, 110 => 5, 31 => 7), 115 => array(113 => 1), 117 => array(113 => 1, 31 => 2), 118 => array(114 => 3), 120 => array(113 => 2), 121 => array(31 => 4, 120 => 5, 113 => 4), 122 => array(113 => 8, 120 => 10, 121 => 5), 123 => array(31 => 10, 108 => 8, 114 => 8), 124 => array(106 => 4, 117 => 3), 199 => array(31 => 12), 202 => array(21 => 2, 115 => 2), 203 => array(21 => 4, 115 => 6), 204 => array(21 => 1, 115 => 1), 205 => array(21 => 3, 111 => 2, 117 => 2), 206 => array(21 => 5, 117 => 4, 121 => 2), 207 => array(21 => 7, 118 => 4), 208 => array(21 => 4, 117 => 3), 209 => array(21 => 4, 115 => 6, 110 => 2), 210 => array(21 => 3, 115 => 3, 106 => 2), 211 => array(117 => 6, 21 => 8, 122 => 5), 212 => array(21 => 1), 213 => array(21 => 9, 118 => 6, 114 => 5), 214 => array(21 => 12, 118 => 7, 114 => 6, 199 => 1), 215 => array(114 => 5, 120 => 12, 118 => 5, 21 => 8), 401 => array(21 => 1), 402 => array(113 => 1, 21 => 2, 120 => 3), 403 => array(113 => 3, 21 => 4, 120 => 6), 404 => array(21 => 6, 113 => 6, 109 => 3, 110 => 1), 405 => array(21 => 4, 121 => 4), 406 => array(21 => 8, 122 => 7), 407 => array(110 => 2, 21 => 1), 408 => array(110 => 6, 21 => 6), 502 => array(44 => 2, 21 => 1), 503 => array(44 => 4, 21 => 1, 117 => 1), 41 => array(), 42 => array(41 => 1), 43 => array(41 => 1, 114 => 7));
// **************************************************************************************
$tree = array();
$filter = array();
$reclevel = -1;
$maxreclevel = -1;
function walk_tree($arr, $id)
{
    global $reqs, $reclevel, $maxreclevel, $tree;
示例#9
0
    //
    SecurityCheck('/[0-9a-f]{12}/', $_GET['session'], "Манипулирование публичной сессией");
    if (CheckSession($_GET['session']) == FALSE) {
        die;
    }
} else {
    RedirectHome();
    die;
}
if ($GlobalUni['freeze'] && $GlobalUser['admin'] == 0) {
    echo "<html><head><meta http-equiv='refresh' content='0;url=maintenance.php' /></head><body></body></html>";
    ob_end_flush();
    exit;
}
loca_add("common", $GlobalUni['lang']);
loca_add("technames", $GlobalUni['lang']);
//
// Проверка параметров GET / POST на возможные SQL-инъекции
//
if ($_GET['page'] !== "admin") {
    if (stripos($_SERVER['REQUEST_URI'], "select") != false) {
        Hacking("HACK_SQL_INJECTION");
    }
    if (stripos($_SERVER['REQUEST_URI'], "insert") != false) {
        Hacking("HACK_SQL_INJECTION");
    }
    if (stripos($_SERVER['REQUEST_URI'], "update") != false) {
        Hacking("HACK_SQL_INJECTION");
    }
    foreach ($_GET as $i => $value) {
        if (stripos($value, "select") != false) {
示例#10
0
<?php

// Империя.
loca_add("menu", $GlobalUni['lang']);
loca_add("empire", $GlobalUni['lang']);
if (key_exists('cp', $_GET)) {
    SelectPlanet($GlobalUser['player_id'], intval($_GET['cp']));
}
$GlobalUser['aktplanet'] = GetSelectedPlanet($GlobalUser['player_id']);
// Обработка параметров.
if (key_exists('modus', $_GET) && !$GlobalUser['vacation']) {
    if ($_GET['modus'] === 'add') {
        BuildEnque(intval($_GET['planet']), intval($_GET['techid']), 0);
    } else {
        if ($_GET['modus'] === 'destroy') {
            BuildEnque(intval($_GET['planet']), intval($_GET['techid']), 1);
        } else {
            if ($_GET['modus'] === 'remove') {
                BuildDeque(intval($_GET['planet']), intval($_GET['listid']));
            }
        }
    }
}
$now = time();
UpdateQueue($now);
$aktplanet = GetPlanet($GlobalUser['aktplanet']);
$aktplanet = ProdResources($aktplanet, $aktplanet['lastpeek'], $now);
UpdatePlanetActivity($aktplanet['planet_id']);
UpdateLastClick($GlobalUser['player_id']);
$session = $_GET['session'];
PageHeader("imperium", true);
示例#11
0
<?php

// Заказ офицеров.
$MicropaymentMessage = "";
$MicropaymentError = "";
loca_add("menu", $GlobalUser['lang']);
loca_add("premium", $GlobalUser['lang']);
if (key_exists('cp', $_GET)) {
    SelectPlanet($GlobalUser['player_id'], intval($_GET['cp']));
}
$GlobalUser['aktplanet'] = GetSelectedPlanet($GlobalUser['player_id']);
$now = time();
UpdateQueue($now);
$aktplanet = GetPlanet($GlobalUser['aktplanet']);
$aktplanet = ProdResources($aktplanet, $aktplanet['lastpeek'], $now);
UpdatePlanetActivity($aktplanet['planet_id']);
UpdateLastClick($GlobalUser['player_id']);
$session = $_GET['session'];
// Стоимость офицеров.
$price = array(1 => 10000, 2 => 10000, 3 => 10000, 4 => 10000, 5 => 10000);
function OfficerLeft($qcmd)
{
    global $GlobalUser;
    $now = time();
    $end = GetOfficerLeft($GlobalUser['player_id'], $qcmd);
    if ($end <= $now) {
        return loca("PREM_INACTIVE");
    } else {
        $d = ceil(($end - $now) / (60 * 60 * 24));
        return va(loca("PREM_ACTIVE"), $d);
    }
示例#12
0
<?php

// Обзор.
loca_add("menu", $GlobalUni['lang']);
loca_add("fleetorder", $GlobalUni['lang']);
loca_add("overview", $GlobalUni['lang']);
$OverviewMessage = "";
$OverviewError = "";
require_once "overview_events.php";
if (key_exists('cp', $_GET)) {
    SelectPlanet($GlobalUser['player_id'], intval($_GET['cp']));
}
$GlobalUser['aktplanet'] = GetSelectedPlanet($GlobalUser['player_id']);
$now = time();
if ($GlobalUser['admin'] == 0) {
    UpdateQueue($now);
}
// Не обновлять Обзор для админов
$aktplanet = GetPlanet($GlobalUser['aktplanet']);
$aktplanet = ProdResources($aktplanet, $aktplanet['lastpeek'], $now);
UpdateLastClick($GlobalUser['player_id']);
$session = $_GET['session'];
PageHeader("overview");
// *******************************************************************
if (key_exists('lgn', $_GET)) {
    UpdatePlanetActivity($aktplanet['planet_id']);
    // Обновить активность на Главной планете при входе в игру.
}
$uni = $GlobalUni;
?>
示例#13
0
<?php

// Настройки.
// Es wurden bereits 2 E-Mails an Dich geschickt. Heute ist kein weiterer E-Mail-Versand möglich, bitte versuch es morgen nochmal.
$OptionsMessage = "";
$OptionsError = "";
loca_add("menu", $GlobalUser['lang']);
loca_add("options", $GlobalUser['lang']);
if (key_exists('cp', $_GET)) {
    SelectPlanet($GlobalUser['player_id'], intval($_GET['cp']));
}
$GlobalUser['aktplanet'] = GetSelectedPlanet($GlobalUser['player_id']);
$now = time();
UpdateQueue($now);
$aktplanet = GetPlanet($GlobalUser['aktplanet']);
$aktplanet = ProdResources($aktplanet, $aktplanet['lastpeek'], $now);
UpdatePlanetActivity($aktplanet['planet_id']);
UpdateLastClick($GlobalUser['player_id']);
$session = $_GET['session'];
function IsChecked($option)
{
    global $GlobalUser;
    if ($GlobalUser[$option]) {
        return "checked=checked";
    } else {
        return "";
    }
}
function IsSelected($option, $value)
{
    global $GlobalUser;
示例#14
0
<?php

// Сырьё.
loca_add("menu", $GlobalUser['lang']);
loca_add("resources", $GlobalUser['lang']);
if (key_exists('cp', $_GET)) {
    SelectPlanet($GlobalUser['player_id'], intval($_GET['cp']));
}
$GlobalUser['aktplanet'] = GetSelectedPlanet($GlobalUser['player_id']);
$now = time();
UpdateQueue($now);
$aktplanet = GetPlanet($GlobalUser['aktplanet']);
$aktplanet = ProdResources($aktplanet, $aktplanet['lastpeek'], $now);
UpdatePlanetActivity($aktplanet['planet_id']);
UpdateLastClick($GlobalUser['player_id']);
$prem = PremiumStatus($GlobalUser);
if ($prem['geologist']) {
    $geologe_text = "<img border=\"0\" src=\"img/geologe_ikon.gif\" alt=\"Геолог\" onmouseover='return overlib(\"<font color=#ffffff>Геолог</font>\", WIDTH, 80);' onmouseout='return nd();' width=\"20\" height=\"20\">";
    $g_factor = 1.1;
} else {
    $geologe_text = "&nbsp;";
    $g_factor = 1.0;
}
if ($prem['engineer']) {
    $engineer_text = "<img border=\"0\" src=\"img/ingenieur_ikon.gif\" alt=\"Инженер\" onmouseover='return overlib(\"<font color=#ffffff>Инженер</font>\", WIDTH, 80);' onmouseout='return nd();' width=\"20\" height=\"20\">";
    $e_factor = 1.1;
} else {
    $engineer_text = "&nbsp;";
    $e_factor = 1.0;
}
// Обработка POST-запросов (в РО изменять настройки энергии нельзя)
示例#15
0
<?php

// ВЕРСИЯ 2.
// Установочный файл.
// Создает все необходимые таблицы в базе данных, а также файл конфигурации config.php, для доступа к базе.
// Не работет, если файл config.php создан.
require_once "db.php";
require_once "loca.php";
$loca_lang = $_COOKIE['ogamelang'];
if (!key_exists($loca_lang, $Languages)) {
    $loca_lang = 'en';
}
loca_add("install", $loca_lang);
$InstallError = "<font color=gold>" . loca('INSTALL_TIP') . "</font>";
function hostname()
{
    $host = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER["SCRIPT_NAME"];
    $pos = strrpos($host, "/game/install.php");
    return substr($host, 0, $pos + 1);
}
function uniurl()
{
    $host = $_SERVER['HTTP_HOST'] . $_SERVER["SCRIPT_NAME"];
    $pos = strrpos($host, "/game/install.php");
    return substr($host, 0, $pos);
}
ob_start();
// Проверить настройки вселенной.
function CheckParameters()
{
    global $InstallError;
示例#16
0
<?php

require_once "../loca.php";
$loca_lang = $_COOKIE['ogamelang'];
if (!key_exists($loca_lang, $Languages)) {
    $loca_lang = 'en';
}
loca_add("galaxytool", $loca_lang);
// Format string, according to tokens from the text. Tokens are represented as #1, #2 and so on.
function va($subject)
{
    $num_arg = func_num_args();
    $pattern = array();
    $replace = array();
    for ($i = 1; $i < $num_arg; $i++) {
        $pattern[$i - 1] = "/#{$i}/";
        $replace[$i - 1] = func_get_arg($i);
    }
    return preg_replace($pattern, $replace, $subject);
}
function hostname()
{
    $host = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER["SCRIPT_NAME"];
    $pos = strrpos($host, "/game/galaxytool/index.php");
    return substr($host, 0, $pos + 1);
}
// Получить маленькую картинку планеты.
function GetPlanetSmallImage($skinpath, $planet)
{
    if ($planet['type'] == 0 || $planet['type'] == 10003) {
        return $skinpath . "planeten/small/s_mond.jpg";
示例#17
0
<?php

loca_add("menu", $GlobalUser['lang']);
loca_add("fleetorder", $GlobalUser['lang']);
if (key_exists('cp', $_GET)) {
    SelectPlanet($GlobalUser['player_id'], intval($_GET['cp']));
}
$GlobalUser['aktplanet'] = GetSelectedPlanet($GlobalUser['player_id']);
$now = time();
UpdateQueue($now);
$aktplanet = GetPlanet($GlobalUser['aktplanet']);
$aktplanet = ProdResources($aktplanet, $aktplanet['lastpeek'], $now);
UpdatePlanetActivity($aktplanet['planet_id']);
UpdateLastClick($GlobalUser['player_id']);
$session = $_GET['session'];
$unitab = LoadUniverse();
$uni = $unitab['num'];
require_once "phalanx_events.php";
?>
<html>
 <head>
  <link rel='stylesheet' type='text/css' href='css/default.css' />
  <link rel='stylesheet' type='text/css' href='css/formate.css' />
  <link rel="stylesheet" type="text/css" href="<?php 
echo UserSkin();
?>
formate.css" />

  <meta http-equiv="content-type" content="text/html; charset=UTF-8" />

<link rel="stylesheet" type="text/css" href="css/combox.css">
示例#18
0
<?php

loca_add("menu", $GlobalUni['lang']);
loca_add("search", $GlobalUni['lang']);
if (key_exists('cp', $_GET)) {
    SelectPlanet($GlobalUser['player_id'], intval($_GET['cp']));
}
$GlobalUser['aktplanet'] = GetSelectedPlanet($GlobalUser['player_id']);
$now = time();
UpdateQueue($now);
$aktplanet = GetPlanet($GlobalUser['aktplanet']);
$aktplanet = ProdResources($aktplanet, $aktplanet['lastpeek'], $now);
UpdatePlanetActivity($aktplanet['planet_id']);
UpdateLastClick($GlobalUser['player_id']);
$session = $_GET['session'];
PageHeader("suche");
$SEARCH_LIMIT = 25;
$SearchResult = "";
$searchtext = "";
// Вырезать из строки всякие инжекции.
function SecureText($text)
{
    $search = array("'<script[^>]*?>.*?</script>'si", "'<[\\/\\!]*?[^<>]*?>'si", "'([\r\n])[\\s]+'");
    // Вырезает пробельные символы
    $replace = array("", "", "\\1", "\\1");
    $str = preg_replace($search, $replace, $text);
    $str = str_replace("`", "", $str);
    $str = str_replace("'", "", $str);
    $str = str_replace("\"", "", $str);
    $str = str_replace("%0", "", $str);
    return $str;
示例#19
0
<?php

// Верфь, Оборона и Исследования.
loca_add("menu", $GlobalUni['lang']);
loca_add("techshort", $GlobalUni['lang']);
if (key_exists('cp', $_GET)) {
    SelectPlanet($GlobalUser['player_id'], intval($_GET['cp']));
}
$GlobalUser['aktplanet'] = GetSelectedPlanet($GlobalUser['player_id']);
$now = time();
UpdateQueue($now);
$aktplanet = GetPlanet($GlobalUser['aktplanet']);
$aktplanet = ProdResources($aktplanet, $aktplanet['lastpeek'], $now);
UpdatePlanetActivity($aktplanet['planet_id']);
UpdateLastClick($GlobalUser['player_id']);
$session = $_GET['session'];
// Обработка POST-запросов.
if (method() === "POST" && !$GlobalUser['vacation']) {
    foreach ($_POST['fmenge'] as $gid => $value) {
        $result = GetShipyardQueue($aktplanet['planet_id']);
        // Ограничить количество заказов на верфи.
        if (dbrows($result) >= 99) {
            $value = 0;
        }
        if ($value < 0) {
            $value = 0;
        }
        if ($value > 0) {
            // Рассчитать количество (не больше, чем ресурсов на планете и не больше 999)
            if ($value > 999) {
                $value = 999;
function Admin_Planets()
{
    global $loca_lang, $Languages;
    global $session;
    global $db_prefix;
    global $GlobalUser;
    $SearchResult = "";
    $buildmap = array(1, 2, 3, 4, 12, 14, 15, 21, 22, 23, 24, 31, 33, 34, 41, 42, 43, 44);
    $fleetmap = array(202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215);
    $defmap = array(401, 402, 403, 404, 405, 406, 407, 408, 502, 503);
    // Обработка POST-запроса.
    if (method() === "POST" && $GlobalUser['admin'] >= 2) {
        $cp = intval($_GET['cp']);
        $action = $_GET['action'];
        $now = time();
        //print_r ( $_POST);
        if ($action === "update") {
            $param = array('b1', 'b2', 'b3', 'b4', 'b12', 'b14', 'b15', 'b21', 'b22', 'b23', 'b24', 'b31', 'b33', 'b34', 'b41', 'b42', 'b43', 'b44', 'd401', 'd402', 'd403', 'd404', 'd405', 'd406', 'd407', 'd408', 'd502', 'd503', 'f202', 'f203', 'f204', 'f205', 'f206', 'f207', 'f208', 'f209', 'f210', 'f211', 'f212', 'f213', 'f214', 'f215', 'm', 'k', 'd', 'g', 's', 'p', 'diameter', 'type', 'temp', 'mprod', 'kprod', 'dprod', 'sprod', 'fprod', 'ssprod');
            $moon_param = array('g', 's', 'p');
            $query = "UPDATE " . $db_prefix . "planets SET lastpeek={$now}, ";
            foreach ($param as $i => $p) {
                if (strpos($p, "prod")) {
                    $query .= ", {$p}='" . $_POST[$p] . "'";
                } else {
                    if ($i == 0) {
                        $query .= "{$p}=" . intval($_POST[$p]);
                    } else {
                        $query .= ", {$p}=" . intval($_POST[$p]);
                    }
                }
            }
            $query .= " WHERE planet_id={$cp};";
            if (key_exists("delete_planet", $_POST)) {
                $planet = GetPlanet($cp);
                $user = LoadUser($planet['owner_id']);
                if ($user['hplanetid'] != $cp) {
                    DestroyPlanet($cp);
                    $_GET['cp'] = $user['hplanetid'];
                    // перенаправить на главную планету.
                }
            } else {
                // Обновить данные планеты
                $moon_id = PlanetHasMoon($cp);
                // Переместить луну за планетой.
                if ($moon_id) {
                    $mquery = "UPDATE " . $db_prefix . "planets SET lastpeek={$now}, ";
                    foreach ($moon_param as $i => $p) {
                        if ($i == 0) {
                            $mquery .= "{$p}=" . intval($_POST[$p]);
                        } else {
                            $mquery .= ", {$p}=" . intval($_POST[$p]);
                        }
                    }
                    $mquery .= " WHERE planet_id={$moon_id};";
                    dbquery($mquery);
                }
                dbquery($query);
                RecalcFields($cp);
            }
        } else {
            if ($action === "search") {
                $searchtype = $_POST['type'];
                if ($_POST['searchtext'] === "") {
                    $SearchResult .= "Укажите строку для поиска<br>\n";
                    $searchtype = "none";
                }
                if ($searchtype === "playername") {
                    $query = "SELECT player_id FROM " . $db_prefix . "users WHERE oname LIKE '" . $_POST['searchtext'] . "%'";
                    $query = "SELECT * FROM " . $db_prefix . "planets WHERE owner_id = ANY ({$query});";
                } else {
                    if ($searchtype === "planetname") {
                        $query = "SELECT * FROM " . $db_prefix . "planets WHERE name LIKE '" . $_POST['searchtext'] . "%';";
                    } else {
                        if ($searchtype === "allytag") {
                            $query = "SELECT ally_id FROM " . $db_prefix . "ally WHERE tag LIKE '" . $_POST['searchtext'] . "%'";
                            $query = "SELECT player_id FROM " . $db_prefix . "users WHERE ally_id <> 0 AND ally_id = ANY ({$query})";
                            $query = "SELECT * FROM " . $db_prefix . "planets WHERE owner_id = ANY ({$query});";
                        }
                    }
                }
                if ($query) {
                    $result = dbquery($query);
                }
                $SearchResult .= "<table>\n";
                $rows = dbrows($result);
                if ($rows > 0) {
                    while ($rows--) {
                        $planet = dbarray($result);
                        $user = LoadUser($planet['owner_id']);
                        $SearchResult .= "<tr><th>" . date("Y-m-d H:i:s", $planet['date']) . "</th><th>" . AdminPlanetCoord($planet) . "</th>";
                        $SearchResult .= "<th><a href=\"index.php?page=admin&session={$session}&mode=Planets&cp=" . $planet['planet_id'] . "\">" . $planet['name'] . "</a></th>";
                        $SearchResult .= "<th><a href=\"index.php?page=admin&session={$session}&mode=Users&player_id=" . $user['player_id'] . "\">" . $user['oname'] . "</a></th></tr>\n";
                    }
                } else {
                    $SearchResult .= "Ничего не найдено<br>\n";
                }
                $SearchResult .= "</table>\n";
            }
        }
    }
    // Обработка GET-запроса.
    if (method() === "GET" && $GlobalUser['admin'] >= 2) {
        if (key_exists('cp', $_GET)) {
            $cp = intval($_GET['cp']);
        } else {
            $cp = 0;
        }
        if (key_exists('action', $_GET) && $cp) {
            $action = $_GET['action'];
        } else {
            $action = "";
        }
        $now = time();
        if ($action === "create_moon") {
            $planet = GetPlanet($cp);
            if ($planet['type'] > 0 && $planet['type'] < 10000) {
                if (PlanetHasMoon($cp) == 0) {
                    CreatePlanet($planet['g'], $planet['s'], $planet['p'], $planet['owner_id'], 0, 1, 20);
                }
            }
        } else {
            if ($action === "create_debris") {
                $planet = GetPlanet($cp);
                if ($planet['type'] > 0 && $planet['type'] < 10000) {
                    if (HasDebris($planet['g'], $planet['s'], $planet['p']) == 0) {
                        CreateDebris($planet['g'], $planet['s'], $planet['p'], $planet['owner_id']);
                    }
                }
            } else {
                if ($action === "cooldown_gates") {
                    $planet = GetPlanet($cp);
                    if ($planet['type'] == 0) {
                        $query = "UPDATE " . $db_prefix . "planets SET gate_until=0 WHERE planet_id=" . $planet['planet_id'];
                        dbquery($query);
                    }
                } else {
                    if ($action === "warmup_gates") {
                        $planet = GetPlanet($cp);
                        if ($planet['type'] == 0) {
                            $query = "UPDATE " . $db_prefix . "planets SET gate_until=" . ($now + 59 * 60 + 59) . " WHERE planet_id=" . $planet['planet_id'];
                            dbquery($query);
                        }
                    } else {
                        if ($action === "recalc_fields") {
                            RecalcFields($cp);
                        } else {
                            if ($action === "random_diam") {
                                $planet = GetPlanet($cp);
                                if (GetPlanetType($planet) == 1) {
                                    $p = $planet['p'];
                                    if ($p <= 3) {
                                        $diam = mt_rand(50, 120) * 72;
                                    } else {
                                        if ($p >= 4 && $p <= 6) {
                                            $diam = mt_rand(50, 150) * 120;
                                        } else {
                                            if ($p >= 7 && $p <= 9) {
                                                $diam = mt_rand(50, 120) * 120;
                                            } else {
                                                if ($p >= 10 && $p <= 12) {
                                                    $diam = mt_rand(50, 120) * 96;
                                                } else {
                                                    if ($p >= 13 && $p <= 15) {
                                                        $diam = mt_rand(50, 150) * 96;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    $query = "UPDATE " . $db_prefix . "planets SET diameter={$diam} WHERE planet_id=" . $planet['planet_id'];
                                    dbquery($query);
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    if (key_exists("cp", $_GET)) {
        // Информация о планете.
        $planet = GetPlanet(intval($_GET['cp']));
        $user = LoadUser($planet['owner_id']);
        $moon_id = PlanetHasMoon($planet['planet_id']);
        $debris_id = HasDebris($planet['g'], $planet['s'], $planet['p']);
        $now = time();
        // Парсер шпионских докладов.
        ?>
<script>

function php_str_replace(search, replace, subject) {
    // http://kevin.vanzonneveld.net
    var s = subject;
    var ra = r instanceof Array, sa = s instanceof Array;
    var f = [].concat(search);
    var r = [].concat(replace);
    var i = (s = [].concat(s)).length;
    var j = 0;
    while (j = 0, i--) {
        if (s[i]) {
            while (s[i] = (s[i]+'').split(f[j]).join(ra ? r[j] || '' : r[0]), ++j in f){};
        }
    }
    return sa ? s : s[0];
}

function spio ()
{
    global $GlobalUni;

    //
    // Перечислить все технологии для всех языков, а также ресурсы
    //

    var TechNames = {
<?php 
        foreach ($Languages as $lang => $langname) {
            loca_add("common", $lang);
            loca_add("technames", $lang);
        }
        $old_lang = $loca_lang;
        foreach ($Languages as $lang => $langname) {
            $loca_lang = $lang;
            foreach ($buildmap as $i => $gid) {
                echo "\"" . loca("NAME_{$gid}") . "\": {$gid}, ";
            }
            foreach ($fleetmap as $i => $gid) {
                echo "\"" . loca("NAME_{$gid}") . "\": {$gid}, ";
            }
            foreach ($defmap as $i => $gid) {
                echo "\"" . loca("NAME_{$gid}") . "\": {$gid}, ";
            }
        }
        ?>
    };
    var ResNames = {
<?php 
        foreach ($Languages as $lang => $langname) {
            $loca_lang = $lang;
            echo "\"" . loca("METAL") . "\": 'm', ";
            echo "\"" . loca("CRYSTAL") . "\": 'k', ";
            echo "\"" . loca("DEUTERIUM") . "\": 'd', ";
        }
        $loca_lang = $old_lang;
        ?>
    };

    var text = document.getElementById ("spiotext" ).value;
    text = php_str_replace (".", "", text);
    text = php_str_replace (":", "", text);

    for ( var name in TechNames ) {
        var id = TechNames[name];
        pos = text.indexOf ( name );
        if ( pos > 0 ) {
            obj = text.substr ( pos );
            found = obj.match ("("+name+"[\\s]+)([0-9]{1,})");
            document.getElementById ( "obj" + id ) . value = parseInt(found[2]);
        }
    }

    for ( var name in ResNames ) {
        var id = ResNames[name];
        pos = text.indexOf ( name );
        if ( pos > 0 ) {
            obj = text.substr ( pos );
            found = obj.match ("("+name+"[\\s]+)([0-9]{1,})");
            document.getElementById ( "obj" + id ) . value = parseInt(found[2]);
        }
    }

}

function reset ()
{
    var ids = [
<?php 
        foreach ($buildmap as $i => $gid) {
            echo "{$gid}, ";
        }
        foreach ($fleetmap as $i => $gid) {
            echo "{$gid}, ";
        }
        foreach ($defmap as $i => $gid) {
            echo "{$gid}, ";
        }
        ?>
    ];

    for ( var i in ids ) {
        document.getElementById ( "obj" + ids[i] ) . value = 0;
    }
}
</script>

<?php 
        AdminPanel();
        echo "<table>\n";
        echo "<form action=\"index.php?page=admin&session={$session}&mode=Planets&action=update&cp=" . $planet['planet_id'] . "\" method=\"POST\" >\n";
        echo "<tr><td class=c colspan=2>Планета \"" . $planet['name'] . "\" (<a href=\"index.php?page=admin&session={$session}&mode=Users&player_id=" . $user['player_id'] . "\">" . $user['oname'] . "</a>)</td>\n";
        echo "       <td class=c >Постройки</td> <td class=c >Флот</td> <td class=c >Оборона</td> </tr>\n";
        echo "<tr><th><img src=\"" . GetPlanetImage(UserSkin(), $planet) . "\"> <br>Тип: " . $planet['type'];
        $pp = PlanetPrice($planet);
        echo "<br>Стоимость : " . nicenum($pp['points'] / 1000);
        echo "<br>Постройки : " . nicenum(($pp['points'] - ($pp['fleet_pts'] + $pp['defense_pts'])) / 1000);
        echo "<br>Флот : " . nicenum($pp['fleet_pts'] / 1000);
        echo "<br>Оборона : " . nicenum($pp['defense_pts'] / 1000);
        if ($planet['type'] == 10000) {
            echo "<br>М: " . nicenum($planet['m']) . "<br>К: " . nicenum($planet['k']) . "<br>";
        }
        echo "</th><th>";
        if ($planet['type'] > 0 && $planet['type'] < 10000) {
            if ($moon_id) {
                $moon = GetPlanet($moon_id);
                echo "<a href=\"index.php?page=admin&session={$session}&mode=Planets&cp=" . $moon['planet_id'] . "\"><img src=\"" . GetPlanetSmallImage(UserSkin(), $moon) . "\"><br>\n";
                echo $moon['name'] . "</a>";
            } else {
                echo "<a href=\"index.php?page=admin&session={$session}&mode=Planets&action=create_moon&cp=" . $planet['planet_id'] . "\" >Создать луну</a>\n";
            }
            echo "<br/><br/>\n";
            if ($debris_id) {
                $debris = GetPlanet($debris_id);
                echo "<a href=\"index.php?page=admin&session={$session}&mode=Planets&cp=" . $debris['planet_id'] . "\"><img src=\"" . UserSkin() . "planeten/debris.jpg\"><br>\n";
                echo $debris['name'] . "</a>";
                echo "<br>М: " . nicenum($debris['m']) . "<br>К: " . nicenum($debris['k']) . "<br>";
            } else {
                echo "<a href=\"index.php?page=admin&session={$session}&mode=Planets&action=create_debris&cp=" . $planet['planet_id'] . "\" >Создать поле обломков</a>\n";
            }
        } else {
            $parent = LoadPlanet($planet['g'], $planet['s'], $planet['p'], 1);
            echo "<a href=\"index.php?page=admin&session={$session}&mode=Planets&cp=" . $parent['planet_id'] . "\"><img src=\"" . GetPlanetSmallImage(UserSkin(), $parent) . "\"><br>\n";
            echo $parent['name'] . "</a>";
        }
        ?>
        <br><br><textarea rows=10 cols=10 id="spiotext"></textarea>
        <a href="#" onclick="javascript:spio();">Разобрать данные доклада</a> <br>
        <a href="#" onclick="javascript:reset();">Сбросить</a>
<?php 
        echo "</th>";
        echo "<th valign=top><table>\n";
        foreach ($buildmap as $i => $gid) {
            echo "<tr><th>" . loca("NAME_{$gid}");
            if ($gid == 43 && $planet['type'] == 0) {
                // управление воротами.
                if ($now >= $planet["gate_until"]) {
                    // ворота готовы
                    echo " <a href=\"index.php?page=admin&session={$session}&mode=Planets&action=warmup_gates&cp=" . $planet['planet_id'] . "\" >нагреть</a>";
                } else {
                    // ворота НЕ готовы
                    $delta = $planet["gate_until"] - $now;
                    echo " " . date('i\\m s\\s', $delta) . " <a href=\"index.php?page=admin&session={$session}&mode=Planets&action=cooldown_gates&cp=" . $planet['planet_id'] . "\">остудить</a>";
                }
            }
            echo "</th><th><nobr><input id=\"obj{$gid}\" type=\"text\" size=3 name=\"b{$gid}\" value=\"" . $planet["b{$gid}"] . "\" />";
            // управление шахтами и выработкой энергии.
            if ($gid == 1 && $planet['type'] != 0) {
                echo "<select name='mprod'>\n";
                for ($prc = 0; $prc <= 1; $prc += 0.1) {
                    echo "<option value='{$prc}' ";
                    if ($planet["mprod"] == $prc . "") {
                        echo " selected";
                    }
                    echo ">" . $prc * 100 . "</option>\n";
                }
                echo "</select>\n";
            }
            if ($gid == 2 && $planet['type'] != 0) {
                echo "<select name='kprod'>\n";
                for ($prc = 0; $prc <= 1; $prc += 0.1) {
                    echo "<option value='{$prc}' ";
                    if ($planet["kprod"] == $prc . "") {
                        echo " selected";
                    }
                    echo ">" . $prc * 100 . "</option>\n";
                }
                echo "</select>\n";
            }
            if ($gid == 3 && $planet['type'] != 0) {
                echo "<select name='dprod'>\n";
                for ($prc = 0; $prc <= 1; $prc += 0.1) {
                    echo "<option value='{$prc}' ";
                    if ($planet["dprod"] == $prc . "") {
                        echo " selected";
                    }
                    echo ">" . $prc * 100 . "</option>\n";
                }
                echo "</select>\n";
            }
            if ($gid == 4 && $planet['type'] != 0) {
                echo "<select name='sprod'>\n";
                for ($prc = 0; $prc <= 1; $prc += 0.1) {
                    echo "<option value='{$prc}' ";
                    if ($planet["sprod"] == $prc . "") {
                        echo " selected";
                    }
                    echo ">" . $prc * 100 . "</option>\n";
                }
                echo "</select>\n";
            }
            if ($gid == 12 && $planet['type'] != 0) {
                echo "<select name='fprod'>\n";
                for ($prc = 0; $prc <= 1; $prc += 0.1) {
                    echo "<option value='{$prc}' ";
                    if ($planet["fprod"] == $prc . "") {
                        echo " selected";
                    }
                    echo ">" . $prc * 100 . "</option>\n";
                }
                echo "</select>\n";
            }
            echo "</nobr></th></tr>\n";
        }
        echo "</table></th>\n";
        echo "<th valign=top><table>\n";
        foreach ($fleetmap as $i => $gid) {
            echo "<tr><th>" . loca("NAME_{$gid}") . "</th><th><nobr><input id=\"obj{$gid}\" type=\"text\" size=6 name=\"f{$gid}\" value=\"" . $planet["f{$gid}"] . "\" />";
            if ($gid == 212 && $planet['type'] != 0) {
                echo "<select name='ssprod'>\n";
                for ($prc = 0; $prc <= 1; $prc += 0.1) {
                    echo "<option value='{$prc}' ";
                    if ($planet["ssprod"] == $prc . "") {
                        echo " selected";
                    }
                    echo ">" . $prc * 100 . "</option>\n";
                }
                echo "</select>\n";
            }
            echo "</nobr></th></tr>\n";
        }
        echo "</table></th>\n";
        echo "<th valign=top><table>\n";
        foreach ($defmap as $i => $gid) {
            echo "<tr><th>" . loca("NAME_{$gid}") . "</th><th><input id=\"obj{$gid}\" type=\"text\" size=6 name=\"d{$gid}\" value=\"" . $planet["d{$gid}"] . "\" /></th></tr>\n";
        }
        echo "</table></th>\n";
        echo "</tr>\n";
        echo "<tr><th>Дата создания</th><th>" . date("Y-m-d H:i:s", $planet['date']) . "</th> <td colspan=10 class=c>Очередь построек</td></tr>";
        echo "<tr><th>Дата удаления</th><th>" . date("Y-m-d H:i:s", $planet['remove']) . "</th> <th colspan=3 rowspan=12 valign=top style='text-align: left;'> ";
        $query = "SELECT * FROM " . $db_prefix . "buildqueue WHERE planet_id = " . $planet['planet_id'] . " ORDER BY list_id ASC";
        $result = dbquery($query);
        $anz = dbrows($result);
        echo "<table>";
        $bxx = 1;
        $duration = 0;
        while ($row = dbarray($result)) {
            echo "<tr><td> <table><tr><th><div id='bxx" . $bxx . "' title='" . ($row['end'] - $row['start'] - ($now - ($row['start'] + $duration))) . "' star='" . $duration . "'></th>";
            echo "<tr><th>" . date("d.m.Y H:i:s", $row['end'] + $duration) . "</th></tr></table></td>";
            echo "<td><img width='32px' src='" . UserSkin() . "gebaeude/" . $row['tech_id'] . ".gif'></td>";
            echo "<td><b>" . loca("NAME_" . $row['tech_id']) . "</b><br>уровень " . $row['level'] . "</td></tr>";
            $bxx++;
            $duration += $row['end'] - $row['start'];
        }
        echo "</table>";
        echo "<script language=javascript>anz={$anz};t();</script>\n";
        ?>

<?php 
        echo "</th> </tr>";
        echo "<tr><th>Последняя активность</th><th>" . date("Y-m-d H:i:s", $planet['lastakt']) . "</th>  \n";
        echo "<input type=\"hidden\" name=\"type\" value=\"" . $planet['type'] . "\" >\n";
        echo "</th> </tr>\n";
        echo "<tr><th>Последнее обновление</th><th>" . date("Y-m-d H:i:s", $planet['lastpeek']) . "</th></tr>\n";
        echo "<tr><th>Диаметр <br><a href=\"index.php?page=admin&session={$session}&mode=Planets&action=random_diam&cp=" . $planet['planet_id'] . "\" >новый диаметр</a>  </th><th><input size=5 type=\"text\" name=\"diameter\" value=\"" . $planet['diameter'] . "\" /> км (" . $planet['fields'] . " из " . $planet['maxfields'] . " полей) ";
        echo "<a href=\"index.php?page=admin&session={$session}&mode=Planets&action=recalc_fields&cp=" . $planet['planet_id'] . "\" >пересчитать поля</a> ";
        echo "</th></tr>\n";
        echo "<tr><th>Температура</th><th>от <input size=5 type=\"text\" name=\"temp\" value=\"" . $planet['temp'] . "\" />°C до " . ($planet['temp'] + 40) . "°C</th></tr>\n";
        echo "<tr><th>Координаты</th><th>[<input type=\"text\" name=\"g\" value=\"" . $planet['g'] . "\" size=1 />:<input type=\"text\" name=\"s\" value=\"" . $planet['s'] . "\" size=2 />:<input type=\"text\" name=\"p\" value=\"" . $planet['p'] . "\" size=1 />]</th></tr>\n";
        echo "<tr><td class=c colspan=2>Ресурсы</td></tr>\n";
        echo "<tr><th>Металл</th><th><input id=\"objm\" type=\"text\" name=\"m\" value=\"" . ceil($planet['m']) . "\" /></th></tr>\n";
        echo "<tr><th>Кристалл</th><th><input id=\"objk\" type=\"text\" name=\"k\" value=\"" . ceil($planet['k']) . "\" /></th></tr>\n";
        echo "<tr><th>Дейтерий</th><th><input id=\"objd\" type=\"text\" name=\"d\" value=\"" . ceil($planet['d']) . "\" /></th></tr>\n";
        echo "<tr><th>Энергия</th><th>" . $planet['e'] . " / " . $planet['emax'] . "</th></tr>\n";
        echo "<tr><th>Коэффициент производства</th><th>" . $planet['factor'] . "</th></tr>\n";
        echo "<tr><th colspan=8><input type=\"submit\" value=\"Сохранить\" />  <input type=\"submit\" name=\"delete_planet\" value=\"Удалить\" /> </th></tr>\n";
        echo "</form>\n";
        echo "</table>\n";
    } else {
        $query = "SELECT * FROM " . $db_prefix . "planets ORDER BY date DESC LIMIT 25";
        $result = dbquery($query);
        AdminPanel();
        echo "    </th> \n";
        echo "   </tr> \n";
        echo "</table> \n";
        echo "Новые планеты:<br>\n";
        echo "<table>\n";
        echo "<tr><td class=c>Дата создания</td><td class=c>Координаты</td><td class=c>Планета</td><td class=c>Игрок</td></tr>\n";
        $rows = dbrows($result);
        while ($rows--) {
            $planet = dbarray($result);
            $user = LoadUser($planet['owner_id']);
            echo "<tr><th>" . date("Y-m-d H:i:s", $planet['date']) . "</th><th>" . AdminPlanetCoord($planet) . "</th>";
            echo "<th><a href=\"index.php?page=admin&session={$session}&mode=Planets&cp=" . $planet['planet_id'] . "\">" . $planet['name'] . "</a></th>";
            echo "<th>" . AdminUserName($user) . "</th></tr>\n";
        }
        echo "</table>\n";
        ?>
       </th> 
       </tr> 
    </table>
    Искать:<br>
 <form action="index.php?page=admin&session=<?php 
        echo $session;
        ?>
&mode=Planets&action=search" method="post">
 <table>
  <tr>
   <th>
    <select name="type">
     <option value="playername">Имя игрока</option>
     <option value="planetname" >Имя планеты</option>
     <option value="allytag" >Аббревиатура альянса</option>
    </select>
    &nbsp;&nbsp;
    <input type="text" name="searchtext" value=""/>
    &nbsp;&nbsp;
    <input type="submit" value="Искать" />
   </th>
  </tr>
 </table>
 </form>
<?php 
        if ($SearchResult !== "") {
            ?>
       </th> 
       </tr> 
    </table>
    Результаты поиска:<br>
    <?php 
            echo $SearchResult;
        }
    }
}
示例#21
0
<?php

// Информация на постройки, флот, оборону и исследования.
// Некоторые страницы (в частности постройки) содержат дополнительные сведения или элементы управления.
loca_add("menu", $GlobalUser['lang']);
loca_add("techlong", $GlobalUser['lang']);
loca_add("jumpgate", $GlobalUser['lang']);
if (key_exists('cp', $_GET)) {
    SelectPlanet($GlobalUser['player_id'], intval($_GET['cp']));
}
$GlobalUser['aktplanet'] = GetSelectedPlanet($GlobalUser['player_id']);
$now = time();
UpdateQueue($now);
$aktplanet = GetPlanet($GlobalUser['aktplanet']);
$aktplanet = ProdResources($aktplanet, $aktplanet['lastpeek'], $now);
UpdatePlanetActivity($aktplanet['planet_id']);
UpdateLastClick($GlobalUser['player_id']);
$session = $_GET['session'];
$fleetmap = array(215, 214, 213, 211, 210, 209, 208, 207, 206, 205, 204, 203, 202);
// ***************************************************************************************
$unitab = LoadUniverse();
$speed = $unitab['speed'];
$drepair = $unitab['defrepair'];
function rgnum($num)
{
    if ($num < 0) {
        return "<font color=\"#FF0000\">" . nicenum($num) . "</font>";
    } else {
        if ($num > 0) {
            return "<font color=\"#00FF00\">" . nicenum($num) . "</font>";
        } else {
示例#22
0
function Admin_BattleReport()
{
    global $session;
    global $db_prefix;
    global $GlobalUser;
    ?>

<?php 
    echo AdminPanel();
    ?>

<?php 
    // Показать боевой доклад
    if (key_exists('bericht', $_GET)) {
        $query = "SELECT * FROM " . $db_prefix . "battledata WHERE battle_id = " . intval($_GET['bericht']);
        $result = dbquery($query);
        $row = dbarray($result);
        ob_clean();
        loca_add("battlereport");
        ?>
<html>
<HEAD>
<LINK rel="stylesheet" type="text/css" href="<?php 
        echo UserSkin();
        ?>
formate.css">
  <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
  <TITLE><?php 
        echo loca("BATTLE_REPORT");
        ?>
</TITLE>
  <script src="js/utilities.js" type="text/javascript"></script>
  <script type="text/javascript" src="js/overLib/overlib.js"></script>
  <script language="JavaScript">var session="<?php 
        echo $session;
        ?>
";</script>

</HEAD>
<BODY>
<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
<table width="99%">
   <tr>
    <td>
<?php 
        echo $row['report'];
        ?>
</td>
   </tr>
</table>
</BODY>
</html>
<?php 
        ob_end_flush();
        die;
    }
    // Вывести список всех докладов
    $query = "SELECT * FROM " . $db_prefix . "battledata ORDER BY date DESC";
    $result = dbquery($query);
    echo "<table>";
    while ($row = dbarray($result)) {
        echo "<tr><td>" . date("Y.m.d H:i:s", $row['date']) . "</td><td>" . str_replace("{PUBLIC_SESSION}", $session, $row['title']) . "</td></tr>";
    }
    echo "</table>";
    ?>

<?php 
}
// TODO : картинки лун
if (key_exists('cp', $_GET)) {
    SelectPlanet($GlobalUser['player_id'], (int) $_GET['cp']);
}
$GlobalUser['aktplanet'] = GetSelectedPlanet($GlobalUser['player_id']);
$now = time();
UpdateQueue($now);
$aktplanet = GetPlanet($GlobalUser['aktplanet']);
$aktplanet = ProdResources($aktplanet, $aktplanet['lastpeek'], $now);
UpdateLastClick($GlobalUser['player_id']);
$session = $_GET['session'];
loca_add("common", $GlobalUser['lang']);
loca_add("menu", $GlobalUser['lang']);
loca_add("technames", $GlobalUser['lang']);
loca_add("fleetorder", $GlobalUser['lang']);
loca_add("overview", $GlobalUser['lang']);
##############################################################################################################
include "redesign_header.php";
include "redesign_leftmenu.php";
function planet_header($planet)
{
    $type = $planet['type'];
    if ($type == 0) {
        return "red_images/57a80a58c7a48b8d27316b753dd259.jpg";
    } else {
        if ($type >= 101 && $type <= 110) {
            return "red_images/planet/header/header_dry.jpg";
        } else {
            if ($type >= 201 && $type <= 210) {
                return "red_images/planet/header/header_jungle.jpg";
            } else {
示例#24
0
<?php

loca_add("menu", $GlobalUser['lang']);
loca_add("search", $GlobalUser['lang']);
if (key_exists('cp', $_GET)) {
    SelectPlanet($GlobalUser['player_id'], intval($_GET['cp']));
}
$GlobalUser['aktplanet'] = GetSelectedPlanet($GlobalUser['player_id']);
$now = time();
UpdateQueue($now);
$aktplanet = GetPlanet($GlobalUser['aktplanet']);
$aktplanet = ProdResources($aktplanet, $aktplanet['lastpeek'], $now);
UpdatePlanetActivity($aktplanet['planet_id']);
UpdateLastClick($GlobalUser['player_id']);
$session = $_GET['session'];
PageHeader("suche");
$SEARCH_LIMIT = 25;
$SearchResult = "";
$searchtext = "";
// Вырезать из строки всякие инжекции.
function SecureText($text)
{
    $search = array("'<script[^>]*?>.*?</script>'si", "'<[\\/\\!]*?[^<>]*?>'si", "'([\r\n])[\\s]+'");
    // Вырезает пробельные символы
    $replace = array("", "", "\\1", "\\1");
    $str = preg_replace($search, $replace, $text);
    $str = str_replace("`", "", $str);
    $str = str_replace("'", "", $str);
    $str = str_replace("\"", "", $str);
    $str = str_replace("%0", "", $str);
    return $str;
<?php

// Заказ офицеров.
$MicropaymentMessage = "";
$MicropaymentError = "";
loca_add("menu", $GlobalUni['lang']);
loca_add("premium", $GlobalUni['lang']);
if (key_exists('cp', $_GET)) {
    SelectPlanet($GlobalUser['player_id'], intval($_GET['cp']));
}
$GlobalUser['aktplanet'] = GetSelectedPlanet($GlobalUser['player_id']);
$now = time();
UpdateQueue($now);
$aktplanet = GetPlanet($GlobalUser['aktplanet']);
$aktplanet = ProdResources($aktplanet, $aktplanet['lastpeek'], $now);
UpdatePlanetActivity($aktplanet['planet_id']);
UpdateLastClick($GlobalUser['player_id']);
$session = $_GET['session'];
// Стоимость офицеров.
$price = array(1 => 10000, 2 => 10000, 3 => 10000, 4 => 10000, 5 => 10000);
function OfficerLeft($qcmd)
{
    global $GlobalUser;
    $now = time();
    $end = GetOfficerLeft($GlobalUser['player_id'], $qcmd);
    if ($end <= $now) {
        return loca("PREM_INACTIVE");
    } else {
        $d = ceil(($end - $now) / (60 * 60 * 24));
        return va(loca("PREM_ACTIVE"), $d);
    }
示例#26
0
function ColonizationReturn($queue, $fleet_obj, $fleet, $origin, $target)
{
    AdjustResources($fleet_obj['m'], $fleet_obj['k'], $fleet_obj['d'], $fleet_obj['start_planet'], '+');
    AdjustShips($fleet, $fleet_obj['start_planet'], '+');
    UpdatePlanetActivity($fleet_obj['start_planet'], $queue['end']);
    $origin_user = LoadUser($origin['owner_id']);
    loca_add("technames", $origin_user['lang']);
    $text = "Один из Ваших флотов ( " . FleetList($fleet) . " ), отправленных с <a href=# onclick=showGalaxy(" . $target['g'] . "," . $target['s'] . "," . $target['p'] . "); >[" . $target['g'] . ":" . $target['s'] . ":" . $target['p'] . "]</a>, " . "достигает " . $origin['name'] . " <a href=# onclick=showGalaxy(" . $origin['g'] . "," . $origin['s'] . "," . $origin['p'] . "); >[" . $origin['g'] . ":" . $origin['s'] . ":" . $origin['p'] . "]</a> . ";
    if ($fleet_obj['m'] + $fleet_obj['k'] + $fleet_obj['d'] != 0) {
        $text .= "Флот доставляет " . nicenum($fleet_obj['m']) . " металла, " . nicenum($fleet_obj['k']) . " кристалла и " . nicenum($fleet_obj['d']) . " дейтерия<br>";
    }
    SendMessage($fleet_obj['owner_id'], "Командование флотом", "Возвращение флота", $text, 5, $queue['end']);
    // Удалить фантом колонизации.
    if ($target['type'] == 10002) {
        DestroyPlanet($target['planet_id']);
    }
}
示例#27
0
require_once "../bbcode.php";
require_once "../msg.php";
require_once "../prod.php";
require_once "../planet.php";
require_once "../bot.php";
require_once "../user.php";
require_once "../queue.php";
require_once "../uni.php";
require_once "../debug.php";
require_once "../loca.php";
if (!key_exists('ogamelang', $_COOKIE)) {
    $loca_lang = "ru";
} else {
    $loca_lang = $_COOKIE['ogamelang'];
}
loca_add("reg", $loca_lang);
function method()
{
    return $_SERVER['REQUEST_METHOD'];
}
function hostname()
{
    $host = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER["SCRIPT_NAME"];
    $pos = strrpos($host, "/game/reg/mail.php");
    return substr($host, 0, $pos + 1);
}
?>

<html> 
<head> 
<title><?php 
示例#28
0
<?php

// Настройки.
// Es wurden bereits 2 E-Mails an Dich geschickt. Heute ist kein weiterer E-Mail-Versand möglich, bitte versuch es morgen nochmal.
$OptionsMessage = "";
$OptionsError = "";
loca_add("menu", $GlobalUni['lang']);
loca_add("options", $GlobalUni['lang']);
if (key_exists('cp', $_GET)) {
    SelectPlanet($GlobalUser['player_id'], intval($_GET['cp']));
}
$GlobalUser['aktplanet'] = GetSelectedPlanet($GlobalUser['player_id']);
$now = time();
UpdateQueue($now);
$aktplanet = GetPlanet($GlobalUser['aktplanet']);
$aktplanet = ProdResources($aktplanet, $aktplanet['lastpeek'], $now);
UpdatePlanetActivity($aktplanet['planet_id']);
UpdateLastClick($GlobalUser['player_id']);
$session = $_GET['session'];
function IsChecked($option)
{
    global $GlobalUser;
    if ($GlobalUser[$option]) {
        return "checked=checked";
    } else {
        return "";
    }
}
function IsSelected($option, $value)
{
    global $GlobalUser;
示例#29
0
<?php

// Сообщения (пока вариант без Командира).
loca_add("menu", $GlobalUni['lang']);
if (key_exists('cp', $_GET)) {
    SelectPlanet($GlobalUser['player_id'], intval($_GET['cp']));
}
$GlobalUser['aktplanet'] = GetSelectedPlanet($GlobalUser['player_id']);
$now = time();
UpdateQueue($now);
$aktplanet = GetPlanet($GlobalUser['aktplanet']);
$aktplanet = ProdResources($aktplanet, $aktplanet['lastpeek'], $now);
UpdatePlanetActivity($aktplanet['planet_id']);
UpdateLastClick($GlobalUser['player_id']);
PageHeader("messages");
// *******************************************************************
$MAXMSG = 25;
// Количество сообщений на странице.
$uni = LoadUniverse();
DeleteExpiredMessages($GlobalUser['player_id']);
// Удалить сообщения которые хранятся дольше 24 часов.
// Заголовок таблицы
echo "<!-- CONTENT AREA -->\n";
echo "<div id='content'>\n";
echo "<center>\n";
//echo "GET: "; print_r ($_GET); echo "<br>";
//echo "POST: "; print_r ($_POST); echo "<br>";
if (method() === "POST") {
    //print_r ($_POST);
    $player_id = $GlobalUser['player_id'];
    if ($_POST['deletemessages'] === "deleteall") {
示例#30
0
<?php

// Продление флота на удержании складом альянса
// Запущенная ракета снабжения по очереди заправляет флоты,
// при этом заправка дискретна потреблению флота в час.
// Ракета не может выгрузить во флот топлива меньше, чем он потребляет в указанное количество часов.
$DepotError = "";
loca_add("common");
loca_add("menu", $GlobalUser['lang']);
if (key_exists('cp', $_GET)) {
    SelectPlanet($GlobalUser['player_id'], intval($_GET['cp']));
}
$GlobalUser['aktplanet'] = GetSelectedPlanet($GlobalUser['player_id']);
$now = time();
UpdateQueue($now);
$aktplanet = GetPlanet($GlobalUser['aktplanet']);
$aktplanet = ProdResources($aktplanet, $aktplanet['lastpeek'], $now);
UpdatePlanetActivity($aktplanet['planet_id']);
UpdateLastClick($GlobalUser['player_id']);
$session = $_GET['session'];
PageHeader("allianzdepot");
echo "<!-- CONTENT AREA -->\n";
echo "<div id='content'>\n";
echo "<center>\n";
$fleetmap = array(202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215);
// Запустить ракету со снабжением
$depot_cap = 10000 * pow(2, $aktplanet['b34']);
if ($aktplanet['b34']) {
    $deut_avail = min(floor($aktplanet['d']), $depot_cap);
} else {
    $deut_avail = 0;