Esempio n. 1
0
 $node->checkAll(time());
 switch ($_GET['action']) {
     case 'add':
         if ($flags['combat']) {
             if (isset($_POST['name'], $_POST['attackerGroupUnitIds'], $_POST['attackerGroups'])) {
                 foreach ($_POST as $key => $value) {
                     if (!in_array($key, array('name', 'attackerGroupUnitIds', 'attackerGroups', 'attackerFocus'))) {
                         $_POST[$key] = misc::clean($value, 'numeric');
                     } else {
                         if (!in_array($key, array('name', 'attackerFocus'))) {
                             $nr = count($_POST[$key]);
                             for ($i = 0; $i < $nr; $i++) {
                                 $_POST[$key][$i] = misc::clean($_POST[$key][$i], 'numeric');
                             }
                         } else {
                             $_POST[$key] = misc::clean($value);
                         }
                     }
                 }
                 $target = new node();
                 if ($target->get('name', $_POST['name']) == 'done') {
                     $targetUser = new user();
                     if ($targetUser->get('id', $target->data['user']) == 'done') {
                         $alliance = new alliance();
                         $targetAlliance = new alliance();
                         if ($targetAlliance->get('id', $targetUser->data['alliance']) == 'done' && $alliance->get('id', $_SESSION[$shortTitle . 'User']['alliance']) == 'done') {
                             $war = $alliance->getWar($targetAlliance->data['id']);
                             if (isset($war['type'])) {
                                 $gotStatic = false;
                                 $data = array();
                                 $data['input']['attacker']['focus'] = $_POST['attackerFocus'];
Esempio n. 2
0
<?php

include 'core/config.php';
include 'core/core.php';
include 'core/game.php';
include 'locales/' . $_SESSION[$shortTitle . 'User']['locale'] . '/gl.php';
$db->query('start transaction');
if (isset($_SESSION[$shortTitle . 'User']['id'], $_GET['action'])) {
    foreach ($_POST as $key => $value) {
        $_POST[$key] = misc::clean($value);
    }
    foreach ($_GET as $key => $value) {
        $_GET[$key] = misc::clean($value);
    }
    $alliance = new alliance();
    $status = $alliance->get('id', $_SESSION[$shortTitle . 'User']['alliance']);
    switch ($_GET['action']) {
        case 'get':
            if ($_SESSION[$shortTitle . 'User']['alliance']) {
                if ($status == 'done') {
                    $alliance->getAll();
                } else {
                    $message = $ui[$status];
                }
            } else {
                $invitations = alliance::getInvitations('user', $_SESSION[$shortTitle . 'User']['id']);
            }
            break;
        case 'set':
            $nodes = node::getList($_SESSION[$shortTitle . 'User']['id']);
            $nodeList = '';
Esempio n. 3
0
     $_POST[$key] = misc::clean($value);
 }
 switch ($_GET['action']) {
     case 'login':
         if (isset($_POST['name'], $_POST['password'])) {
             $name = $_POST['name'];
             $pass = sha1($_POST['password']);
             if (isset($_POST['remember'])) {
                 $remember = 1;
             } else {
                 $remember = 0;
             }
         } else {
             if (isset($_COOKIE[$shortTitle . 'Name'], $_COOKIE[$shortTitle . 'Password'])) {
                 $name = misc::clean($_COOKIE[$shortTitle . 'Name']);
                 $pass = misc::clean($_COOKIE[$shortTitle . 'Password']);
                 $remember = 1;
             }
         }
         if (isset($name, $pass)) {
             $user = new user();
             $status = $user->get('name', $name);
             if ($status == 'done') {
                 if ($flags['login'] || $user->data['level'] == 3) {
                     if ($user->data['password'] == $pass) {
                         if ($user->data['level']) {
                             $user->data['ip'] = $_SERVER['REMOTE_ADDR'];
                             $user->data['lastVisit'] = strftime('%Y-%m-%d %H:%M:%S', time());
                             $user->set();
                             $_SESSION[$shortTitle . 'User'] = $user->data;
                             if ($remember) {
Esempio n. 4
0
<?php

include 'core/config.php';
include 'core/core.php';
$db->query('start transaction');
if (isset($_POST['x'], $_POST['y'])) {
    $x = misc::clean($_POST['x']);
    $y = misc::clean($_POST['y']);
} else {
    $x = rand(0, 49);
    $y = rand(0, 49);
}
$grid = new grid();
$grid->get($x, $y);
if (isset($status) && $status == 'error') {
    $db->query('rollback');
} else {
    $db->query('commit');
}
include 'templates/' . $_SESSION[$shortTitle . 'User']['template'] . '/getGrid.php';
Esempio n. 5
0
<?php

include 'core/config.php';
include 'core/core.php';
$db->query('start transaction');
if (isset($_GET['x'], $_GET['y'])) {
    $x = misc::clean($_GET['x'], 'numeric');
    $y = misc::clean($_GET['y'], 'numeric');
    $vars = 'x=' . $x . '&y=' . $y;
}
$grid = new grid();
$grid->getAll();
if (isset($status) && $status == 'error') {
    $db->query('rollback');
} else {
    $db->query('commit');
}
include 'templates/' . $_SESSION[$shortTitle . 'User']['template'] . '/grid.php';