echo '<b>Troop movements started!</b>'; } if (!$tocity) { echo '<h2>Select a City to Attack/Move to</h2><ul>'; if ($fromcity) { $close_upper_bound = intval($fromcity->getValue('id')) + 25000; $dbcities = mysql_query("SELECT user_id,city_id FROM server_cities WHERE server_id=" . $server->getID() . " AND city_id < {$close_upper_bound} ORDER BY city_id DESC LIMIT 50", $db) or die(mysql_error()); } else { $dbcities = mysql_query("SELECT user_id,city_id FROM server_cities WHERE server_id=" . $server->getID() . " ORDER BY user_id LIMIT 50", $db) or die(mysql_error()); } //end if-else fromcity while ($city = mysql_fetch_assoc($dbcities)) { $user = new user($city['user_id'], $server); $city = new city($city['city_id']); echo '<li>'; echo '<a href="/server/' . $server->getID() . '/attack/' . $city->getValue('id') . '+' . $cities[1] . '">'; if ($city->getValue('name')) { echo htmlentities($city->getValue('name')) . ' / '; } echo 'Location: ' . str_pad($city->getValue('id'), 6, '0', STR_PAD_LEFT); echo '</a>'; echo ' / Population: ' . $city->getValue('population') . ' / Defense: ' . (intval($city->getValue('defense')) + 1) . ' / User: <a href="/server/' . $server->getID() . '/user/' . $user->getValue('userid') . '">' . htmlentities($user->getValue('nickname')) . '</a>'; $can_access = $city->getValue('user_' . $LOGIN_DATA['user_id'] . '_access'); $can_access = $can_access === true || intval($can_access) > time(); if ($can_access) { echo ' - <a href="/server/' . $server->getID() . '/city/' . $city->getValue('id') . '">view</a>'; } echo '</li>'; } //end while cities echo '</ul>';
$data = trim(preg_replace('/^near[\\s]+/i', '', $data)); if (!$data || $data == 'cities') { $reply = 'On ' . $server->getName() . ' your cities : '; foreach ($user->getValue('cities') as $city) { $reply .= $city->getValue('name') . '@' . $city->getValue('id') . ' '; } } else { if ($mod == 'near') { foreach ($user->getValue('cities') as $city) { if ($city->getValue('id') == $data || @preg_match('/^' . $data . '$/i', $city->getValue('name'))) { $close_upper_bound = intval($city->getValue('id')) + 30000; $dbcities = mysql_query("SELECT city_id FROM server_cities WHERE server_id=" . $server->getID() . " AND city_id < {$close_upper_bound} ORDER BY city_id DESC LIMIT 10", $db) or die(mysql_error()); $reply = 'On ' . $server->getName() . ' near ' . $city->getValue('name') . '@' . $city->getValue('id') . ' : '; while ($icity = mysql_fetch_assoc($dbcities)) { $cityo = new city($icity['city_id']); $reply .= $cityo->getValue('name') . '@' . $cityo->getValue('id') . ' '; } break; } } } else { foreach ($user->getValue('cities') as $city) { if ($city->getValue('id') == $data || @preg_match('/^' . $data . '$/i', $city->getValue('name'))) { $reply = $city->getValue('name') . '@' . $city->getValue('id') . ' Population: ' . $city->getValue('population') . ' / Defense: ' . ($city->getValue('defense') + 1) . ' / Units: ' . $city->unit_count(); break; } } //end foreach } } break;
require_once dirname(__FILE__) . '/include/processCookie.php'; require_once dirname(__FILE__) . '/include/cron.php'; require_once dirname(__FILE__) . '/include/connectDB.php'; require_once dirname(__FILE__) . '/include/user.php'; require_once dirname(__FILE__) . '/include/server.php'; require_once dirname(__FILE__) . '/include/city.php'; if (!$server) { $server = new server($_REQUEST['server_id']); } if (!$current_user) { $current_user = new user($LOGIN_DATA['user_id'], $server); } ?> <h3>Troop Movements</h3> <ul> <?php $transactions = mysql_query("SELECT unit_count,eta,destination,user_id FROM server_unit_transaction WHERE server_id=" . $server->getID() . " AND user_id=" . $current_user->getValue('userid') . " ORDER BY eta ASC", $db) or die(mysql_query()); while ($transaction = mysql_fetch_assoc($transactions)) { $city = new city($transaction['destination']); $dest = $city->getValue('name') ? htmlentities($city->getValue('name')) : 'City at ' . str_pad($city->getValue('id'), 6, '0', STR_PAD_LEFT); $is_attack = $city->getValue('user')->getValue('userid') != $transaction['user_id']; $time_left = round(($transaction['eta'] - time()) / 60, 2); if ($time_left > 0) { echo "\t\t\t" . '<li>' . ($is_attack ? 'Attacking ' : 'Moving to ') . $dest . ' with ' . $transaction['unit_count'] . ' troops in ' . $time_left . ' minutes </li>' . "\n"; } } //end while unit ?> </ul>
$xhtmlSite->metaType(); ?> <link rel="stylesheet" href="/styles/main.css" type="text/css" media="screen" /> <link rel="shortcut icon" href="/favicon.ico" /> </head> <body> <?php require dirname(__FILE__) . '/include/visible_header.php'; echo '<h3>Recent Attacks</h3><ol style="list-style-type:none;padding:0px;">'; $attacks = mysql_query("SELECT destination,user_id,results,time FROM server_attack_results WHERE server_id=" . $server->getID() . " ORDER BY time DESC LIMIT 50", $db) or die(mysql_error()); while ($attack = mysql_fetch_assoc($attacks)) { $user = new user($attack['user_id'], $server); $dest = new city($attack['destination']); $class = $attack['results'] < 0 ? 'won' : 'lost'; echo '<li class="' . $class . '">'; echo ceil((time() - $attack['time']) / 60) . ' minutes ago: '; echo '<a href="/server/' . $server->getID() . '/user/' . $user->getValue('userid') . '">' . ($user->getValue('nickname') ? htmlentities($user->getValue('nickname')) : 'User #' . $user->getValue('userid')) . '</a>'; echo ' attacked '; echo $dest->getValue('name') . ' (Location: ' . $dest->getValue('id') . ')'; echo ' and '; echo $class; echo ' by ' . abs($attack['results']); echo '</li>'; } //end while attacks echo '</ol>'; ?> </body> </html>
<?php require_once dirname(__FILE__) . '/include/city.php'; require_once dirname(__FILE__) . '/include/processCookie.php'; require_once dirname(__FILE__) . '/include/connectDB.php'; if (!$LOGIN_DATA['user_id']) { die('Please log in.'); } if (!$this_city) { $this_city = new city($_REQUEST['city_id']); } if (!$can_access) { $can_access = $this_city->getValue('user_' . $LOGIN_DATA['user_id'] . '_access'); if ($can_access !== true && intval($can_access) > time()) { $can_access_time = ceil(($can_access - time()) / 60); } $can_access = $can_access === true || intval($can_access) > time(); } //end if ! can_access if (!$can_edit) { $can_edit = $this_city->getValue('user_' . $LOGIN_DATA['user_id'] . '_edit'); $can_edit = $can_edit === true || intval($can_edit) > time(); if ($can_edit !== true && intval($can_edit) > time()) { $can_edit_time = ceil(($can_edit - time()) / 60); } } //if ! can edit if (!$server) { $server = new server($_REQUEST['server_id']); } echo '<h3>';
<?php require_once dirname(__FILE__) . '/include/city.php'; if (isset($_REQUEST['ajax'])) { require_once dirname(__FILE__) . '/include/processCookie.php'; } else { require_once dirname(__FILE__) . '/include/invisible_header.php'; } if (!$LOGIN_DATA['user_id']) { die('<head><title>Please Log in</title></head><body><h2>Please log in.</h2></body></html>'); } $this_city = new city($_REQUEST['city_id']); $is_owner = $LOGIN_DATA['user_id'] == $this_city->getValue('user')->getValue('userid'); $can_edit = $this_city->getValue('user_' . $LOGIN_DATA['user_id'] . '_edit'); $can_edit = $can_edit === true || intval($can_edit) > time(); if ($can_edit !== true && intval($can_edit) > time()) { $can_edit_time = ceil(($can_edit - time()) / 60); } $can_access = $this_city->getValue('user_' . $LOGIN_DATA['user_id'] . '_access'); if ($can_access !== true && intval($can_access) > time()) { $can_access_time = ceil(($can_access - time()) / 60); } $can_access = $can_access === true || intval($can_access) > time(); //if(!$can_access) die('<head><title>Cannot View City</title></head><body><h2>You cannot view this city.</h2></body></html>'); $server = new server($_REQUEST['server_id']); if ($can_edit && $_POST['building_id']) { $message = $this_city->build(intval($_POST['building_id'])); if ($message) { $message = '<b style="padding:3px;border:1px solid red;display:block;"><img src="/images/error.png" alt="" /> ' . htmlentities($message) . '</b>'; } else { $message = '<div style="padding:3px;border:1px solid #ccc;display:block;"><img src="/images/information.png" alt="" /> Building started.</div>';
<?php require_once dirname(__FILE__) . '/include/city.php'; require_once dirname(__FILE__) . '/include/processCookie.php'; require_once dirname(__FILE__) . '/include/connectDB.php'; if (!$LOGIN_DATA['user_id']) { die('Please log in.'); } if (!$this_city) { $this_city = new city($_REQUEST['city_id']); } if (!$can_access) { $can_access = $this_city->getValue('user_' . $LOGIN_DATA['user_id'] . '_access'); if ($can_access !== true && intval($can_access) > time()) { $can_access_time = ceil(($can_access - time()) / 60); } $can_access = $can_access === true || intval($can_access) > time(); } //end if ! can_access if ($can_access) { if (!$server) { $server = new server($_REQUEST['server_id']); } $units = mysql_query("SELECT unit_id,name,description,cost FROM units WHERE server_id=" . $server->getID(), $db) or die(mysql_query()); while ($unit = mysql_fetch_assoc($units)) { $unit_options .= "\t\t\t" . '<option value="' . $unit['unit_id'] . '">' . htmlentities($unit['name']) . ' (' . $unit['cost'] . ' Gold)</option>' . "\n"; $unit_list .= "\t\t\t<li>"; $unit_list .= htmlentities($unit['name']); $unit_list .= ' (' . intval($this_city->getValue('unit_' . $unit['unit_id'])) . ')'; if ($unit['description']) { $unit_list .= ' - ' . htmlentities($unit['description']);
<?php require_once dirname(__FILE__) . '/include/city.php'; require_once dirname(__FILE__) . '/include/processCookie.php'; require_once dirname(__FILE__) . '/include/connectDB.php'; if (!$LOGIN_DATA['user_id']) { die('Please log in.'); } if (!$this_city) { $this_city = new city($_REQUEST['city_id']); } if (!$can_access) { $can_access = $this_city->getValue('user_' . $LOGIN_DATA['user_id'] . '_access'); if ($can_access !== true && intval($can_access) > time()) { $can_access_time = ceil(($can_access - time()) / 60); } $can_access = $can_access === true || intval($can_access) > time(); } //end if ! can_access if ($can_access) { if (!$server) { $server = new server($_REQUEST['server_id']); } $buildings = mysql_query("SELECT building_id,name,description,cost FROM buildings WHERE server_id=" . $server->getID(), $db) or die(mysql_query()); while ($building = mysql_fetch_assoc($buildings)) { $building_list .= "\t\t\t" . '<li>'; $building_list .= htmlentities($building['name']); $building_list .= ' (' . intval($this_city->getValue($building['building_id'])) . ')'; if ($building['description']) { $building_list .= ' - ' . htmlentities($building['description']); }
<?php require_once dirname(__FILE__) . '/include/city.php'; require_once dirname(__FILE__) . '/include/processCookie.php'; require_once dirname(__FILE__) . '/include/cron.php'; if (!$LOGIN_DATA['user_id']) { die('<head><title>Please Log in</title></head><body><h2>Please log in.</h2></body></html>'); } if (!$this_city) { $this_city = new city($_REQUEST['city_id']); } $is_owner = $LOGIN_DATA['user_id'] == $this_city->getValue('user')->getValue('userid'); $can_edit = $this_city->getValue('user_' . $LOGIN_DATA['user_id'] . '_edit'); $can_edit = $can_edit === true || intval($can_edit) > time(); if ($can_edit !== true && intval($can_edit) > time()) { $can_edit_time = ceil(($can_edit - time()) / 60); } $can_access = $this_city->getValue('user_' . $LOGIN_DATA['user_id'] . '_access'); if ($can_access !== true && intval($can_access) > time()) { $can_access_time = ceil(($can_access - time()) / 60); } $can_access = $can_access === true || intval($can_access) > time(); if ($can_access) { if (!$server) { $server = new server($_REQUEST['server_id']); } $units = mysql_query("SELECT unit_id,name,cost FROM units WHERE server_id=" . $server->getID(), $db) or die(mysql_query()); while ($unit = mysql_fetch_assoc($units)) { $transactions = mysql_query("SELECT unit_count,eta FROM server_unit_transaction WHERE server_id=" . $server->getID() . " AND unit_id=" . $unit['unit_id'] . " AND user_id=" . $this_city->getValue('user')->getValue('userid') . " AND destination=" . $this_city->getValue('id') . " ORDER BY eta DESC", $db) or die(mysql_query()); while ($transaction = mysql_fetch_assoc($transactions)) { $time_left = round(($transaction['eta'] - time()) / 60, 2);
} $_REQUEST['user_id'] = intval($_REQUEST['user_id']); $_REQUEST['server_id'] = intval($_REQUEST['server_id']); if (!$server && $_REQUEST['server_id']) { $server = new server($_REQUEST['server_id']); } if ($_REQUEST['format'] == 'rss') { echo '<?xml version="1.0" encoding="utf-8" ?>' . "\n"; echo '<rss version="2.0">' . "\n"; echo '</rss>'; } else { echo '<h3>Recent Attacks</h3><ul>'; $attacks = mysql_query("SELECT destination,results,time FROM server_attack_results WHERE user_id=" . $_REQUEST['user_id'] . ($server ? " AND server_id=" . $server->getID() : '') . " ORDER BY time DESC LIMIT 5", $db) or die(mysql_error()); while ($attack = mysql_fetch_assoc($attacks)) { $dest = new city($attack['destination']); $class = $attack['results'] < 0 ? 'won' : 'lost'; echo '<li class="' . $class . '">'; echo ceil((time() - $attack['time']) / 60) . ' minutes ago: '; echo ' You attacked '; echo '<a href="/server/' . $dest->getValue('server')->getID() . '/city/' . $dest->getValue('id') . '">'; echo $dest->getValue('name') . ' (Location: ' . $dest->getValue('id') . ')'; echo '</a>'; echo ' and '; echo $class; echo ' by ' . abs($attack['results']); echo '</li>'; } //end while attacks echo '</ul>'; echo '<a href="/server/' . $server->getID() . '/attacks">View all recent attacks »</a>'; }