function AllyPage_Already($app_id) { global $session; $app = LoadApplication($app_id); $ally = LoadAlly($app['ally_id']); if (method() === "POST") { if (key_exists('bcancel', $_POST)) { RemoveApplication($app['app_id']); } } ?> <table width=519> <form action="index.php?page=allianzen&session=<?php echo $session; ?> " method=POST> <tr><td class=c colspan=2>Ваше заявление</td></tr> <tr><th colspan=2><?php echo va("Вы уже подали заявку в альянс [#1]. Подождите ответа либо отзовите своё заявление.", $ally['tag']); ?> </th></tr> <tr><th colspan=2><input type=submit name="bcancel" value="Отозвать заявление"></th></tr> </table></form><br><br><br><br> <?php }
function Admin_Debug() { global $session; global $db_prefix; global $GlobalUser; if (method() === "POST") { $query = "SELECT * FROM " . $db_prefix . "debug ORDER BY date DESC, error_id DESC LIMIT 50"; $result = dbquery($query); $rows = dbrows($result); while ($rows--) { $msg = dbarray($result); if ($_POST["delmes" . $msg['error_id']] === "on" || $_POST['deletemessages'] === "deleteall") { $query = "DELETE FROM " . $db_prefix . "debug WHERE error_id = " . $msg['error_id']; dbquery($query); } } } $query = "SELECT * FROM " . $db_prefix . "debug ORDER BY date DESC, error_id DESC LIMIT 50"; $result = dbquery($query); ?> <?php echo AdminPanel(); ?> <table class='header'><tr class='header'><td><table width="519"> <form action="index.php?page=admin&session=<?php echo $session; ?> &mode=Debug" method="POST"> <tr><td colspan="4" class="c">Сообщения</td></tr> <tr><th>Действие</th><th>Дата</th><th>От</th><th>Браузер</th></tr> <?php $rows = dbrows($result); while ($rows--) { $msg = dbarray($result); $user = LoadUser($msg['owner_id']); $from = "<a href=\"index.php?page=admin&session={$session}&mode=Users&player_id=" . $msg['owner_id'] . "\">" . $user['oname'] . "</a> [" . $msg['ip'] . "]"; $msg['text'] = str_replace("{PUBLIC_SESSION}", $session, $msg['text']); echo "<tr><th><input type=\"checkbox\" name=\"delmes" . $msg['error_id'] . "\"/></th><th>" . date("m-d H:i:s", $msg['date']) . "</th><th>{$from} </th><th>" . $msg['agent'] . " </th></tr>\n"; echo "<tr><td class=\"b\"> </td><td class=\"b\" colspan=\"3\">" . $msg['text'] . "</td></tr>\n"; } ?> <tr><td class="b"> </td><td class="b" colspan="3"></td></tr> <tr><th colspan="4" style='padding:0px 105px;'></th></tr> <tr><th colspan="4"> <select name="deletemessages"> <option value="deletemarked">Удалить выделенные сообщения</option> <option value="deleteall">Удалить все сообщения</option> </select><input type="submit" value="ok" /></th></tr> <tr><td colspan="4"><center> </center></td></tr> </form> </table> <?php }
function debug() { print "<strong>query string:</strong> {$_SERVER['QUERY_STRING']}\n\n"; print "<strong>module:</strong> " . implode("-", module()) . "\n"; print "<strong>function:</strong> " . func() . "\n"; print "<strong>method:</strong> " . method() . "\n\n"; print "<strong>include:</strong> /module/" . implode("/", module()) . "/main.php\n\n"; print "<strong>run:</strong> " . command() . "\n\n"; }
public function get() { $allow = array('view'); // TODO plan! // here i'm trying to detect which method('GET', 'x') isset, from there, act upon it foreach ($allow as $key) { if (method('GET', $key) instanceof SecureData) { switch ($key) { case 'view': echo '<p>viewing blog entry ' . method('GET', $key)->toInteger() . '</p>'; break; } } } }
function Admin_Reports() { global $session; global $db_prefix; global $GlobalUser; // Обработка POST-запроса. if (method() === "POST") { } ?> <?php echo AdminPanel(); ?> TODO <?php }
public function boot() { //$this->request = singleton('HTTPRequest'); //$this->db = singleton('DB'); try { if (($this->section = method('GET', 'plugin')) === false) { $this->section = new SecureData('home'); } } catch (Exception $e) { $this->section = new SecureData('home'); } //var_dump($this->section); require_once DIR_PLUGIN . DS . $this->section->toXHTML() . DS . $this->section->toXHTML() . '.php'; //echo '<p>' . $this->section->toXHTML() . '</p>'; // what was i doing here? //singleton($this->section->toXHTML())->get(); //singleton($this->section->toXHTML())->post(); }
function Admin_Expedition() { global $session; global $db_prefix; global $GlobalUser; // Обработка POST-запроса. if (method() === "POST") { } ?> <?php echo AdminPanel(); ?> TODO: Планируется переработка параметров экспедиции.<br><br> <?php $exptab = LoadExpeditionSettings(); print_r($exptab); }
function Admin_Bans() { global $session; global $db_prefix; global $GlobalUser; // Обработка POST-запроса. if (method() === "POST" && $GlobalUser['admin'] >= 1) { if ($_GET['action'] === 'search') { // Результаты поиска switch (intval($_POST['searchby'])) { case 0: // Забаненных с РО $query = "SELECT * FROM " . $db_prefix . "users WHERE banned = 1 AND vacation = 1"; break; case 1: // Забаненных без РО $query = "SELECT * FROM " . $db_prefix . "users WHERE banned = 1 AND vacation = 0"; break; case 2: // Блокировка атак $query = "SELECT * FROM " . $db_prefix . "users WHERE noattack = 1"; break; case 3: // Зарегистрированных недавно (дней) $when = time() - intval($_POST['text']) * 24 * 60 * 60; $query = "SELECT * FROM " . $db_prefix . "users WHERE regdate >= {$when}"; break; case 4: // Имя пользователя (примерное) $query = "SELECT * FROM " . $db_prefix . "users WHERE oname LIKE '" . $_POST['text'] . "%' "; break; case 5: // Тег альянса $query = "SELECT ally_id FROM " . $db_prefix . "ally WHERE tag LIKE '%" . $_POST['text'] . "%' "; $query = "SELECT * FROM " . $db_prefix . "users WHERE ally_id = ANY ({$query}) "; break; case 6: // Одинаковый адрес email $query = "SELECT * FROM " . $db_prefix . "users WHERE email = LIKE '%" . $_POST['text'] . "%' OR pemail = LIKE '%" . $_POST['text'] . "%' "; break; case 7: // Одинаковый IP $query = "SELECT * FROM " . $db_prefix . "users AS t1 INNER JOIN ( \r\nSELECT ip_addr,COUNT(*) FROM " . $db_prefix . "users GROUP BY ip_addr HAVING COUNT(*)>1) as t2 \r\nON t1.ip_addr = t2.ip_addr ORDER BY t1.ip_addr ASC, t1.name ASC"; break; default: $query = ''; } $result = dbquery($query); $rows0 = $rows = dbrows($result); echo AdminPanel(); ?> <script> function SetClearCheckbox (status) { var theForm = document.getElementById('banform'); for (i=0,n=theForm.elements.length;i<n;i++) { if (theForm.elements[i].className.indexOf('ids') !=-1) { theForm.elements[i].checked = status; } } } </script> <!-- Результаты поиска --> <table> <form id="banform" action="index.php?page=admin&session=<?php echo $session; ?> &mode=Bans&action=ban" method="POST" > <tr> <td class=c> <input type="checkbox" onclick="SetClearCheckbox(this.checked);"> ID</td> <td class=c>Имя</td> <td class=c>Главная планета</td> <td class=c>Постоянный адрес</td> <td class=c>Временный адрес</td> <td class=c>IP адрес</td> <td class=c>Дата регистрации</td> </td> <?php if ($rows == 0) { echo "<tr><td colspan=7>Ничего не найдено. <a href=\"index.php?page=admin&session={$session}&mode=Bans\">Назад</a></td></tr>"; } while ($rows--) { $user = dbarray($result); $hp = GetPlanet($user['hplanetid']); ?> <tr> <th><input type="checkbox" name="id[<?php echo $user['player_id']; ?> ]" class="ids"/><?php echo $user['player_id']; ?> </th> <th><a><?php echo AdminUserName($user); ?> </a></th> <th><?php echo AdminPlanetCoord($hp); ?> <?php echo AdminPlanetName($hp); ?> </th> <th><a><?php echo $user['pemail']; ?> </a></th> <th><a><?php echo $user['email']; ?> </a></th> <th><?php echo $user['ip_addr']; ?> </th> <th><?php echo date("m-d-Y H:i:s", $user['regdate']); ?> </th> </tr> <?php } // while if ($rows0 > 0) { ?> <tr><td class=c colspan=7>Действия</td></tr> <tr> <td colspan=6> <input type="radio" name="banmode" value="0"> <font color=firebrick><b>Бан без РО</b></font> <input type="radio" name="banmode" value="1" checked > <font color=red><b>Бан с РО</b></font> <input type="radio" name="banmode" value="2"> <font color=yellow><b>Блок атак</b></font> <input type="radio" name="banmode" value="3"> <font color=lime><b>Разбанить</b></font> <input type="radio" name="banmode" value="4"> <font color=lime><b>Разрешить атаки</b></font> </td> <td><input name="days" type="text" size="5"> дней <input name="hours" type="text" size="3"> часов</td> </tr> <tr><th colspan=6> Причина: <textarea cols=40 rows=4 name="reason"><?php echo "[url=mailto:" . $GlobalUser['pemail'] . "]контакт[/url]"; ?> </textarea></th><th><input type="submit" value="Отправить"></th></tr> </form> </table> <?php } die; } if ($_GET['action'] === 'ban') { // Забанить / разбанить $now = time(); $reason = str_replace('\\"', """, bb($_POST['reason'])); $reason = str_replace('\'', "’", $reason); $reason = str_replace('\\`', "‘", $reason); $seconds = intval($_POST['days']) * 24 * 60 * 60 + intval($_POST['hours']) * 60 * 60; foreach ($_POST['id'] as $player_id => $checked) { $user = LoadUser($player_id); switch (intval($_POST['banmode'])) { case 0: // Добавить пользователя на столб позора $entry = array(null, $GlobalUser['oname'], $user['oname'], $GlobalUser['player_id'], $user['player_id'], $now, $now + $seconds, $reason); AddDBRow($entry, "pranger"); BanUser($player_id, $seconds, 0); break; case 1: // Добавить пользователя на столб позора $entry = array(null, $GlobalUser['oname'], $user['oname'], $GlobalUser['player_id'], $user['player_id'], $now, $now + $seconds, $reason); AddDBRow($entry, "pranger"); BanUser($player_id, $seconds, 1); break; case 2: // Добавить пользователя на столб позора $entry = array(null, $GlobalUser['oname'], $user['oname'], $GlobalUser['player_id'], $user['player_id'], $now, $now + $seconds, $reason); AddDBRow($entry, "pranger"); BanUserAttacks($player_id, $seconds); break; case 3: UnbanUser($player_id); break; case 4: UnbanUserAttacks($player_id); break; } } // for } } ?> <!-- Форма поиска --> <?php echo AdminPanel(); ?> <table> <form action="index.php?page=admin&session=<?php echo $session; ?> &mode=Bans&action=search" method="POST" > <tr><td class="c" colspan=2>Найти пользователей</td></tr> <tr> <td> <select name="searchby"> <option value="0">Забаненных с РО</option> <option value="1">Забаненных без РО</option> <option value="2">Блокировка атак</option> <option value="3">Зарегистрированных недавно (дней)</option> <option value="4">Имя пользователя (примерное)</option> <option value="5">Тег альянса</option> <option value="6">Одинаковый адрес email</option> <option value="7">Одинаковый IP</option> </select> </td> <td> <input type="text" name="text" size=20></td> </tr> <tr><td class="c" colspan=2> <input type="submit" value="Отправить" /></td></tr> </form> </table> <?php }
$cd = floor($aktplanet['d'] / $d); } else { $cd = 1000; } $v = min($cm, min($ck, $cd)); if ($value > $v) { $value = $v; } AddShipyard($GlobalUser['player_id'], $aktplanet['planet_id'], intval($gid), intval($value)); $aktplanet = GetPlanet($GlobalUser['aktplanet']); // обновить состояние планеты. } } } // Обработка GET-запросов. if (method() === "GET" && !$GlobalUser['vacation']) { if ($_GET['mode'] === "Forschung") { $result = GetResearchQueue($GlobalUser['player_id']); $resqueue = dbarray($result); if ($resqueue == null) { if (key_exists('bau', $_GET)) { StartResearch($GlobalUser['player_id'], $aktplanet['planet_id'], intval($_GET['bau']), $now); } $aktplanet = GetPlanet($GlobalUser['aktplanet']); // обновить состояние планеты. } else { if (key_exists('unbau', $_GET)) { StopResearch($GlobalUser['player_id']); } $aktplanet = GetPlanet($GlobalUser['aktplanet']); // обновить состояние планеты.
<?php function method($cache) { $prepared = clone $cache; var_dump($prepared->data); $prepared->data = "bad"; return $prepared; } $cache = new stdClass(); $cache->data = "good"; for ($i = 0; $i < 5; ++$i) { method($cache); }
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> <input type="text" name="searchtext" value=""/> <input type="submit" value="Искать" /> </th> </tr> </table> </form> <?php if ($SearchResult !== "") { ?> </th> </tr> </table> Результаты поиска:<br> <?php echo $SearchResult; } } }
function confirm($_POST) { extract($_POST); if (isset($back)) { unset($back); return method($_POST); } require_lib("validate"); $v = new validate(); $v->isOk($all, "num", 1, 1, "Invalid allocation."); for ($t = 0; $t < $rec_amount; $t++) { if (!isset($descript[$t]) or !isset($reference[$t]) or !isset($setamt[$t]) or empty($descript[$t]) or empty($reference[$t]) or empty($setamt[$t])) { continue; } if (!isset($out[$t]) or strlen($out[$t]) < 1) { $out[$t] = $amt[$t]; } if (!isset($out1[$t])) { $out1[$t] = ''; } if (!isset($out2[$t])) { $out2[$t] = ''; } if (!isset($out3[$t])) { $out3[$t] = ''; } if (!isset($out4[$t])) { $out4[$t] = ''; } if (!isset($out5[$t])) { $out5[$t] = ''; } $v->isOk($bankid[$t], "num", 1, 30, "Invalid Bank Account."); $v->isOk($date[$t], "date", 1, 14, "Invalid Date."); $v->isOk($descript[$t], "string", 0, 255, "Invalid Description."); $v->isOk($reference[$t], "string", 0, 50, "Invalid Reference Name/Number."); $v->isOk($cheqnum[$t], "num", 0, 30, "Invalid Cheque number."); $v->isOk($amt[$t], "float", 1, 40, "Invalid amount."); $v->isOk($setamt[$t], "float", 1, 40, "Invalid settlement amount."); $v->isOk($setvat[$t], "string", 1, 10, "Invalid Settlement VAT Option."); $v->isOk($setvatcode[$t], "string", 1, 40, "Invalid Settlement VAT code"); $v->isOk($out[$t], "float", 1, 40, "Invalid out amount."); $v->isOk($out1[$t], "float", 0, 40, "Invalid paid amount(currant)."); $v->isOk($out2[$t], "float", 0, 40, "Invalid paid amount(30)."); $v->isOk($out3[$t], "float", 0, 40, "Invalid paid amount(60)."); $v->isOk($out4[$t], "float", 0, 40, "Invalid paid amount(90)."); $v->isOk($out5[$t], "float", 0, 40, "Invalid paid amount(120)."); $v->isOk($cusid[$t], "num", 1, 10, "Invalid customer number."); if (isset($invids[$t])) { foreach ($invids[$t] as $key => $value) { if ($paidamt[$t][$key] < 0.01) { continue; } $v->isOk($invids[$t][$key], "num", 1, 50, "Invalid Invoice No. [{$key}]"); $v->isOk($paidamt[$t][$key], "float", 1, 40, "Invalid amount to be paid. [{$key}]"); } } } if ($v->isError()) { $confirm = ""; $errors = $v->getErrors(); foreach ($errors as $e) { $confirm .= "<li class='err'>" . $e["msg"] . "</li>"; } for ($t = 0; $t < $rec_amount; $t++) { //$temp1 = $out1[$t]; $_POST["out1[{$t}]"] = $out1[$t] + 0; $_POST["out2[{$t}]"] = $out2[$t] + 0; $_POST["out3[{$t}]"] = $out3[$t] + 0; $_POST["out4[{$t}]"] = $out4[$t] + 0; $_POST["out5[{$t}]"] = $out5[$t] + 0; } return $confirm . alloc($_POST); } $passon = ""; for ($t = 0; $t < $rec_amount; $t++) { if (!isset($descript[$t]) or !isset($reference[$t]) or !isset($setamt[$t]) or empty($descript[$t]) or empty($reference[$t]) or empty($setamt[$t])) { continue; } $tot[$t] = 0; if (isset($invids[$t])) { foreach ($invids[$t] as $key => $value) { if ($paidamt[$t][$key] < 0.01) { continue; } $tot[$t] += $paidamt[$t][$key]; } } if (isset($open_amount[$t])) { $tot[$t] += array_sum($open_amount[$t]); } $passon .= "\n\t\t\t<input type='hidden' name='bankid[{$t}]' value='{$bankid[$t]}'>\n\t\t\t<input type='hidden' name='date[{$t}]' value='{$date[$t]}'>\n\t\t\t<input type='hidden' name='cusid[{$t}]' value='{$cusid[$t]}'>\n\t\t\t<input type='hidden' name='descript[{$t}]' value='{$descript[$t]}'>\n\t\t\t<input type='hidden' name='reference[{$t}]' value='{$reference[$t]}'>\n\t\t\t<input type='hidden' name='cheqnum[{$t}]' value='{$cheqnum[$t]}'>\n\t\t\t<input type='hidden' name='out[{$t}]' value='{$out[$t]}'>\n\t\t\t<input type='hidden' name='date_day[{$t}]' value='{$date_day[$t]}'>\n\t\t\t<input type='hidden' name='date_month[{$t}]' value='{$date_month[$t]}'>\n\t\t\t<input type='hidden' name='date_year[{$t}]' value='{$date_year[$t]}'>\n\t\t\t<input type='hidden' name='out1[{$t}]' value='{$out1[$t]}'>\n\t\t\t<input type='hidden' name='out2[{$t}]' value='{$out2[$t]}'>\n\t\t\t<input type='hidden' name='out3[{$t}]' value='{$out3[$t]}'>\n\t\t\t<input type='hidden' name='out4[{$t}]' value='{$out4[$t]}'>\n\t\t\t<input type='hidden' name='out5[{$t}]' value='{$out5[$t]}'>\n\t\t\t<input type='hidden' name='amt[{$t}]' value='{$amt[$t]}'>\n\t\t\t<input type='hidden' name='setamt[{$t}]' value='{$setamt[$t]}'>\n\t\t\t<input type='hidden' name='setvat[{$t}]' value='{$setvat[$t]}'>\n\t\t\t<input type='hidden' name='setvatcode[{$t}]' value='{$setvatcode[$t]}'>"; } $confirm = "\n\t\t<h3>New Bank Receipt</h3>\n\t\t<h4>Confirm entry (Please check the details)</h4>\n\t\t<form action='" . SELF . "' method='POST'>\n\t\t\t<input type='hidden' name='key' value='write'>\n\t\t\t<input type='hidden' name='all' value='{$all}'>\n\t\t\t<input type='hidden' name='rec_amount' value='{$rec_amount}'>\n\t\t\t{$passon}\n\t\t<table " . TMPL_tblDflts . ">"; $passon2 = ""; for ($t = 0; $t < $rec_amount; $t++) { $out[$t] += 0; $OUT1[$t] = $out1[$t] + 0; $OUT2[$t] = $out2[$t] + 0; $OUT3[$t] = $out3[$t] + 0; $OUT4[$t] = $out4[$t] + 0; $OUT5[$t] = $out5[$t] + 0; $tot[$t] = sprint($tot[$t]); $amt[$t] = sprint($amt[$t]); $out[$t] = sprint($out[$t]); if (sprint($tot[$t] + $out[$t] + $out1[$t] + $out2[$t] + $out3[$t] + $out4[$t] + $out5[$t] - $amt[$t]) != sprint(0)) { $_POST["out1[{$t}]"] = $out1; $_POST["out2[{$t}]"] = $out2; $_POST["out3[{$t}]"] = $out3; $_POST["out4[{$t}]"] = $out4; $_POST["out5[{$t}]"] = $out5; // return "<li class='err'>The total amount for invoices not equal to the amount received. // Please check the details.</li>".alloc($_POST); } if (isset($bout[$t])) { $out[$t] = $bout[$t]; } /* bank account name */ if (($bank = qryBankAcct($bankid[$t], "accname, bankname")) === false) { $bank['accname'] = "Cash"; $bank['bankname'] = ""; } /* customer name */ $cus[$t] = qryCustomer($cusid[$t], "cusname, surname"); $cus1 = $cus[$t]['cusname']; $cus2 = $cus[$t]['surname']; $setamt[$t] = sprint($setamt[$t]); if ($setvat[$t] == "inc") { $showsetvat = "VAT Inclusive"; } else { $showsetvat = "No VAT"; } $confirm .= "\n\t\t\t<tr>\n\t\t\t\t<th>Field</th>\n\t\t\t\t<th>Value</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Account</td>\n\t\t\t\t<td>{$bank['accname']} - {$bank['bankname']}</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Date</td>\n\t\t\t\t<td valign='center'>{$date[$t]}</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Received from</td>\n\t\t\t\t<td valign='center'>{$cus1} {$cus2}</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Description</td>\n\t\t\t\t<td valign='center'>{$descript[$t]}</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Reference</td>\n\t\t\t\t<td valign='center'>{$reference[$t]}</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Cheque Number</td>\n\t\t\t\t<td valign='center'>{$cheqnum[$t]}</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Amount</td>\n\t\t\t\t<td valign='center'>" . CUR . " {$amt[$t]}</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Settlement Amount</td>\n\t\t\t\t<td valign='center'>" . CUR . " {$setamt[$t]} {$showsetvat}</td>\n\t\t\t</tr>"; /* OPTION 1 : AUTO ALLOCATE (confirm) */ if ($all == 0) { // Layout $confirm .= "\n\t\t\t" . TBL_BR . "\n\t\t\t<tr>\n\t\t\t\t<td colspan='2'><h3>Invoices</h3></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<th>Invoice Number</th>\n\t\t\t\t<th>Outstanding amount</th>\n\t\t\t\t<th>Terms</th>\n\t\t\t\t<th>Date</th>\n\t\t\t\t<th>Amount</th>\n\t\t\t</tr>"; $i = 0; if (isset($invids[$t])) { foreach ($invids[$t] as $key => $value) { if ($paidamt[$t][$invids[$t][$key]] < 0.01) { continue; } db_connect(); $ii = $invids[$t][$key]; if (!isset($itype[$t][$ii]) && !isset($ptype[$t][$ii])) { # Get all the details $sql = "SELECT invnum,invid,balance,terms,odate FROM invoices\n\t\t\t\t\t\t\t\tWHERE invid = '{$ii}' AND div = '" . USER_DIV . "'"; $invRslt = db_exec($sql) or errDie("Unable to access database."); if (pg_numrows($invRslt) < 1) { return "<li class='err'> - Invalid ord number {$invids[$key]}.</li>"; } $inv = pg_fetch_array($invRslt); $invid = $inv['invid']; $pp = $paidamt[$t][$invid]; $confirm .= "\n\t\t\t\t\t\t\t<input type='hidden' name='paidamt[{$t}][{$invid}]' size='7' value='{$pp}'>\n\t\t\t\t\t\t\t<input type='hidden' size='20' name='invids[{$t}][{$invid}]' value='{$inv['invid']}'>\n\t\t\t\t\t\t<tr bgcolor='" . bgcolor($i) . "'>\n\t\t\t\t\t\t\t<td>{$inv['invnum']}</td>\n\t\t\t\t\t\t\t<td>" . CUR . " {$inv['balance']}</td>\n\t\t\t\t\t\t\t<td>{$inv['terms']} days</td>\n\t\t\t\t\t\t\t<td>{$inv['odate']}</td>\n\t\t\t\t\t\t\t<td>" . CUR . " {$pp}</td>\n\t\t\t\t\t\t</tr>"; } else { if (!isset($ptype[$t][$ii])) { $sql = "SELECT invnum,invid,balance,sdate as odate FROM nons_invoices\n\t\t\t\t\t\t\t\tWHERE invid = '{$ii}' AND div = '" . USER_DIV . "'"; $invRslt = db_exec($sql) or errDie("Unable to access database."); if (pg_numrows($invRslt) < 1) { return "<li class='err'> - Invalid ord number {$ii}.</li>"; } $inv = pg_fetch_array($invRslt); $invid = $inv['invid']; $pp = $paidamt[$t][$invid]; $confirm .= "\n\t\t\t\t\t\t<input type='hidden' size='20' name='invids[{$t}][{$invid}]' value='{$inv['invid']}'>\n\t\t\t\t\t\t<input type='hidden' name='paidamt[{$t}][{$invid}]' size='7' value='{$pp}'>\n\t\t\t\t\t\t<input type='hidden' name='itype[{$t}][{$invid}]' value='y'>\n\t\t\t\t\t\t<tr bgcolor='" . bgcolor($i) . "'>\n\t\t\t\t\t\t\t<td>{$inv['invnum']}</td>\n\t\t\t\t\t\t\t<td>" . CUR . " {$inv['balance']}</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td>{$inv['odate']}</td>\n\t\t\t\t\t\t\t<td>" . CUR . " {$pp}</td>\n\t\t\t\t\t\t</tr>"; } else { $sqls = array(); for ($i = 1; $i <= 12; ++$i) { $sqls[] = "SELECT invnum,invid,balance,odate FROM \"{$i}\".pinvoices \n\t\t\t\t\t\t\t\t\tWHERE invid='{$ii}' AND div = '" . USER_DIV . "'"; } $sql = implode(" UNION ", $sqls); $prnInvRslt = db_exec($sql); $inv = pg_fetch_array($prnInvRslt); $invid = $inv['invid']; $pp = $paidamt[$t][$invid]; $confirm .= "\n\t\t\t\t\t\t<input type='hidden' size='20' name='invids[{$t}][{$invid}]' value='{$inv['invid']}'>\n\t\t\t\t\t\t<input type='hidden' name='paidamt[{$t}][{$invid}]' size='7' value='{$pp}'>\n\t\t\t\t\t\t<input type='hidden' name='ptype[{$t}][{$invid}]' value='y'>\n\t\t\t\t\t\t<tr bgcolor='" . bgcolor($i) . "'>\n\t\t\t\t\t\t\t<td>{$inv['invnum']}</td>\n\t\t\t\t\t\t\t<td>" . CUR . " {$inv['balance']}</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td>{$inv['odate']}</td>\n\t\t\t\t\t\t\t<td>" . CUR . " {$pp}</td>\n\t\t\t\t\t\t</tr>"; } } } } if ($out[$t] > 0) { /* START OPEN ITEMS */ $ox = ""; db_conn('cubit'); $sql = "SELECT * FROM open_stmnt WHERE balance>0 AND cusnum='{$cusid[$t]}' ORDER BY date"; $rslt = db_exec($sql) or errDie("Unable to get open items."); $open_out[$t] = $out[$t]; $i = 0; while ($od = pg_fetch_array($rslt)) { if ($open_out[$t] == 0) { continue; } $oid = $od['id']; $bgColor = bgcolor($i); if ($open_out[$t] >= $od['balance']) { $open_amount[$t][$oid] = $od['balance']; $open_out[$t] = sprint($open_out[$t] - $od['balance']); $ox .= "\n\t\t\t\t\t\t\t<input type='hidden' size='20' name='open[{$t}][{$oid}]' value='{$oid}'>\n\t\t\t\t\t\t\t<input type='hidden' name='open_amount[{$t}][{$oid}]' value='{$open_amount[$t]}[{$oid}]'>\n\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t<td>{$od['type']}</td>\n\t\t\t\t\t\t\t\t<td>" . CUR . " {$od['balance']}</td>\n\t\t\t\t\t\t\t\t<td>{$od['date']}</td>\n\t\t\t\t\t\t\t\t<td>" . CUR . " {$open_amount[$t]}[{$oid}]</td>\n\t\t\t\t\t\t\t</tr>"; } else { if ($open_out[$t] < $od['balance']) { $open_amount[$t][$oid] = $open_out[$t]; $open_out[$t] = 0; $ox .= "\n\t\t\t\t\t\t\t<input type='hidden' size='20' name='open[{$t}][{$oid}]' value='{$od['id']}'>\n\t\t\t\t\t\t\t<input type='hidden' name='open_amount[{$t}][{$oid}]' value='{$open_amount[$t]}[{$oid}]'>\n\t\t\t\t\t\t\t<tr bgcolor='" . bgcolor($i) . "'>\n\t\t\t\t\t\t\t\t<td>{$od['type']}</td>\n\t\t\t\t\t\t\t\t<td>" . CUR . " {$od['balance']}</td>\n\t\t\t\t\t\t\t\t<td>{$od['date']}</td>\n\t\t\t\t\t\t\t\t<td>" . CUR . " {$open_amount[$t]}[{$oid}]</td>\n\t\t\t\t\t\t\t</tr>"; } } } if (open()) { $confirm .= "\n\t\t\t\t\t" . TBL_BR . "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td colspan='2'><h3>Outstanding Transactions</h3></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th>Description</th>\n\t\t\t\t\t\t<th>Outstanding Amount</th>\n\t\t\t\t\t\t<th>Date</th>\n\t\t\t\t\t\t<th>Amount</th>\n\t\t\t\t\t</tr>"; $confirm .= $ox; $bout[$t] = $out[$t]; $out[$t] = $open_out[$t]; $out[$t] = sprint($out[$t]); if ($out[$t] > 0) { $confirm .= "\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td colspan='4'><b>A general transaction will credit the\n\t\t\t\t\t\t\t\tclient's account with " . CUR . " {$out[$t]} </b></td>\n\t\t\t\t\t\t</tr>"; } $out[$t] = $bout[$t]; } else { $out[$t] = sprint($out[$t]); $confirm .= "\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td colspan='5'><b>A general transaction will credit the\n\t\t\t\t\t\t\tclient's account with " . CUR . " {$out[$t]} </b></td>\n\t\t\t\t\t</tr>"; } } $confirm .= TBL_BR; } $confirm .= TBL_BR . TBL_BR; // $passon2 .= " // <input type='hidden' name='out1[$t]' value='$out1[$t]'> // <input type='hidden' name='out2[$t]' value='$out2[$t]'> // <input type='hidden' name='out3[$t]' value='$out3[$t]'> // <input type='hidden' name='out4[$t]' value='$out4[$t]'> // <input type='hidden' name='out5[$t]' value='$out5[$t]'> // "; } /* <tr> <td colspan='5' align='right'><input type='submit' name='batch' value='Add To Batch'></td> </tr> */ $confirm .= "\n\t\t\t{$passon2}\n\t\t\t<tr><td><br></td></tr>\n\t\t\t<tr>\n\t\t\t\t<td><input type='submit' name='back' value='« Correction'></td>\n\t\t\t\t<td align='right' colspan='4'><input type='submit' value='Write »'></td>\n\t\t\t</tr>\n\t\t</table>\n\t\t</form>" . mkQuickLinks(ql("trans-new.php", "Journal Transactions"), ql("../customers-view.php", "View Customers")); return $confirm; }
$query .= " WHERE id = {$id}"; dbquery($query); } } else { // Добавить // Ограничить количество. $query = "SELECT * FROM " . $db_prefix . "template WHERE owner_id = " . $GlobalUser['player_id']; $result = dbquery($query); $rows = dbrows($result); if ($rows < $MAX) { $temp = array(null, $GlobalUser['player_id'], $name, $now, intval($_POST['ship'][202]), intval($_POST['ship'][203]), intval($_POST['ship'][204]), intval($_POST['ship'][205]), intval($_POST['ship'][206]), intval($_POST['ship'][207]), intval($_POST['ship'][208]), intval($_POST['ship'][209]), intval($_POST['ship'][210]), intval($_POST['ship'][211]), 0, intval($_POST['ship'][213]), intval($_POST['ship'][214]), intval($_POST['ship'][215])); AddDBRow($temp, 'template'); } } } if (method() === "GET" && $_GET['mode'] === "delete") { // Удалить $id = intval($_GET['id']); $query = "SELECT * FROM " . $db_prefix . "template WHERE id = {$id} AND owner_id = " . $GlobalUser['player_id'] . " LIMIT 1"; $result = dbquery($query); if (dbrows($result) > 0) { $query = "DELETE FROM " . $db_prefix . "template WHERE id = {$id}"; dbquery($query); } } ?> <!-- CONTENT AREA --> <div id='content'> <center> <script type="text/javascript">
function Admin_Bots() { global $session; global $db_prefix; global $GlobalUser; $result = ""; // Обработка POST-запроса. if (method() === "POST") { if (AddBot($_POST['name'])) { $result = "<font color=lime>Бот успешно добавлен.</font>"; } else { $result = "<font color=red>Игрок с таким именем уже существует.</font>"; } } // Обработка GET-запроса. if (method() === "GET") { StopBot(intval($_GET['id'])); $result = "<font color=lime>Бот остановлен.</font>"; } ?> <?php echo AdminPanel(); ?> <center><?php echo $result; ?> </center> <h2>Список ботов:</h2> <?php $query = "SELECT * FROM " . $db_prefix . "queue WHERE type = 'AI' GROUP BY owner_id"; $result = dbquery($query); $rowss = $rows = dbrows($result); if ($rows == 0) { echo "Ботов не обнаружено<br>"; } else { echo "<table>\n"; echo "<tr><td class=c>ID</td><td class=c>Имя</td><td class=c>Главная планета</td><td class=c>Действие</td></tr>\n"; } while ($rows--) { $queue = dbarray($result); $user = LoadUser($queue['owner_id']); $planet = GetPlanet($user['hplanetid']); echo "<tr>"; echo "<td>" . $user['player_id'] . "</td>"; echo "<td>" . AdminUserName($user) . "</td>"; echo "<td>" . AdminPlanetName($planet) . " " . AdminPlanetCoord($planet) . "</td>"; echo "<td><a href=\"index.php?page=admin&session={$session}&mode=Bots&action=stop&id=" . $user['player_id'] . "\">Остановить</a></td>"; echo "</tr>\n"; } if ($rowss) { echo "</table>"; } ?> <h2>Добавить бота:</h2> <form action="index.php?page=admin&session=<?php echo $session; ?> &mode=Bots" method="POST"> <table> <tr><td>Имя <input type=text size=10 name="name" /> <input type=submit value="Отправить" /></td></tr> </table> </form> <?php }
function command() { return func() . "_" . method(); }
function Admin_Broadcast() { global $session; global $db_prefix; global $GlobalUser; $write_error = ""; // Обработка POST-запроса. if (method() === "POST") { $cat = $_POST['cat']; $subj = $_POST['subj']; if ($subj === "") { $write_error = "<center><font color=#FF0000>Заполните тему</font><br/></center>\n"; } $text = $_POST['text']; if ($text === "") { $write_error = "<center><font color=#FF0000>Введите текст сообщения</font><br/></center>\n"; } if ($write_error === "") { if ($cat == 1) { $query = "SELECT * FROM " . $db_prefix . "users WHERE score1 < 5000;"; } else { if ($cat == 2) { $query = "SELECT * FROM " . $db_prefix . "users WHERE place1 < 100;"; } else { if ($cat == 3) { $query = "SELECT * FROM " . $db_prefix . "users WHERE admin = 1;"; } else { $query = "SELECT * FROM " . $db_prefix . "users;"; } } } // Всем $ownhome = GetPlanet($GlobalUser['hplanetid']); $from = $GlobalUser['oname'] . " <a href=\"index.php?page=galaxy&galaxy=" . $ownhome['g'] . "&system=" . $ownhome['s'] . "&position=" . $ownhome['p'] . "&session={PUBLIC_SESSION}\">[" . $ownhome['g'] . ":" . $ownhome['s'] . ":" . $ownhome['p'] . "]</a>\n"; $subj = $subj . " <a href=\"index.php?page=writemessages&session={PUBLIC_SESSION}&messageziel=" . $GlobalUser['player_id'] . "&re=1&betreff=Re:" . $subj . "\">\n" . "</a>\n"; $text = str_replace('\\"', """, bb($text)); $text = str_replace('\'', "’", $text); $text = str_replace('\\`', "‘", $text); $result = dbquery($query); $usernum = $rows = dbrows($result); while ($rows--) { $user = dbarray($result); SendMessage($user['player_id'], $from, $subj, $text, 5); } if ($usernum > 0) { $write_error = "<center><font color=#00FF00>Сообщение отправлено {$usernum} пользователям.</font><br/></center>\n"; } else { $write_error = "<center><font color=#00FF00>Адресаты не найдены.</font><br/></center>\n"; } } } ?> <?php echo AdminPanel(); ?> <?php echo $write_error; ?> <table> <form action="index.php?page=admin&session=<?php echo $session; ?> &mode=Broadcast" method="POST"> <tr><td> Кому: <select name="cat"> <option value="0">Всем</option> <option value="1">Новичкам (менее 5.000 очков)</option> <option value="2">Игрокам из топ100</option> <option value="3">Операторам</option> </select> </td></tr> <tr><td> Тема : <input name="subj" size=80> </td></tr> <tr><td> <textarea cols='100' rows='20' name='text'></textarea> </td></tr> <tr><td> <center><input type="submit" value="Отправить"></center> </td></tr> </form> </table> <?php }
function Admin_Uni() { global $db_prefix; global $GlobalUser; global $session; $now = time(); if (method() === "POST" && $GlobalUser['admin'] >= 2) { if (key_exists('news_upd', $_POST)) { if ($_POST['news_upd'] > 0) { UpdateNews($_POST['news1'], $_POST['news2'], $_POST['news_upd']); } } if ($_POST['news_off'] === "on") { DisableNews(); } $rapid = $_POST['rapid'] === "on" ? 1 : 0; $moons = $_POST['moons'] === "on" ? 1 : 0; $freeze = $_POST['freeze'] === "on" ? 1 : 0; SetUniParam($_POST['speed'], $_POST['fspeed'], $_POST['acs'], $_POST['fid'], $_POST['did'], $_POST['defrepair'], $_POST['defrepair_delta'], $_POST['galaxies'], $_POST['systems'], $rapid, $moons, $freeze); // Включить принудительное РО активным игрокам, если вселенная ставится на паузу. if ($freeze) { $days7 = $now - 7 * 24 * 60 * 60; $query = "UPDATE " . $db_prefix . "users SET vacation = 1, vacation_until = " . $now . " WHERE lastclick >= {$days7}"; dbquery($query); } //print_r ( $_POST ); } $unitab = LoadUniverse(); ?> <?php echo AdminPanel(); ?> <table > <form action="index.php?page=admin&session=<?php echo $session; ?> &mode=Uni" method="POST" > <tr><td class=c colspan=2>Настройки Вселенной <?php echo $unitab['num']; ?> </td></tr> <tr><th>Дата открытия</th><th><?php echo date("Y-m-d H:i:s", $unitab['startdate']); ?> </th></tr> <tr><th>Количество игроков</th><th><?php echo $unitab['usercount']; ?> </th></tr> <tr><th>Максимальное количество игроков</th><th><input type="text" name="maxusers" maxlength="10" size="10" value="<?php echo $unitab['maxusers']; ?> " /></th></tr> <tr><th>Количество галактик</th><th><input type="text" name="galaxies" maxlength="3" size="3" value="<?php echo $unitab['galaxies']; ?> " /></th></tr> <tr><th>Количество систем в галактике</th><th><input type="text" name="systems" maxlength="3" size="3" value="<?php echo $unitab['systems']; ?> " /></th></tr> <tr> <th>Ускорение игры</th> <th> <select name="speed"> <option value="1" <?php echo UniIsSelected($unitab['speed'], 1); ?> >1x</option> <option value="2" <?php echo UniIsSelected($unitab['speed'], 2); ?> >2x</option> <option value="3" <?php echo UniIsSelected($unitab['speed'], 3); ?> >3x</option> <option value="4" <?php echo UniIsSelected($unitab['speed'], 4); ?> >4x</option> <option value="5" <?php echo UniIsSelected($unitab['speed'], 5); ?> >5x</option> <option value="6" <?php echo UniIsSelected($unitab['speed'], 6); ?> >6x</option> <option value="7" <?php echo UniIsSelected($unitab['speed'], 7); ?> >7x</option> <option value="8" <?php echo UniIsSelected($unitab['speed'], 8); ?> >8x</option> <option value="9" <?php echo UniIsSelected($unitab['speed'], 9); ?> >9x</option> <option value="10" <?php echo UniIsSelected($unitab['speed'], 10); ?> >10x</option> </select> </th> </tr> <tr> <th>Ускорение флота</th> <th> <select name="fspeed"> <option value="1" <?php echo UniIsSelected($unitab['fspeed'], 1); ?> >1x</option> <option value="2" <?php echo UniIsSelected($unitab['fspeed'], 2); ?> >2x</option> <option value="3" <?php echo UniIsSelected($unitab['fspeed'], 3); ?> >3x</option> <option value="4" <?php echo UniIsSelected($unitab['fspeed'], 4); ?> >4x</option> <option value="5" <?php echo UniIsSelected($unitab['fspeed'], 5); ?> >5x</option> <option value="6" <?php echo UniIsSelected($unitab['fspeed'], 6); ?> >6x</option> <option value="7" <?php echo UniIsSelected($unitab['fspeed'], 7); ?> >7x</option> <option value="8" <?php echo UniIsSelected($unitab['fspeed'], 8); ?> >8x</option> <option value="9" <?php echo UniIsSelected($unitab['fspeed'], 9); ?> >9x</option> <option value="10" <?php echo UniIsSelected($unitab['fspeed'], 10); ?> >10x</option> </select> </th> </tr> <tr> <th>Флот в обломки</th> <th> <select name="fid"> <option value="0" <?php echo UniIsSelected($unitab['fid'], 0); ?> >0%</option> <option value="10" <?php echo UniIsSelected($unitab['fid'], 10); ?> >10%</option> <option value="20" <?php echo UniIsSelected($unitab['fid'], 20); ?> >20%</option> <option value="30" <?php echo UniIsSelected($unitab['fid'], 30); ?> >30%</option> <option value="40" <?php echo UniIsSelected($unitab['fid'], 40); ?> >40%</option> <option value="50" <?php echo UniIsSelected($unitab['fid'], 50); ?> >50%</option> <option value="60" <?php echo UniIsSelected($unitab['fid'], 60); ?> >60%</option> <option value="70" <?php echo UniIsSelected($unitab['fid'], 70); ?> >70%</option> <option value="80" <?php echo UniIsSelected($unitab['fid'], 80); ?> >80%</option> <option value="90" <?php echo UniIsSelected($unitab['fid'], 90); ?> >90%</option> <option value="100" <?php echo UniIsSelected($unitab['fid'], 100); ?> >100%</option> </select> </th> </tr> <tr> <th>Оборона в обломки</th> <th> <select name="did"> <option value="0" <?php echo UniIsSelected($unitab['did'], 0); ?> >0%</option> <option value="10" <?php echo UniIsSelected($unitab['did'], 10); ?> >10%</option> <option value="20" <?php echo UniIsSelected($unitab['did'], 20); ?> >20%</option> <option value="30" <?php echo UniIsSelected($unitab['did'], 30); ?> >30%</option> <option value="40" <?php echo UniIsSelected($unitab['did'], 40); ?> >40%</option> <option value="50" <?php echo UniIsSelected($unitab['did'], 50); ?> >50%</option> <option value="60" <?php echo UniIsSelected($unitab['did'], 60); ?> >60%</option> <option value="70" <?php echo UniIsSelected($unitab['did'], 70); ?> >70%</option> <option value="80" <?php echo UniIsSelected($unitab['did'], 80); ?> >80%</option> <option value="90" <?php echo UniIsSelected($unitab['did'], 90); ?> >90%</option> <option value="100" <?php echo UniIsSelected($unitab['did'], 100); ?> >100%</option> </select> </th> </tr> <tr><th>Восстановление обороны</th><th> <input type="text" name="defrepair" maxlength="3" size="3" value="<?php echo $unitab['defrepair']; ?> " /> +/- <input type="text" name="defrepair_delta" maxlength="3" size="3" value="<?php echo $unitab['defrepair_delta']; ?> " /> % </th></tr> <tr><th>Приглашенных игроков в САБ</th><th><input type="text" name="acs" maxlength="3" size="3" value="<?php echo $unitab['acs']; ?> " /> (макс. <?php echo $unitab['acs'] * $unitab['acs']; ?> флотов)</th></tr> <tr><th>Скорострел</th><th><input type="checkbox" name="rapid" <?php echo UniIsChecked($unitab['rapid']); ?> /></th></tr> <tr><th>Луны и Звёзды Смерти</th><th><input type="checkbox" name="moons" <?php echo UniIsChecked($unitab['moons']); ?> /></th></tr> <tr><th>Новость 1</th><th><input type="text" name="news1" maxlength="99" size="20" value="<?php echo $unitab['news1']; ?> " /></th></tr> <tr><th>Новость 2</th><th><input type="text" name="news2" maxlength="99" size="20" value="<?php echo $unitab['news2']; ?> " /></th></tr> <?php if ($now > $unitab['news_until']) { echo "<tr><th>Продлить новость</th><th><input type=\"text\" name=\"news_upd\" maxlength=\"3\" size=\"3\" value=\"0\" /> дн.</th></tr>\n"; } else { echo "<tr><th>Показывать новость до</th><th>" . date("Y-m-d H:i:s", $unitab['news_until']) . " <input type=\"checkbox\" name=\"news_off\" /> убрать</th></tr>\n"; } ?> <tr><th>Поставить вселенную на паузу</th><th><input type="checkbox" name="freeze" <?php echo UniIsChecked($unitab['freeze']); ?> /></th></tr> <tr><th colspan=2><input type="submit" value="Сохранить" /></th></tr> </form> </table> <?php }
# Get settings require "../settings.php"; require "../core-settings.php"; require "../libs/ext.lib.php"; if (isset($_POST["key"])) { switch ($_POST["key"]) { case "method": if (strlen($_POST["accnum"]) == 0) { # redirect if not local supplier if (!is_local("customers", "cusnum", $_POST["cusid"])) { // print "SpaceBar"; header("Location: bank-recpt-inv-int.php?cusid={$_POST['cusid']}"); exit; } } $OUTPUT = method($_POST["cusid"]); break; case "alloc": $OUTPUT = alloc($_POST); break; case "confirm": $OUTPUT = confirm($_POST); break; case "write": $OUTPUT = write($_POST); break; default: $OUTPUT = sel_cus($_POST); } } elseif (isset($_GET["cusid"])) { # Display default output
function confirm($_POST) { extract($_POST); if (isset($back)) { return method($cusid); } // $date = "$date_day-$date_month-$date_year"; $amt = sprint(array_sum($paidamt)); $setamt = sprint(array_sum($stock_setamt)); if (!isset($print_recpt)) { $print_recpt = ""; } if (!isset($descript) or strlen($descript) < 1) { $descript = $reference; } if (!isset($out1)) { $out1 = ''; } if (!isset($out2)) { $out2 = ''; } if (!isset($out3)) { $out3 = ''; } if (!isset($out4)) { $out4 = ''; } if (!isset($out5)) { $out5 = ''; } $date = "{$date_year}-{$date_month}-{$date_day}"; require_lib("validate"); $v = new validate(); $v->isOk($all, "num", 1, 1, "Invalid allocation."); $v->isOk($bankid, "num", 1, 30, "Invalid Bank Account."); $v->isOk($date, "date", 1, 14, "Invalid Date."); $v->isOk($descript, "string", 1, 255, "Invalid Description."); $v->isOk($reference, "string", 1, 50, "Invalid Reference Name/Number."); $v->isOk($cheqnum, "num", 0, 30, "Invalid Cheque number."); $v->isOk($amt, "float", 1, 40, "Invalid amount."); $v->isOk($setamt, "float", 1, 40, "Invalid Settlement Amount."); $v->isOk($setvat, "string", 1, 10, "Invalid Settlement VAT Option."); $v->isOk($setvatcode, "string", 1, 40, "Invalid Settlement VAT code"); // $v->isOk($out, "float", 1, 40, "Invalid out amount."); $v->isOk($out1, "float", 0, 40, "Invalid paid amount(currant)."); $v->isOk($out2, "float", 0, 40, "Invalid paid amount(30)."); $v->isOk($out3, "float", 0, 40, "Invalid paid amount(60)."); $v->isOk($out4, "float", 0, 40, "Invalid paid amount(90)."); $v->isOk($out5, "float", 0, 40, "Invalid paid amount(120)."); $v->isOk($cusid, "num", 1, 10, "Invalid customer number."); $v->isOk($overpay, "float", 1, 40, "Invalid Unallocated Amount."); $v->isOk($print_recpt, "string", 0, 10, "Invalid Print Receipt Setting."); if ($amt + $overpay <= 0) { $v->addError(0, "Invalid Amount Allocated To Receipt."); } if (isset($invids)) { foreach ($invids as $key => $value) { if ($paidamt[$key] < 0.01) { continue; } if (!isset($stock_setamt[$key]) or strlen($stock_setamt[$key]) < 1) { $stock_setamt[$key] = 0; } $v->isOk($invids[$key], "num", 1, 50, "Invalid Invoice No. [{$key}]"); $v->isOk($paidamt[$key], "float", 1, 40, "Invalid amount to be paid. [{$key}]"); $v->isOk($stock_setamt[$key], "float", 1, 40, "Invalid Settlement Discount Amount"); } } if ($v->isError()) { $confirm = ""; $errors = $v->getErrors(); foreach ($errors as $e) { $confirm .= "<li class='err'>" . $e["msg"] . "</li>"; } $_POST['OUT1'] = $out1 + 0; $_POST['OUT2'] = $out2 + 0; $_POST['OUT3'] = $out3 + 0; $_POST['OUT4'] = $out4 + 0; $_POST['OUT5'] = $out5 + 0; return $confirm . alloc($_POST); } $blocked_date_from = getCSetting("BLOCKED_FROM"); $blocked_date_to = getCSetting("BLOCKED_TO"); if (strtotime($date) >= strtotime($blocked_date_from) and strtotime($date) <= strtotime($blocked_date_to) and !user_is_admin(USER_ID)) { return "<li class='err'>Period Range Is Blocked. Only an administrator can process entries within this period.</li>"; } $out += 0; $OUT1 = $out1 + 0; $OUT2 = $out2 + 0; $OUT3 = $out3 + 0; $OUT4 = $out4 + 0; $OUT5 = $out5 + 0; $tot = 0; if (isset($invids)) { foreach ($invids as $key => $value) { if ($paidamt[$key] < 0.01) { continue; } $tot += $paidamt[$key]; } } if (isset($open_amount)) { $tot += array_sum($open_amount); } $tot = sprint($tot); $amt = sprint($amt); $out = sprint($out); if (sprint($tot + $out + $out1 + $out2 + $out3 + $out4 + $out5 - $amt) > sprint(0)) { $_POST['OUT1'] = $OUT1; $_POST['OUT2'] = $OUT2; $_POST['OUT3'] = $OUT3; $_POST['OUT4'] = $OUT4; $_POST['OUT5'] = $OUT5; return "<li class='err'>The total amount for invoices is greater than the amount received.\n\t\t\tPlease check the details.</li>" . alloc($_POST); } if (sprint($setamt) > 0) { if (array_sum($stock_setamt) != $setamt) { return "<li class='err'>The total settlement amount for invoices is not equal to the amount received.\n\t\t\tPlease check the details.</li>" . alloc($_POST); } } if (isset($bout)) { $out = $bout; } if (!isset($overpay)) { $overpay = 0; } $overpay = sprint($overpay); #generate a receipt number $receiptnumber = divlastid("receipt"); $confirm = "\n\t\t<h3>New Bank Receipt</h3>\n\t\t<h4>Confirm entry (Please check the details)</h4>\n\t\t<form action='" . SELF . "' method='POST'>\n\t\t\t<input type='hidden' name='key' value='write'>\n\t\t\t<input type='hidden' name='bankid' value='{$bankid}'>\n\t\t\t<input type='hidden' name='date' value='{$date}'>\n\t\t\t<input type='hidden' name='cusid' value='{$cusid}'>\n\t\t\t<input type='hidden' name='descript' value='{$descript}'>\n\t\t\t<input type='hidden' name='reference' value='{$reference}'>\n\t\t\t<input type='hidden' name='cheqnum' value='{$cheqnum}'>\n\t\t\t<input type='hidden' name='all' value='{$all}'>\n\t\t\t<input type='hidden' name='out' value='{$out}'>\n\t\t\t<input type='hidden' name='date_day' value='{$date_day}'>\n\t\t\t<input type='hidden' name='date_month' value='{$date_month}'>\n\t\t\t<input type='hidden' name='date_year' value='{$date_year}'>\n\t\t\t<input type='hidden' name='overpay' value='{$overpay}'>\n\t\t\t<input type='hidden' name='OUT1' value='{$OUT1}'>\n\t\t\t<input type='hidden' name='OUT2' value='{$OUT2}'>\n\t\t\t<input type='hidden' name='OUT3' value='{$OUT3}'>\n\t\t\t<input type='hidden' name='OUT4' value='{$OUT4}'>\n\t\t\t<input type='hidden' name='OUT5' value='{$OUT5}'>\n\t\t\t<input type='hidden' name='amt' value='{$amt}'>\n\t\t\t<input type='hidden' name='setamt' value='{$setamt}'>\n\t\t\t<input type='hidden' name='setvat' value='{$setvat}'>\n\t\t\t<input type='hidden' name='setvatcode' value='{$setvatcode}'>\n\t\t\t<input type='hidden' name='print_recpt' value='{$print_recpt}'>\n\t\t<table " . TMPL_tblDflts . ">"; /* bank account name */ if ($bankid == "0" or ($bank = qryBankAcct($bankid, "accname, bankname")) === false) { $bank['accname'] = "Cash"; $bank['bankname'] = ""; } /* customer name */ $cus = qryCustomer($cusid, "accno, cusname, surname"); if ($setvat == "inc") { $showsetvat = "VAT Inclusive"; } else { $showsetvat = "No VAT"; } // $overpay = sprint ($amt - array_sum($paidamt)); $overpay = sprint($overpay); if ($overpay < 0) { $overpay = 0.0; } if ($print_recpt == "yes") { $show_print_recpt = "Yes"; } else { $show_print_recpt = "No"; } $confirm .= "\n\t\t<tr>\n\t\t\t<th>Field</th>\n\t\t\t<th>Value</th>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Account</td>\n\t\t\t<td>{$bank['accname']} - {$bank['bankname']}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Payment Date</td>\n\t\t\t<td valign='center'>{$date}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Received from</td>\n\t\t\t<td valign='center'>{$cus['accno']} - {$cus['cusname']} {$cus['surname']}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Description</td>\n\t\t\t<td valign='center'>{$descript}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Reference</td>\n\t\t\t<td valign='center'>{$reference}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Cheque Number</td>\n\t\t\t<td valign='center'>{$cheqnum}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Amount</td>\n\t\t\t<td valign='center'>" . CUR . " {$amt}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Settlement Discount</td>\n\t\t\t<td valign='center'>" . CUR . " {$setamt} {$showsetvat}</td>\n\t\t</tr>\n\t\t" . TBL_BR . "\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Print Receipt</td>\n\t\t\t<td>{$show_print_recpt}</td>\n\t\t</tr>\n\t\t" . TBL_BR . "\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td colspan='5'><b>A general transaction will credit the client's account with " . CUR . " {$overpay} </b></td>\n\t\t</tr>"; if (sprint($setamt) > 0) { $doset = TRUE; } else { $doset = FALSE; } /* OPTION 3 : ALLOCATE TO EACH INVOICE (confirm) */ if ($all == 2) { if ($doset) { $showsethead = "<th>Settlement</th>"; } else { $showsethead = ""; } // Layout $confirm .= "\n\t\t\t" . TBL_BR . "\n\t\t\t<tr>\n\t\t\t\t<td colspan='2'><h3>Invoices</h3></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<th>Invoice Number</th>\n\t\t\t\t<th>Outstanding amount</th>\n\t\t\t\t<th>Terms</th>\n\t\t\t\t<th>Date</th>\n\t\t\t\t<th>Amount</th>\n\t\t\t\t{$showsethead}\n\t\t\t</tr>"; $i = 0; foreach ($invids as $key => $value) { if ($paidamt[$key] < 0.01) { continue; } $paidamt[$key] = sprint($paidamt[$key]); $ii = $invids[$key]; if (!isset($itype[$key]) && !isset($ptype[$key])) { /* STOCK INVOICE ! */ db_connect(); $sql = "SELECT invnum,invid,balance,terms,odate FROM invoices\n\t\t\t\t\t\tWHERE invid = '{$invids[$key]}' AND div = '" . USER_DIV . "'"; $invRslt = db_exec($sql) or errDie("Unable to access database."); if (pg_numrows($invRslt) < 1) { return "<li class='err'> -S- Invalid ord number {$invids[$key]}.</li>"; } $inv = pg_fetch_array($invRslt); $invid = $inv['invid']; #handle warnings ... if ($paidamt[$invid] + $stock_setamt[$invid] < sprint($inv['balance'])) { $warning = "<td><li class='err'>Paying Less Than Total Amount.</li></td>"; } elseif ($paidamt[$invid] + $stock_setamt[$invid] > sprint($inv['balance'])) { $warning = "<td><li class='err'>Paying More Than Total Amount Outstanding.</li></td>"; } else { $warning = ""; } if ($doset) { if (!isset($stock_setamt[$invid])) { $stock_setamt[$invid] = ""; } $showset = "<td>" . CUR . " " . sprint($stock_setamt[$invid]) . "</td>"; } else { $showset = "<td></td>"; } $confirm .= "\n\t\t\t\t\t<input type='hidden' name='paidamt[{$key}]' size='7' value='{$paidamt[$invid]}'>\n\t\t\t\t\t<input type='hidden' name='stock_setamt[{$key}]' value='{$stock_setamt[$invid]}'>\n\t\t\t\t\t<input type='hidden' size='20' name='invids[{$key}]' value='{$inv['invid']}'>\n\t\t\t\t\t<tr bgcolor='" . bgcolor($i) . "'>\n\t\t\t\t\t\t<td>{$inv['invnum']}</td>\n\t\t\t\t\t\t<td>" . CUR . " {$inv['balance']}</td>\n\t\t\t\t\t\t<td>{$inv['terms']} days</td>\n\t\t\t\t\t\t<td>{$inv['odate']}</td>\n\t\t\t\t\t\t<td>" . CUR . " {$paidamt[$key]}</td>\n\t\t\t\t\t\t{$showset}\n\t\t\t\t\t\t{$warning}\n\t\t\t\t\t</tr>"; } else { if (!isset($ptype[$key])) { /* NON STOCK INVOICE ! */ db_connect(); $sql = "SELECT invnum,invid,balance,sdate as odate FROM nons_invoices\n\t\t\t\t\t\tWHERE invid = '{$invids[$key]}' AND div = '" . USER_DIV . "'"; $invRslt = db_exec($sql) or errDie("Unable to access database."); if (pg_numrows($invRslt) < 1) { return "<li class='err'> -N- Invalid ord number {$invids[$key]}.</li>"; } $inv = pg_fetch_array($invRslt); $invid = "i" . $inv['invid']; #handle warnings ... if ($paidamt[$invid] + $stock_setamt[$invid] < sprint($inv['balance'])) { $warning = "<td><li class='err'>Paying Less Than Total Amount.</li></td>"; } elseif ($paidamt[$invid] + $stock_setamt[$invid] > sprint($inv['balance'])) { $warning = "<td><li class='err'>Paying More Than Total Amount Outstanding.</li></td>"; } else { $warning = ""; } if ($doset) { if (!isset($stock_setamt[$invid])) { $stock_setamt[$invid] = ""; } $showset = "<td>" . CUR . " " . sprint($stock_setamt[$invid]) . "</td>"; } else { $showset = "<td></td>"; } $confirm .= "\n\t\t\t\t\t<input type='hidden' size='20' name='invids[{$key}]' value='{$inv['invid']}'>\n\t\t\t\t\t<input type='hidden' name='paidamt[{$key}]' size='7' value='" . $paidamt[$key] . "'>\n\t\t\t\t\t<input type='hidden' name='stock_setamt[{$key}]' value='{$stock_setamt[$key]}'>\n\t\t\t\t\t<input type='hidden' name='itype[{$key}]' value='PcP'>\n\t\t\t\t\t<tr bgcolor='" . bgcolor($i) . "'>\n\t\t\t\t\t\t<td>{$inv['invnum']}</td>\n\t\t\t\t\t\t<td>" . CUR . " {$inv['balance']}</td>\n\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t<td>{$inv['odate']}</td>\n\t\t\t\t\t\t<td>" . CUR . " " . $paidamt[$key] . "</td>\n\t\t\t\t\t\t{$showset}\n\t\t\t\t\t\t{$warning}\n\t\t\t\t\t</tr>"; } else { /* POS INVOICE ! */ $sqls = array(); for ($i = 1; $i <= 12; ++$i) { $sqls[] = "SELECT invnum,invid,balance,odate FROM \"{$i}\".pinvoices WHERE invid = '{$invids[$key]}' AND div = '" . USER_DIV . "'"; } $sql = implode(" UNION ", $sqls); // (1jun07) only checks the current prd ?????? // db_conn(PRD_DB); // $sql = "SELECT invnum,invid,balance,odate FROM pinvoices // WHERE invid = '$invids[$key]' AND div = '".USER_DIV."'"; $invRslt = db_exec($sql) or errDie("Unable to access database."); if (pg_numrows($invRslt) < 1) { return "<li class='err'> -P- Invalid ord number {$invids[$key]}.</li>"; } $inv = pg_fetch_array($invRslt); $invid = "p" . $inv['invid']; #handle warnings ... if ($paidamt[$invid] + $stock_setamt[$invid] < sprint($inv['balance'])) { $warning = "<td><li class='err'>Paying Less Than Total Amount.</li></td>"; } elseif ($paidamt[$invid] + $stock_setamt[$invid] > sprint($inv['balance'])) { $warning = "<td><li class='err'>Paying More Than Total Amount Outstanding.</li></td>"; } else { $warning = ""; } if ($doset) { if (!isset($stock_setamt[$invid])) { $stock_setamt[$invid] = ""; } $showset = "<td>" . CUR . " " . sprint($stock_setamt[$invid]) . "</td>"; } else { $showset = "<td></td>"; } $confirm .= "\n\t\t\t\t\t<input type='hidden' size='20' name='invids[{$key}]' value='{$inv['invid']}'>\n\t\t\t\t\t<input type='hidden' name='paidamt[{$key}]' size='7' value='" . $paidamt[$key] . "'>\n\t\t\t\t\t<input type='hidden' name='stock_setamt[{$key}]' value='{$stock_setamt[$key]}'>\n\t\t\t\t\t<input type='hidden' name='ptype[{$key}]' value='PcP'>\n\t\t\t\t\t<tr bgcolor='" . bgcolor($i) . "'>\n\t\t\t\t\t\t<td>{$inv['invnum']}</td>\n\t\t\t\t\t\t<td>" . CUR . " {$inv['balance']}</td>\n\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t<td>{$inv['odate']}</td>\n\t\t\t\t\t\t<td>" . CUR . " " . $paidamt[$key] . "</td>\n\t\t\t\t\t\t{$showset}\n\t\t\t\t\t\t{$warning}\n\t\t\t\t\t</tr>"; } } } if (open()) { db_conn('cubit'); $Sl = "SELECT * FROM open_stmnt WHERE balance>0 AND cusnum='{$cusid}' ORDER BY date"; $Ri = db_exec($Sl) or errDie("Unable to get open items."); //$open_out=$out; $ox = ""; $i = 0; while ($od = pg_fetch_array($Ri)) { $oid = $od['id']; if (!isset($open_amount[$oid]) || $open_amount[$oid] == 0) { continue; } $ox .= "\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td><input type='hidden' size='20' name='open[{$oid}]' value='{$oid}'>{$od['type']}</td>\n\t\t\t\t\t\t<td>" . CUR . " {$od['balance']}</td>\n\t\t\t\t\t\t<td>{$od['date']}</td>\n\t\t\t\t\t\t<td><input type='hidden' name='open_amount[{$oid}]' value='{$open_amount[$oid]}'>" . CUR . " {$open_amount[$oid]}</td>\n\t\t\t\t\t</tr>"; $i++; } $confirm .= "\n\t\t\t\t<tr><td colspan='2'><br></td></tr>\n\t\t\t\t<tr><td colspan='2'>\n\t\t\t\t\t<h3>Outstanding Transactions</h3></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Description</th>\n\t\t\t\t\t<th>Outstanding Amount</th>\n\t\t\t\t\t<th>Date</th>\n\t\t\t\t\t<th>Amount</th>\n\t\t\t\t</tr>\n\t\t\t\t{$ox}"; } } vsprint($out); vsprint($out1); vsprint($out2); vsprint($out3); vsprint($out4); vsprint($out5); /* <tr> <td colspan='5' align='right'><input type='submit' name='batch' value='Add To Batch'></td> </tr> */ $confirm .= "\n\t\t<input type='hidden' name='out1' value='{$out1}'>\n\t\t<input type='hidden' name='out2' value='{$out2}'>\n\t\t<input type='hidden' name='out3' value='{$out3}'>\n\t\t<input type='hidden' name='out4' value='{$out4}'>\n\t\t<input type='hidden' name='out5' value='{$out5}'>\n\t\t" . TBL_BR . "\n\t\t<tr>\n\t\t\t<td><input type='submit' name='back' value='« Correction'></td>\n\t\t\t<td align='right' colspan='4'><input type='submit' value='Write »'></td>\n\t\t</tr>\n\t\t</table>\n\t\t</form>" . mkQuickLinks(ql("../core/trans-new.php", "Journal Transactions"), ql("../customers-view.php", "View Customers")); return $confirm; }
function dispatch() { $path = $_SERVER['REQUEST_URI']; if (config('site.url') !== null) { $path = preg_replace('@^' . preg_quote(site_path()) . '@', '', $path); } $parts = preg_split('/\\?/', $path, -1, PREG_SPLIT_NO_EMPTY); $uri = trim($parts[0], '/'); $uri = strlen($uri) ? $uri : 'index'; route(method(), "/{$uri}"); }
function Admin_Users() { global $session; global $db_prefix; global $GlobalUser; global $FleetMissionList; $now = time(); $resmap = array(106, 108, 109, 110, 111, 113, 114, 115, 117, 118, 120, 121, 122, 123, 124, 199); $unitab = LoadUniverse(); $speed = $unitab['speed']; // Обработка POST-запроса. if (method() === "POST" && $GlobalUser['admin'] >= 2) { if (key_exists('player_id', $_GET)) { $player_id = intval($_GET['player_id']); } else { $player_id = 0; } if (key_exists('action', $_GET) && $player_id) { $action = $_GET['action']; } else { $action = ""; } if ($action === "update") { $query = "UPDATE " . $db_prefix . "users SET "; foreach ($resmap as $i => $gid) { $query .= "r{$gid} = " . intval($_POST["r{$gid}"]) . ", "; } if ($_POST['deaktjava'] === "on") { $query .= "disable = 1, disable_until = " . ($now + 7 * 24 * 60 * 60) . ", "; } else { $query .= "disable = 0, "; } if ($_POST['vacation'] === "on") { $query .= "vacation = 1, vacation_until = " . ($now + 2 * 24 * 60 * 60 / $speed) . ", "; } else { $query .= "vacation = 0, "; } if ($_POST['banned'] !== "on") { $query .= "banned = 0, "; } if ($_POST['noattack'] !== "on") { $query .= "noattack = 0, "; } $query .= "pemail = '" . $_POST['pemail'] . "', "; $query .= "email = '" . $_POST['email'] . "', "; $query .= "admin = '" . $_POST['admin'] . "', "; $query .= "validated = " . ($_POST['validated'] === "on" ? 1 : 0) . ", "; $query .= "sniff = " . ($_POST['sniff'] === "on" ? 1 : 0) . ", "; $query .= "debug = " . ($_POST['debug'] === "on" ? 1 : 0) . ", "; $query .= "dm = '" . intval($_POST['dm']) . "', "; $query .= "dmfree = '" . intval($_POST['dmfree']) . "', "; $query .= "sortby = '" . intval($_POST['settings_sort']) . "', "; $query .= "sortorder = '" . intval($_POST['settings_order']) . "', "; $query .= "skin = '" . $_POST['dpath'] . "', "; $query .= "useskin = " . ($_POST['design'] === "on" ? 1 : 0) . ", "; $query .= "deact_ip = " . ($_POST['deact_ip'] === "on" ? 1 : 0) . ", "; $query .= "maxspy = '" . intval($_POST['spio_anz']) . "', "; $query .= "maxfleetmsg = '" . intval($_POST['settings_fleetactions']) . "' "; $query .= " WHERE player_id={$player_id};"; dbquery($query); $qname = array('CommanderOff', 'AdmiralOff', 'EngineerOff', 'GeologeOff', 'TechnocrateOff'); foreach ($qname as $i => $qcmd) { $days = intval($_POST[$qcmd]); if ($days > 0) { RecruitOfficer($player_id, $qcmd, $days * 24 * 60 * 60); } } } if ($action === "create_planet") { $g = $_POST['g']; if ($g === "") { $g = 1; } $s = $_POST['s']; if ($s === "") { $s = 1; } $p = $_POST['p']; if ($p === "") { $p = 1; } if (!HasPlanet($g, $s, $p)) { $planet_id = CreatePlanet($g, $s, $p, $_GET['player_id']); $query = "UPDATE " . $db_prefix . "planets SET mprod = 0, kprod = 0, dprod = 0 WHERE planet_id = " . $planet_id; dbquery($query); } } } // Обработка GET-запроса. if (method() === "GET" && $GlobalUser['admin'] >= 2) { if (key_exists('player_id', $_GET)) { $player_id = intval($_GET['player_id']); } else { $player_id = 0; } if (key_exists('action', $_GET) && $player_id) { $action = $_GET['action']; } else { $action = ""; } $now = time(); if ($action === "recalc_stats") { RecalcStats($player_id); RecalcRanks(); } if ($action === "reactivate") { ReactivateUser($player_id); } if ($action === "bot_start") { StartBot($player_id); } if ($action === "bot_stop") { StopBot($player_id); } } if (key_exists("player_id", $_GET)) { // Информация об игроке InvalidateUserCache(); $user = LoadUser(intval($_GET['player_id'])); ?> <?php echo AdminPanel(); ?> <table> <form action="index.php?page=admin&session=<?php echo $session; ?> &mode=Users&action=update&player_id=<?php echo $user['player_id']; ?> " method="POST" > <tr><td class=c><?php echo AdminUserName($user); ?> </td><td class=c>Настройки</td><td class=c>Исследования</td></tr> <th valign=top><table> <tr><th>ID</th><th><?php echo $user['player_id']; ?> </th></tr> <tr><th>Дата регистрации</th><th><?php echo date("Y-m-d H:i:s", $user['regdate']); ?> </th></tr> <tr><th>Альянс</th><th> <?php if ($user['ally_id']) { $ally = LoadAlly($user['ally_id']); echo "[" . $ally['tag'] . "] " . $ally['name']; } ?> </th></tr> <tr><th>Дата вступления</th><th> <?php if ($user['ally_id']) { echo date("Y-m-d H:i:s", $user['joindate']); } ?> </th></tr> <tr><th>Постоянный адрес</th><th><input type="text" name="pemail" maxlength="100" size="20" value="<?php echo $user['pemail']; ?> " /></th></tr> <tr><th>Временный адрес</th><th><input type="text" name="email" maxlength="100" size="20" value="<?php echo $user['email']; ?> " /></th></tr> <tr><th>Удалить игрока</th><th><input type="checkbox" name="deaktjava" <?php echo IsChecked($user, "disable"); ?> /> <?php if ($user['disable']) { echo date("Y-m-d H:i:s", $user['disable_until']); } ?> </th></tr> <tr><th>Режим отпуска</th><th><input type="checkbox" name="vacation" <?php echo IsChecked($user, "vacation"); ?> /> <?php if ($user['vacation']) { echo date("Y-m-d H:i:s", $user['vacation_until']); } ?> </th></tr> <tr><th>Заблокирован</th><th><input type="checkbox" name="banned" <?php echo IsChecked($user, "banned"); ?> /> <?php if ($user['banned']) { echo date("Y-m-d H:i:s", $user['banned_until']); } ?> </th></tr> <tr><th>Бан атак</th><th><input type="checkbox" name="noattack" <?php echo IsChecked($user, "noattack"); ?> /> <?php if ($user['noattack']) { echo date("Y-m-d H:i:s", $user['noattack_until']); } ?> </th></tr> <tr><th>Последний вход</th><th><?php echo date("Y-m-d H:i:s", $user['lastlogin']); ?> </th></tr> <tr><th>Активность</th><th> <?php $now = time(); echo date("Y-m-d H:i:s", $user['lastclick']); if ($now - $user['lastclick'] < 60 * 60) { echo " (" . floor(($now - $user['lastclick']) / 60) . " min)"; } ?> </th></tr> <tr><th>IP адрес</th><th><a href="http://nic.ru/whois/?query=<?php echo $user['ip_addr']; ?> " target=_blank><?php echo $user['ip_addr']; ?> </a></th></tr> <tr><th>Активирован</th><th><input type="checkbox" name="validated" <?php echo IsChecked($user, "validated"); ?> /> <a href="index.php?page=admin&session=<?php echo $session; ?> &mode=Users&action=reactivate&player_id=<?php echo $user['player_id']; ?> ">выслать пароль</a></th></tr> <tr><th>Главная планета</th><th> <?php $planet = GetPlanet($user['hplanetid']); echo "[" . $planet['g'] . ":" . $planet['s'] . ":" . $planet['p'] . "] <a href=\"index.php?page=admin&session={$session}&mode=Planets&cp=" . $planet['planet_id'] . "\">" . $planet['name'] . "</a>"; ?> </th></tr> <tr><th>Текущая планета</th><th> <?php $planet = GetPlanet($user['aktplanet']); echo "[" . $planet['g'] . ":" . $planet['s'] . ":" . $planet['p'] . "] <a href=\"index.php?page=admin&session={$session}&mode=Planets&cp=" . $planet['planet_id'] . "\">" . $planet['name'] . "</a>"; ?> </th></tr> <tr><th>Права</th><th> <select name="admin"> <option value="0" <?php echo IsSelected($user, "admin", 0); ?> >Пользователь</option> <option value="1" <?php echo IsSelected($user, "admin", 1); ?> >Оператор</option> <option value="2" <?php echo IsSelected($user, "admin", 2); ?> >Администратор</option> </select> </th></tr> <tr><th>Включить слежение</th><th><input type="checkbox" name="sniff" <?php echo IsChecked($user, "sniff"); ?> /></th></tr> <tr><th>Отладочная информация</th><th><input type="checkbox" name="debug" <?php echo IsChecked($user, "debug"); ?> /></th></tr> <?php if (IsBot($user['player_id'])) { ?> <tr><th colspan=2><a href="index.php?page=admin&session=<?php echo $session; ?> &mode=Users&action=bot_stop&player_id=<?php echo $user['player_id']; ?> " >[Остановить бота]</a></th></tr> <?php } else { ?> <tr><th colspan=2><a href="index.php?page=admin&session=<?php echo $session; ?> &mode=Users&action=bot_start&player_id=<?php echo $user['player_id']; ?> " >[Запустить бота]</a></th></tr> <?php } ?> </table></th> <th valign=top><table> <tr><th>Сортировка планет</th><th> <select name="settings_sort"> <option value="0" <?php echo IsSelected($user, "sortby", 0); ?> >порядку колонизации</option> <option value="1" <?php echo IsSelected($user, "sortby", 1); ?> >координатам</option> <option value="2" <?php echo IsSelected($user, "sortby", 2); ?> >алфавиту</option> </select> </th></tr> <tr><th>Порядок сортировки</th><th> <select name="settings_order"> <option value="0" <?php echo IsSelected($user, "sortorder", 0); ?> >по возрастанию</option> <option value="1" <?php echo IsSelected($user, "sortorder", 1); ?> >по убыванию</option> </select> </th></tr> <tr><th>Скин</th><th><input type=text name="dpath" maxlength="80" size="40" value="<?php echo $user['skin']; ?> " /></th></tr> <tr><th>Использовать скин</th><th><input type="checkbox" name="design" <?php echo IsChecked($user, "useskin"); ?> /></th></tr> <tr><th>Декативировать проверку IP</th><th><input type="checkbox" name="deact_ip" <?php echo IsChecked($user, "deact_ip"); ?> /></th></tr> <tr><th>Количество зондов</th><th><input type="text" name="spio_anz" maxlength="2" size="2" value="<?php echo $user['maxspy']; ?> " /></th></tr> <tr><th>Количество сообщений флота</th><th><input type="text" name="settings_fleetactions" maxlength="2" size="2" value="<?php echo $user['maxfleetmsg']; ?> " /></th></tr> <tr><th colspan=2> </th></tr> <tr><td class=c colspan=2>Статистика</td></tr> <tr><th>Очки (старые)</th><th><?php echo nicenum($user['oldscore1'] / 1000); ?> / <?php echo nicenum($user['oldplace1']); ?> </th></tr> <tr><th>Флот (старые)</th><th><?php echo nicenum($user['oldscore2']); ?> / <?php echo nicenum($user['oldplace2']); ?> </th></tr> <tr><th>Исследования (старые)</th><th><?php echo nicenum($user['oldscore3']); ?> / <?php echo nicenum($user['oldplace3']); ?> </th></tr> <tr><th>Очки</th><th><?php echo nicenum($user['score1'] / 1000); ?> / <?php echo nicenum($user['place1']); ?> </th></tr> <tr><th>Флот</th><th><?php echo nicenum($user['score2']); ?> / <?php echo nicenum($user['place2']); ?> </th></tr> <tr><th>Исследования</th><th><?php echo nicenum($user['score3']); ?> / <?php echo nicenum($user['place3']); ?> </th></tr> <tr><th>Дата старой статистики</th><th><?php echo date("Y-m-d H:i:s", $user['scoredate']); ?> </th></tr> <tr><th colspan=2><a href="index.php?page=admin&session=<?php echo $session; ?> &mode=Users&action=recalc_stats&player_id=<?php echo $user['player_id']; ?> " >[Пересчитать статистику]</a></th></tr> <tr><th colspan=2> </th></tr> <tr><td class=c colspan=2>Офицеры</td></tr> <tr><th colspan=2><table><tr> <?php $oname = array('Командир ОГейма', 'Адмирал', 'Инженер', 'Геолог', 'Технократ'); $odesc = array('', '<font size=1 color=skyblue>&nbsp;Макс. кол-во флотов +2</font>', '<font size=1 color=skyblue>Сокращает вдвое потери в обороне+10% больше энергии</font>', '<font size=1 color=skyblue>+10% доход от шахты</font>', '<font size=1 color=skyblue>+2 уровень шпионажа, 25% меньше времени на исследования</font>'); $qname = array('CommanderOff', 'AdmiralOff', 'EngineerOff', 'GeologeOff', 'TechnocrateOff'); $imgname = array('commander', 'admiral', 'ingenieur', 'geologe', 'technokrat'); $now = time(); foreach ($qname as $i => $qcmd) { $end = GetOfficerLeft($user['player_id'], $qname[$i]); $img = ""; if ($end <= $now) { $img = "_un"; $days = ""; } else { $d = ($end - $now) / (60 * 60 * 24); if ($d > 0) { $days = "<font color=lime>Активен</font> ещё " . ceil($d) . " д."; } } echo " <td align='center' width='35' class='header'>\n"; echo "\t<img border='0' src='img/" . $imgname[$i] . "_ikon" . $img . ".gif' width='32' height='32' alt='" . $oname[$i] . "'\n"; echo "\tonmouseover=\"return overlib('<center><font size=1 color=white><b>" . $days . "<br>" . $oname[$i] . "</font><br>" . $odesc[$i] . "<br></b></center>', LEFT, WIDTH, 150);\" onmouseout='return nd();'>\n"; echo " </td> <td><input type=\"text\" name=\"" . $qname[$i] . "\" size=\"3\" /></td>\n\n"; } ?> </tr></table></th></tr> <tr><th colspan=2><i>Чтобы продлить офицера укажите необходимое количество дней в полях ввода</i></th></tr> </table></th> <th valign=top><table> <?php foreach ($resmap as $i => $gid) { echo "<tr><th>" . loca("NAME_{$gid}") . "</th><th><input type=\"text\" size=3 name=\"r{$gid}\" value=\"" . $user["r{$gid}"] . "\" /></th></tr>\n"; } ?> <tr><th>Найденная Тёмная Материя</th><th><input type="text" size=5 name="dmfree" value="<?php echo $user['dmfree']; ?> " /></th></tr> <tr><th>Покупная Тёмная Материя</th><th><input type="text" size=5 name="dm" value="<?php echo $user['dm']; ?> " /></th></tr> </table></th> <tr><th colspan=3><input type="submit" value="Сохранить" /></th></tr> </form> </table> <br> <table> <form action="index.php?page=admin&session=<?php echo $session; ?> &mode=Users&action=create_planet&player_id=<?php echo $user['player_id']; ?> " method="POST" > <tr><td class=c colspan=20>Список планет</td></tr> <tr> <?php $query = "SELECT * FROM " . $db_prefix . "planets WHERE owner_id = '" . intval($_GET['player_id']) . "' ORDER BY g ASC, s ASC, p ASC, type DESC"; $result = dbquery($query); $rows = dbrows($result); $counter = 0; while ($rows--) { $p = dbarray($result); ?> <td> <img src="<?php echo GetPlanetSmallImage("../evolution/", $p); ?> " width="32px" height="32px"></td> <td> <a href="index.php?page=admin&session=<?php echo $session; ?> &mode=Planets&cp=<?php echo $p['planet_id']; ?> "> <?php echo $p['name']; ?> </a> [<a href="index.php?page=galaxy&session=<?php echo $session; ?> &galaxy=<?php echo $p['g']; ?> &system=<?php echo $p['s']; ?> "><?php echo $p['g']; ?> :<?php echo $p['s']; ?> :<?php echo $p['p']; ?> </a>] </td> <?php $counter++; if ($counter > 9) { $counter = 0; echo "</tr>\n<tr>\n"; } } ?> </tr> <tr><td colspan=20> Координаты: <input name="g" size=2> <input name="s" size=2> <input name="p" size=2> <input type="submit" value="Создать планету"></td></tr> </form> </table> <br> <table> <?php if ($_GET['action'] === 'fleetlogs') { echo "<tr><td class=c colspan=12>Логи полётов</td></tr>\n"; if ($_GET['from'] == 1) { $result = FleetlogsFromPlayer($user['player_id'], $FleetMissionList[$_GET['mission']]); } else { $result = FleetlogsToPlayer($user['player_id'], $FleetMissionList[$_GET['mission']]); } $anz = $rows = dbrows($result); echo "<tr><td class=c>N</td> <td class=c>Таймер</td> <td class=c>Задание</td> <td class=c>Отправлен</td> <td class=c>Прибывает</td><td class=c>Время полёта</td> <td class=c>Старт</td> <td class=c>Цель</td> <td class=c>Флот</td> <td class=c>Ресурсы на планете</td> <td class=c>Груз</td> <td class=c>САБ</td> </tr>\n"; $bxx = 1; while ($rows--) { $fleet_obj = dbarray($result); $fleet_price = FleetPrice($fleet_obj); $points = $fleet_price['points']; $fpoints = $fleet_price['fpoints']; $style = ""; if ($points >= 100000000) { if ($fleet_obj['mission'] <= 2) { $style = " style=\"background-color: FireBrick;\" "; } else { $style = " style=\"background-color: DarkGreen;\" "; } } ?> <tr <?php echo $style; ?> > <th <?php echo $style; ?> > <?php echo $bxx; ?> </th> <th <?php echo $style; ?> > <?php echo "<table><tr {$style} ><th {$style} ><div id='bxx" . $bxx . "' title='" . ($fleet_obj['end'] - $now) . "' star='" . $fleet_obj['start'] . "'> </th>"; echo "<tr><th {$style} >" . date("d.m.Y H:i:s", $fleet_obj['end']) . "</th></tr></table>"; ?> </th> <th <?php echo $style; ?> > <?php echo FleetlogsMissionText($fleet_obj['mission']); ?> </th> <th <?php echo $style; ?> ><?php echo date("d.m.Y", $fleet_obj['start']); ?> <br> <?php echo date("H:i:s", $fleet_obj['start']); ?> </th> <th <?php echo $style; ?> ><?php echo date("d.m.Y", $fleet_obj['end']); ?> <br> <?php echo date("H:i:s", $fleet_obj['end']); ?> </th> <th <?php echo $style; ?> > <?php echo "<nobr>" . BuildDurationFormat($fleet_obj['flight_time']) . "</nobr><br>"; echo "<nobr>" . $fleet_obj['flight_time'] . " сек.</nobr>"; ?> </th> <th <?php echo $style; ?> > <?php echo "[" . $fleet_obj['origin_g'] . ":" . $fleet_obj['origin_s'] . ":" . $fleet_obj['origin_p'] . "]"; $u = LoadUser($fleet_obj['owner_id']); echo " <br>" . AdminUserName($u); ?> </th> <th <?php echo $style; ?> > <?php echo "[" . $fleet_obj['target_g'] . ":" . $fleet_obj['target_s'] . ":" . $fleet_obj['target_p'] . "]"; $u = LoadUser($fleet_obj['target_id']); echo " <br>" . AdminUserName($u); ?> </th> <th <?php echo $style; ?> > <?php $fleetmap = array(202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215); foreach ($fleetmap as $i => $gid) { $amount = $fleet_obj["ship" . $gid]; if ($amount > 0) { echo loca("NAME_{$gid}") . ":" . nicenum($amount) . " "; } } ?> </th> <th <?php echo $style; ?> > <?php $total = $fleet_obj['pm'] + $fleet_obj['pk'] + $fleet_obj['pd']; if ($total > 0) { echo "М: " . nicenum($fleet_obj['pm']) . "<br>"; echo "К: " . nicenum($fleet_obj['pk']) . "<br>"; echo "Д: " . nicenum($fleet_obj['pd']); } else { echo "-"; } ?> </th> <th <?php echo $style; ?> > <?php $total = $fleet_obj['m'] + $fleet_obj['k'] + $fleet_obj['d']; if ($total > 0) { echo "М: " . nicenum($fleet_obj['m']) . "<br>"; echo "К: " . nicenum($fleet_obj['k']) . "<br>"; echo "Д: " . nicenum($fleet_obj['d']); } else { echo "-"; } ?> </th> <th <?php echo $style; ?> > <?php if ($fleet_obj['union_id']) { echo $fleet_obj['union_id']; } else { echo "-"; } ?> </th> </tr> <?php $bxx++; } echo "<script language=javascript>anz={$anz};t();</script>\n"; } else { ?> <tr><td class=c colspan=3>Логи полётов</td></tr> <tr><td>Задание</td><td>от <?php echo $user['oname']; ?> </td><td>на <?php echo $user['oname']; ?> </td></tr> <tr><td>Все</td><td><?php echo LinkFleetsFrom($user, 0); ?> </td><td><?php echo LinkFleetsTo($user, 0); ?> </td></tr> <tr><td>Атака</td><td><?php echo LinkFleetsFrom($user, 1); ?> </td><td><?php echo LinkFleetsTo($user, 1); ?> </td></tr> <tr><td>Совместная атака</td><td><?php echo LinkFleetsFrom($user, 2); ?> </td><td><?php echo LinkFleetsTo($user, 2); ?> </td></tr> <tr><td>Транспорт</td><td><?php echo LinkFleetsFrom($user, 3); ?> </td><td><?php echo LinkFleetsTo($user, 3); ?> </td></tr> <tr><td>Оставить</td><td><?php echo LinkFleetsFrom($user, 4); ?> </td><td><?php echo LinkFleetsTo($user, 4); ?> </td></tr> <tr><td>Держаться</td><td><?php echo LinkFleetsFrom($user, 5); ?> </td><td><?php echo LinkFleetsTo($user, 5); ?> </td></tr> <tr><td>Шпионаж</td><td><?php echo LinkFleetsFrom($user, 6); ?> </td><td><?php echo LinkFleetsTo($user, 6); ?> </td></tr> <tr><td>Колонизировать</td><td><?php echo LinkFleetsFrom($user, 7); ?> </td><td><?php echo LinkFleetsTo($user, 7); ?> </td></tr> <tr><td>Переработать</td><td><?php echo LinkFleetsFrom($user, 8); ?> </td><td><?php echo LinkFleetsTo($user, 8); ?> </td></tr> <tr><td>Уничтожить</td><td><?php echo LinkFleetsFrom($user, 9); ?> </td><td><?php echo LinkFleetsTo($user, 9); ?> </td></tr> <tr><td>Экспедиция</td><td><?php echo LinkFleetsFrom($user, 15); ?> </td><td><?php echo LinkFleetsTo($user, 15); ?> </td></tr> <tr><td>Ракетная атака</td><td><?php echo LinkFleetsFrom($user, 20); ?> </td><td><?php echo LinkFleetsTo($user, 20); ?> </td></tr> <tr><td>Атака (САБ)</td><td><?php echo LinkFleetsFrom($user, 21); ?> </td><td><?php echo LinkFleetsTo($user, 21); ?> </td></tr> </table> <?php } ?> <?php } else { $query = "SELECT * FROM " . $db_prefix . "users ORDER BY regdate 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></tr>\n"; $rows = dbrows($result); while ($rows--) { $user = dbarray($result); $hplanet = GetPlanet($user['hplanetid']); echo "<tr><th>" . date("Y-m-d H:i:s", $user['regdate']) . "</th>"; echo "<th>[" . $hplanet['g'] . ":" . $hplanet['s'] . ":" . $hplanet['p'] . "] <a href=\"index.php?page=admin&session={$session}&mode=Planets&cp=" . $hplanet['planet_id'] . "\">" . $hplanet['name'] . "</a></th>"; echo "<th>" . AdminUserName($user) . "</th></tr>\n"; } echo "</table>\n"; ?> <br> <table> <?php $when = time() - 24 * 60 * 60; $query = "SELECT * FROM " . $db_prefix . "users WHERE lastclick >= {$when} ORDER BY oname ASC"; $result = dbquery($query); $rows = dbrows($result); ?> <tr><td class=c>Активные за последние 24 часа (<?php echo $rows; ?> )</td></tr> <tr><td> <?php $first = true; while ($rows--) { $user = dbarray($result); if ($first) { $first = false; } else { echo ", "; } echo AdminUserName($user); } ?> </td></tr> </table> <?php } // Поиск пользователей }
$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 = $GlobalUni; $defmap = array(401, 402, 403, 404, 405, 406, 407, 408); function empty_row($p) { echo "<tr><th width=\"30\"><a href=\"#\" >" . $p . "</a></th><th width=\"30\"></th><th width=\"130\" style='white-space: nowrap;'></th><th width=\"30\" style='white-space: nowrap;'></th><th width=\"30\"></th><th width=\"150\"></th><th width=\"80\"></th><th width=\"125\" style='white-space: nowrap;'></th></tr>\n\n"; } // Ракетная атака. if (method() === "POST" && isset($_POST['aktion'])) { $amount = abs(intval($_POST['anz'])); // Количество ракет $type = abs(intval($_POST['pziel'])); // Основная цель (0-все) $origin = $aktplanet; $target = GetPlanet(intval($_GET['pdd'])); $target_user = LoadUser($target['owner_id']); $dist = abs($origin['s'] - $target['s']); $ipm_radius = max(0, 5 * $GlobalUser['r117'] - 1); if ($target == NULL) { $GalaxyError = "Нет цели"; } if (!in_array($type, $defmap)) { $type = 0; }
// Флот 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> <script type="text/javascript">
function Admin_Logins() { global $session; global $db_prefix; global $GlobalUser; AdminPanel(); // Обработка POST-запроса. if (method() === "POST") { if ($_POST['name'] !== '') { $searchtext = $_POST['name']; $query = "SELECT * FROM " . $db_prefix . "users WHERE oname LIKE '" . $searchtext . "%' LIMIT 25"; $result = dbquery($query); $rows = dbrows($result); echo "<table>"; while ($rows--) { $user = dbarray($result); $query = "SELECT * FROM " . $db_prefix . "iplogs WHERE user_id = '" . intval($user['player_id']) . "' AND reg = 0"; $result2 = dbquery($query); $rows2 = dbrows($result2); while ($rows2--) { $log = dbarray($result2); echo "<tr><td>"; echo date("Y-m-d H:i:s", $log['date']); echo " " . $log['ip']; echo " " . AdminUserName($user); echo "</td></tr>"; } } echo "</table>"; } if ($_POST['id'] !== '') { $query = "SELECT * FROM " . $db_prefix . "iplogs WHERE user_id = '" . intval($_POST['id']) . "' AND reg = 0"; $result = dbquery($query); $rows = dbrows($result); echo "<table>"; while ($rows--) { $log = dbarray($result); $user = LoadUser($log['user_id']); echo "<tr><td>"; echo date("Y-m-d H:i:s", $log['date']); echo " " . $log['ip']; echo " " . AdminUserName($user); echo "</td></tr>"; } echo "</table>"; } if ($_POST['ip'] !== '') { $query = "SELECT * FROM " . $db_prefix . "iplogs WHERE ip = '" . $_POST['ip'] . "' AND reg = 0"; $result = dbquery($query); $rows = dbrows($result); echo "<table>"; while ($rows--) { $log = dbarray($result); $user = LoadUser($log['user_id']); echo "<tr><td>"; echo date("Y-m-d H:i:s", $log['date']); echo " " . $log['ip']; echo " " . AdminUserName($user); echo "</td></tr>"; } echo "</table>"; } } ?> <form action="index.php?page=admin&session=<?php echo $session; ?> &mode=Logins" method="POST"> <table> <tr> <td class=d>По имени пользователя:</td> <td> <input type=text size=20 name=name></td> </tr> <tr> <td class=d>По ID пользователя:</td> <td><input type=text size=20 name=id></td> </tr> <tr> <td class=d>По IP адресу:</td> <td> <input type=text size=20 name=ip></td> </tr> <tr> <td colspan=2 class=d><center><input type=submit value=Искать></center></td></tr> </table> </form> <?php }
function Admin_UserLogs() { global $session; global $db_prefix; global $GlobalUser; // Обработка POST-запроса. if (method() === "POST" && $GlobalUser['admin'] >= 1) { $name = $_POST['name']; $type = $_POST['type']; $period = intval($_POST['days']) * 24 * 60 * 60 + intval($_POST['hours']) * 60 * 60; $arr = My_date_parse_from_format("dd.mm.yyyy", $_POST['since']); $since = mktime(0, 0, 0, $arr['month'], $arr['day'], $arr['year']); // Шаг 1 : найти всех пользователей неточным сравнением $users = array(); $query = "SELECT * FROM " . $db_prefix . "users WHERE player_id > 0"; $result = dbquery($query); while ($user = dbarray($result)) { $percent = 0; similar_text(mb_strtolower($name), mb_strtolower($user['oname']), &$percent); if ($percent > 75) { $users[] = $user; } } // Шаг 2 : выбрать события указанной категории за промежуток времени $results = ""; foreach ($users as $i => $user) { if ($type !== "ALL") { $tstr = "AND type = '" . $type . "'"; } $query = "SELECT * FROM " . $db_prefix . "userlogs WHERE owner_id = " . $user['player_id'] . " AND (date >= " . $since . " AND date <= " . ($since + $period) . ") " . $tstr . " ORDER BY date ASC"; $result = dbquery($query); $count = dbrows($result); $results .= "<h2>История {$type} игрока " . AdminUserName($user) . " ({$count})</h2>\n"; $results .= "<table><tr><td class=\"c\">Дата</td><td class=\"c\">Тип</td><td class=\"c\">Действие</td></tr>\n"; while ($log = dbarray($result)) { $results .= "<tr><td>" . date("d.m.Y H:i:s", $log['date']) . "</td><td>" . $log['type'] . "</td><td>" . $log['text'] . "</td></tr>\n"; } $results .= "</table>"; } } ?> <?php echo AdminPanel(); ?> <?php if (method() === "GET") { $query = "SELECT * FROM " . $db_prefix . "userlogs WHERE owner_id > 0 ORDER BY date DESC LIMIT 50"; $result = dbquery($query); echo "<h2>Последние действия игроков</h2>\n"; echo "<table><tr><td class=\"c\">Дата</td><td class=\"c\">Игрок</td><td class=\"c\">Категория</td><td class=\"c\">Действие</td></tr>\n"; $rows = array(); while ($log = dbarray($result)) { $user = LoadUser($log['owner_id']); $rows[] = "<tr><td>" . date("d.m.Y H:i:s", $log['date']) . "</td><td>" . AdminUserName($user) . "</td><td>" . $log['type'] . "</td><td>" . $log['text'] . "</td></tr>\n"; } $rows = array_reverse($rows); foreach ($rows as $i => $row) { echo $row; } echo "</table>"; } ?> <?php echo $results; ?> <h2>История действий</h2> <table> <form action="index.php?page=admin&session=<?php echo $session; ?> &mode=UserLogs" method="POST" > <tr><td>Имя пользователя</td><td><input type="text" size=20 name="name"/> (можно примерно)</td></tr> <tr><td>Категория</td><td> <select name="type"> <option value="ALL">Все</option> <option value="BUILD">Постройки / Снос</option> <option value="RESEARCH">Исследования</option> <option value="SHIPYARD">Постройка флота</option> <option value="DEFENSE">Постройка обороны</option> <option value="FLEET">Отправка флота</option> <option value="PLANET">Настройки планеты</option> <option value="SETTINGS">Изменение настроек аккаунта / РО</option> <option value="OPER">Действия оператора</option> </select> </td></tr> <tr><td>За период</td><td><input type="text" size=2 name="days" value="2"/> дн. <input type="text" size=2 name="hours"/> ч.</td></tr> <tr><td>Начиная с</td><td><input type="text" size=20 name="since" value="<?php echo date("d.m.Y", time() - 24 * 60 * 60); ?> "/> ДД.ММ.ГГГ</td></tr> <tr><td class="c" colspan=2> <input type="submit" value="Отправить" /></td></tr> </form> </table> <?php }
function alloc($_POST) { # get vars extract($_POST); # validate input require_lib("validate"); $v = new validate(); $v->isOk($bankid, "num", 1, 30, "Invalid Bank Account."); $v->isOk($date_day, "num", 1, 2, "Invalid Date day."); $v->isOk($all, "num", 1, 1, "Invalid allocation."); $v->isOk($date_month, "num", 1, 2, "Invalid Date month."); $v->isOk($date_year, "num", 1, 4, "Invalid Date Year."); if (strlen($date_year) != 4) { $v->isOk($bankname, "num", 1, 1, "Invalid Date year."); } $v->isOk($descript, "string", 0, 255, "Invalid Description."); $v->isOk($cheqnum, "num", 0, 30, "Invalid Cheque number."); $v->isOk($amt, "float", 1, 10, "Invalid amount."); if ($amt < 0.01) { $v->isOk($amt, "float", 5, 1, "Amount to small."); } $v->isOk($rate, "float", 1, 10, "Invalid exchange rate."); $v->isOk($supid, "num", 1, 10, "Invalid supplier number."); $date = $date_day . "-" . $date_month . "-" . $date_year; if (!checkdate($date_month, $date_day, $date_year)) { $v->isOk($date, "num", 1, 1, "Invalid date."); } # display errors, if any if ($v->isError()) { $confirm = ""; $errors = $v->getErrors(); foreach ($errors as $e) { $confirm .= "<li class='err'>" . $e["msg"] . "</li>"; } return method($_POST, $confirm); } $rate += 0; if ($rate == 0) { $rate = 1; } # Get bank account name db_connect(); $sql = "SELECT * FROM bankacct WHERE bankid = '{$bankid}' AND div = '" . USER_DIV . "'"; $bankRslt = db_exec($sql); $bank = pg_fetch_array($bankRslt); # Supplier name $sql = "SELECT * FROM suppliers WHERE supid = '{$supid}' AND div = '" . USER_DIV . "'"; $supRslt = db_exec($sql); $sup = pg_fetch_array($supRslt); $currs = getSymbol($sup['fcid']); if ($bank['btype'] == 'int') { $bcur = $currs['symbol']; $amt = sprint($amt); $lamt = sprint($amt * $rate); } else { $lamt = sprint($amt); $amt = sprint($amt / $rate); $bcur = CUR; } $out = 0; $rate = sprint($rate); $confirm = "\n\t\t\t<h3>New International Bank Receipt</h3>\n\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<form action='" . SELF . "' method='POST'>\n\t\t\t\t<input type='hidden' name='key' value='confirm'>\n\t\t\t\t<input type='hidden' name='bankid' value='{$bankid}'>\n\t\t\t\t<input type='hidden' name='date' value='{$date}'>\n\t\t\t\t<input type='hidden' name='all' value='{$all}'>\n\t\t\t\t<input type='hidden' name='supid' value='{$supid}'>\n\t\t\t\t<input type='hidden' name='descript' value='{$descript}'>\n\t\t\t\t<input type='hidden' name='cheqnum' value='{$cheqnum}'>\n\t\t\t\t<input type='hidden' name='amt' value='{$amt}'>\n\t\t\t\t<input type='hidden' name='rate' value='{$rate}'>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Field</th>\n\t\t\t\t\t<th>Value</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Account</td>\n\t\t\t\t\t<td>{$bank['accname']} - {$bank['bankname']}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Date</td>\n\t\t\t\t\t<td valign='center'>{$date}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Paid To</td>\n\t\t\t\t\t<td valign='center'>({$sup['supno']}) {$sup['supname']}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Description</td>\n\t\t\t\t\t<td valign='center'>" . nl2br($descript) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Cheque Number</td>\n\t\t\t\t\t<td valign='center'>{$cheqnum}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Amount</td>\n\t\t\t\t\t<td valign='center'>{$sup['currency']} {$amt} | " . CUR . " {$lamt}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Exchange rate</td>\n\t\t\t\t\t<td valign='center'>" . CUR . " / {$sup['currency']} {$rate}</td>\n\t\t\t\t</tr>"; if ($all == 0) { $out = $amt; // Connect to database db_connect(); $sql = "SELECT purid as invid,intpurid as invid2,fbalance,pdate as odate FROM suppurch WHERE supid = '{$supid}' AND fbalance > 0 AND div = '" . USER_DIV . "' ORDER BY odate ASC"; $prnInvRslt = db_exec($sql) or errDie("unable to get invoices."); $i = 0; while ($inv = pg_fetch_array($prnInvRslt) and $out > 0) { //if ($inv['invid']==0) {continue;} if ($inv['invid2'] > 0) { $inv['invid'] = $inv['invid2']; } if ($i == 0) { $confirm .= "\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td colspan='2'><br></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td colspan='2'><h3>Outstanding Purchases</h3></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>Purchase</th>\n\t\t\t\t\t\t\t<th>Outstanding Amount</th>\n\t\t\t\t\t\t\t<th>Date</th>\n\t\t\t\t\t\t\t<th>Amount</th>\n\t\t\t\t\t\t</tr>"; } $invid = $inv['invid']; $confirm .= "\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td><input type='hidden' size='20' name='invids[]' value='{$inv['invid']}'>{$inv['invid']}</td>\n\t\t\t\t\t\t<td>{$sup['currency']} {$inv['fbalance']}</td>\n\t\t\t\t\t\t<td>{$inv['odate']}</td>"; if ($out >= $inv['fbalance']) { $val = $inv['fbalance']; $out = $out - $inv['fbalance']; } else { $val = $out; $out = 0; } $i++; $confirm .= "\n\t\t\t\t\t\t<td><input type='hidden' name='paidamt[{$invid}]' size='10' value='{$val}'>{$sup['currency']} {$val}</td>\n\t\t\t\t\t</tr>"; } if ($out > 0) { $confirm .= "\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td colspan='5'><b>A general transaction will debit the supplier's account with {$sup['currency']} {$out} </b></td>\n\t\t\t\t\t</tr>"; } } if ($all == 1) { $confirm .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t\t\t\t<tr><td><br></td></tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<th>Current</th>\n\t\t\t\t\t\t\t\t<th>30 days</th>\n\t\t\t\t\t\t\t\t<th>60 days</th>\n\t\t\t\t\t\t\t\t<th>90 days</th>\n\t\t\t\t\t\t\t\t<th>120 days</th>\n\t\t\t\t\t\t\t\t<th>Total Outstanding</th>\n\t\t\t\t\t\t\t</tr>"; $curr = sage($supid, 29); $age30 = sage($supid, 59); $age60 = sage($supid, 89); $age90 = sage($supid, 119); $age120 = sage($supid, 149); $supttot = $curr + $age30 + $age60 + $age90 + $age120; # Alternate bgcolor $confirm .= "\n\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t<td>{$sup['currency']} " . sprint($curr) . "</td>\n\t\t\t\t\t\t\t\t<td>{$sup['currency']} " . sprint($age30) . "</td>\n\t\t\t\t\t\t\t\t<td>{$sup['currency']} " . sprint($age60) . "</td>\n\t\t\t\t\t\t\t\t<td>{$sup['currency']} " . sprint($age90) . "</td>\n\t\t\t\t\t\t\t\t<td>{$sup['currency']} " . sprint($age120) . "</td>\n\t\t\t\t\t\t\t\t<td>{$sup['currency']} " . sprint($supttot) . "</td>\n\t\t\t\t\t\t\t</tr>"; $confirm .= "\n\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t<td><input type='text' size='7' name='out1'></td>\n\t\t\t\t\t\t\t\t<td><input type='text' size='7' name='out2'></td>\n\t\t\t\t\t\t\t\t<td><input type='text' size='7' name='out3'></td>\n\t\t\t\t\t\t\t\t<td><input type='text' size='7' name='out4'></td>\n\t\t\t\t\t\t\t\t<td><input type='text' size='7' name='out5'></td>\n\t\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t</tr>"; $confirm .= "\n\t\t\t\t\t\t\t<tr><td><br></td></tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>"; } if ($all == 2) { db_connect(); $sql = "SELECT purid as invid,intpurid as invid2,fbalance,pdate as odate FROM suppurch WHERE supid = '{$supid}' AND fbalance>0 AND div = '" . USER_DIV . "' ORDER BY odate ASC"; $prnInvRslt = db_exec($sql); if (pg_numrows($prnInvRslt) < 1) { return "The selected supplier has no outstanding purchases<br>\n\t\t\t\tTo make a payment in advance please select Auto Allocation"; } $i = 0; while ($inv = pg_fetch_array($prnInvRslt)) { if ($inv['invid'] == 0) { continue; } if ($inv['invid2'] > 0) { $inv['invid'] = $inv['invid2']; } if ($i == 0) { $confirm .= "\n\t\t\t\t\t\t<tr><td colspan='2'><br></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td colspan='2'><h3>Outstanding Purchases</h3></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>Purchase</th>\n\t\t\t\t\t\t\t<th>Outstanding Amount</th>\n\t\t\t\t\t\t\t<th>Date</th>\n\t\t\t\t\t\t\t<th>Amount</th>\n\t\t\t\t\t\t</tr>"; } $invid = $inv['invid']; $val = ''; if (pg_numrows($prnInvRslt) == 1) { $val = $amt; } $confirm .= "\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td><input type='hidden' size='20' name='invids[]' value='{$inv['invid']}'>{$inv['invid']}</td>\n\t\t\t\t\t\t<td>{$sup['currency']} {$inv['fbalance']}</td>\n\t\t\t\t\t\t<td>{$inv['odate']}</td>"; $i++; $confirm .= "\n\t\t\t\t\t\t<td><input type='text' name='paidamt[{$invid}]' size='10' value='{$val}'></td>\n\t\t\t\t\t</tr>"; } if ($out > 0) { $confirm .= "\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td colspan='5'><b>A general transaction will debit the supplier's account with {$sup['currency']} {$out} </b></td>\n\t\t\t\t\t</tr>"; } } $confirm .= "\n\t\t\t\t<input type='hidden' name='out' value='{$out}'>\n\t\t\t\t<tr>\n\t\t\t\t\t<td align='right'><input type='button' value='« Back' onClick='javascript:history.back()'></td>\n\t\t\t\t\t<td align='right'><input type='submit' value='Confirm »'></td>\n\t\t\t\t</tr>\n\t\t\t</form>\n\t\t\t</table>\n\t\t\t<p>\n\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Quick Links</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td><a href='bank-pay-supp.php'>Add supplier payment</a></td>\n\t\t\t\t</tr>\n\t\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t\t</table>"; return $confirm; }
function Admin_Botedit() { global $session; global $db_prefix; global $GlobalUser, $GlobalUni; // Обработка GET-запроса. if (method() === "GET") { if ($_GET['action'] === "preview") { // Предпросмотр $id = intval($_GET['strat']); $query = "SELECT * FROM " . $db_prefix . "botstrat WHERE id = {$id} LIMIT 1"; $result = dbquery($query); $row = dbarray($result); ob_clean(); ?> <html> <head> <link rel='stylesheet' type='text/css' href='css/default.css' /> <link rel='stylesheet' type='text/css' href='css/formate.css' /> <script language="JavaScript">var session="<?php echo $session; ?> ";</script> <meta http-equiv='content-type' content='text/html; charset=UTF-8' /> <link rel='stylesheet' type='text/css' href='css/combox.css'> <link rel='stylesheet' type='text/css' href='<?php echo UserSkin(); ?> formate.css' /> <title><?php echo $row['name']; ?> </title> <script src='js/utilities.js' type='text/javascript'></script> <script language='JavaScript'> </script> </head> <body> <script type="text/javascript" src="js/tw-sack.js"></script> <script type="text/javascript" src="js/go.js"></script> <script type="text/javascript" src="js/go-game.js"></script> <div id="sample"> <div style="width:100%; white-space:nowrap; display:none;"> <span style="display: inline-block; vertical-align: top; padding: 5px; width:100px"> <div id="myPalette" style="background-color: #344566; border: solid 1px black; height: 500px"></div> </span> <span style="display: inline-block; vertical-align: top; padding: 5px; width:88%"> <div id="myDiagram" style="background-color: #344566; border: solid 1px black; height: 500px"></div> </span> </div> <input type="text" size="50" id="strategyName" style="display:none;"> <select id="strategyId" style="display:none;"> <option value="<?php echo $row['id']; ?> " selected><?php echo $row['id']; ?> </option> </select> <textarea id="mySavedModel" style="width:100%;height:300px; display:none;"> <?php echo $row['source']; ?> </textarea> </div> <img src="" id="preview_img"> <script type="text/javascript"> init (); </script> </body> </html> <?php die; } } // Обработка POST-запроса. if (method() === "POST") { if ($_POST['action'] === "load") { // Загрузить $id = intval($_POST['strat']); $query = "SELECT * FROM " . $db_prefix . "botstrat WHERE id = {$id} LIMIT 1"; $result = dbquery($query); $row = dbarray($result); ob_clean(); setcookie("uni" . $GlobalUni['num'] . "_" . $GlobalUser['name'] . "_strategy", $id, 9999); die($row['source']); } else { if ($_POST['action'] === "save") { // Сохранить $id = intval($_POST['strat']); // Сохранить текущий исходник в бекап $query = "SELECT * FROM " . $db_prefix . "botstrat WHERE id = {$id} LIMIT 1"; $result = dbquery($query); $row = dbarray($result); $query = "UPDATE " . $db_prefix . "botstrat SET source = '" . $row['source'] . "' WHERE id = 1;"; dbquery($query); $source = urldecode($_POST['source']); $source = addslashes($source); $query = "UPDATE " . $db_prefix . "botstrat SET source = '" . $source . "' WHERE id = {$id};"; dbquery($query); ob_clean(); die; } else { if ($_POST['action'] === "new") { // Новая стратегия $name = $_POST['name']; $name = addslashes($name); $source = "{ \"class\": \"go.GraphLinksModel\",\r\n \"linkFromPortIdProperty\": \"fromPort\",\r\n \"linkToPortIdProperty\": \"toPort\",\r\n \"nodeDataArray\": [ ],\r\n \"linkDataArray\": [ ]}"; $strat = array('', $name, $source); AddDBRow($strat, 'botstrat'); ob_clean(); die; } else { if ($_POST['action'] === "rename") { // Переименовать $id = intval($_POST['strat']); $name = $_POST['name']; $name = addslashes($name); $query = "UPDATE " . $db_prefix . "botstrat SET name = '" . $name . "' WHERE id = {$id};"; dbquery($query); ob_clean(); $query = "SELECT * FROM " . $db_prefix . "botstrat ORDER BY id ASC"; $result = dbquery($query); echo "<option value=\"0\">-- Выберите стратегию --</option>\n"; while ($row = dbarray($result)) { echo "<option value=\"" . $row['id'] . "\" "; if ($row['id'] == $id) { echo "selected"; } echo ">" . stripslashes($row['name']) . "</option>\n"; } die; } else { ob_clean(); die; } } } } } ?> <script type="text/javascript" src="js/tw-sack.js"></script> <script type="text/javascript" src="js/go.js"></script> <script type="text/javascript" src="js/go-game.js"></script> <?php echo AdminPanel(); ?> <div id="sample"> <div style="width:100%; white-space:nowrap;"> <span style="display: inline-block; vertical-align: top; padding: 5px; width:100px"> <div id="myPalette" style="background-color: #344566; border: solid 1px black; height: 500px"></div> </span> <span style="display: inline-block; vertical-align: top; padding: 5px; width:88%"> <div id="myDiagram" style="background-color: #344566; border: solid 1px black; height: 500px"></div> </span> </div> <span style="float:left;"> <input type="text" size="50" id="strategyName"> <button onclick="newstrat()">Новая</button> <button onclick="rename()">Переименовать</button> <button onclick="showimg()">Показать</button> </span> <span style="float:right;"> <button onclick="save()">Сохранить</button> <select id="strategyId"> <option value="0">-- Выберите стратегию --</option> <?php $query = "SELECT * FROM " . $db_prefix . "botstrat ORDER BY id ASC"; $result = dbquery($query); while ($row = dbarray($result)) { echo "<option value=\"" . $row['id'] . "\">" . stripslashes($row['name']) . "</option>\n"; } ?> </select> <button onclick="load()">Загрузить</button> </span> <textarea id="mySavedModel" style="width:100%;height:300px; display:none;"> { "class": "go.GraphLinksModel", "linkFromPortIdProperty": "fromPort", "linkToPortIdProperty": "toPort", "nodeDataArray": [ ], "linkDataArray": [ ]} </textarea> </div> <script type="text/javascript"> init (); </script> <img src="" id="preview_img" style="display:none;"> <?php }
function Admin_Debug() { global $session; global $db_prefix; global $GlobalUser; $message_limit = 50; if (key_exists('filter', $_REQUEST)) { $filter = $_REQUEST['filter']; } else { $filter = ""; } if (method() === "POST" && $filter === "") { if ($_POST['deletemessages'] === "deleteall") { $query = "TRUNCATE TABLE " . $db_prefix . "debug;"; dbquery($query); } else { $query = "SELECT * FROM " . $db_prefix . "debug ORDER BY date DESC, error_id DESC LIMIT " . $message_limit; $result = dbquery($query); $rows = dbrows($result); while ($rows--) { $msg = dbarray($result); if (key_exists("delmes" . $msg['error_id'], $_POST) || $_POST['deletemessages'] === "deleteshown") { $query = "DELETE FROM " . $db_prefix . "debug WHERE error_id = " . $msg['error_id']; dbquery($query); } } } } if ($filter === "") { $query = "SELECT * FROM " . $db_prefix . "debug ORDER BY date DESC, error_id DESC LIMIT " . $message_limit; } else { $query = "SELECT * FROM " . $db_prefix . "debug WHERE text LIKE '%" . $filter . "%' ORDER BY date DESC, error_id DESC LIMIT " . $message_limit; } $result = dbquery($query); ?> <?php echo AdminPanel(); ?> <table class='header'><tr class='header'><td><table width="519"> <form action="index.php?page=admin&session=<?php echo $session; ?> &mode=Debug" method="POST"> <tr><td colspan="4" class="c">Сообщения</td></tr> <tr><th>Действие</th><th>Дата</th><th>От</th><th>Браузер</th></tr> <?php $rows = dbrows($result); while ($rows--) { $msg = dbarray($result); $user = LoadUser($msg['owner_id']); $from = "<a href=\"index.php?page=admin&session={$session}&mode=Users&player_id=" . $msg['owner_id'] . "\">" . $user['oname'] . "</a> [" . $msg['ip'] . "]"; $msg['text'] = str_replace("{PUBLIC_SESSION}", $session, $msg['text']); echo "<tr><th><input type=\"checkbox\" name=\"delmes" . $msg['error_id'] . "\"/></th><th>" . date("m-d H:i:s", $msg['date']) . "</th><th>{$from} </th><th>" . $msg['agent'] . " </th></tr>\n"; echo "<tr><td class=\"b\"> </td><td class=\"b\" colspan=\"3\">" . $msg['text'] . "</td></tr>\n"; } ?> <tr><td class="b"> </td><td class="b" colspan="3"></td></tr> <tr><th colspan="4" style='padding:0px 105px;'></th></tr> <tr> <th colspan="4"> <select name="deletemessages"> <option value="deletemarked">Удалить выделенные сообщения</option> <option value="deleteshown">Удалить показанные сообщения</option> <option value="deleteall">Удалить все сообщения</option> </select><input type="submit" value="ok" /></th></tr> <tr><td colspan="4"><center> </center></td></tr> <tr><th colspan="4">Фильтр отладочных сообщений: <input type=text name="filter" /> <input type=submit value="Показать"></th></tr> </form> </table> <?php }
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") { DeleteAllMessages($player_id); } else { $result = EnumMessages($GlobalUser['player_id'], $MAXMSG); $num = dbrows($result); while ($num--) { $msg = dbarray($result); $msg_id = $msg['msg_id']; if ($_POST["sneak" . $msg_id] === "on") { } // Сообщить оператору if ($_POST["delmes" . $msg_id] === "on" && $_POST['deletemessages'] === "deletemarked") { DeleteMessage($player_id, $msg_id);
} ?> <tr> <th colspan=2><input type="submit" value="<?php echo loca("OPTIONS_APPLY"); ?> " /></th> </tr> </form> </table> <?php // ====================================================================================== // Обычное меню. } else { // Обработать POST-запрос. if (method() === "POST" && !key_exists('urlaub_aus', $_POST)) { if ($GlobalUser['name_changed'] == 0 && $_POST['db_character'] !== $GlobalUser['oname']) { // Сменить имя. $forbidden = explode(",", "hitler, fick, adolf, legor, aleena, ogame, mainman, fishware, osama, bin laden, stalin, goebbels, drecksjude, saddam, space, ringkeeper, administration"); if (IsUserExist($_POST['db_character'])) { $OptionsError = loca("OPTIONS_ERR_EXISTNAME"); } else { if (!CanChangeName($GlobalUser['player_id'])) { $OptionsError = loca("OPTIONS_ERR_NAME_WEEK"); } else { if (mb_strlen($_POST['db_character']) < 3 || mb_strlen($_POST['db_character']) > 20) { $OptionsError = loca("OPTIONS_ERR_NAME_3_20"); } else { if (preg_match('/[<>()\\[\\]{}\\\\\\/\\`\\"\'.,:;*+]/', $_POST['db_character'])) { $OptionsError = loca("OPTIONS_ERR_NAME_SPECIAL"); }