Exemple #1
0
require 'game-main-functions.php';
error_log($_GET['fn']);
if ($_GET['fn'] === "get_players") {
    header('Content-Type: application/json');
    echo json_encode(get_players());
} else {
    if ($_GET['fn'] === "get_active_player") {
        echo get_active_player();
    } else {
        if ($_GET['fn'] === "get_player_positions") {
            header('Content-Type: application/json');
            echo json_encode(get_player_positions());
        } else {
            if ($_GET['fn'] === "update_player") {
                update_player($_GET['username'], $_GET['x'], $_GET['y']);
            } else {
                if ($_GET['fn'] === "make_suggestion") {
                    header('Content-Type: application/json');
                    echo json_encode(make_suggestion($_GET['username'], $_GET['wep'], $_GET['loc'], $_GET['char']));
                } else {
                    if ($_GET['fn'] === "get_suggestions") {
                        header('Content-Type: application/json');
                        echo json_encode(get_suggestions($_GET['username']));
                    } else {
                        if ($_GET['fn'] === "show_card") {
                            header('Content-Type: application/json');
                            echo show_card($_GET['username'], $_GET['player'], $_GET['card']);
                        } else {
                            if ($_GET['fn'] === "check_for_answer") {
                                header('Content-Type: application/json');
Exemple #2
0
        break;
    case 2:
        // Search Players
        check_admin_authorization();
        $body = new Template("templates/player/player.searchresults.tmpl.php");
        if (isset($_POST['playerid']) && $_POST['playerid'] != "Player ID") {
            $results = search_players_by_id();
        } else {
            $results = search_players_by_name();
        }
        $body->set("results", $results);
        break;
    case 3:
        // Update Player
        check_admin_authorization();
        update_player();
        header("Location: index.php?editor=player&playerid={$playerid}");
        exit;
    case 4:
        // Delete Player
        check_admin_authorization();
        delete_player($playerid);
        if (isset($_GET['acctid'])) {
            header("Location: index.php?editor=account&acctid={$acctid}");
        } else {
            header("Location: index.php?editor=player");
        }
        exit;
}
function get_players($page_number, $results_per_page, $sort_by)
{
        if ($db->next_record()) {
            $db->query('UPDATE alliance_vs_alliance SET kills=kills+' . $fleets[0][0] . ' WHERE alliance_id_1=' . $player->alliance_id . ' AND alliance_id_2=' . $players[$var['target']][ALLIANCE_ID] . ' AND game_id=' . SmrSession::$game_id . ' LIMIT 1');
        } else {
            $db->query('INSERT INTO alliance_vs_alliance VALUES (' . SmrSession::$game_id . ',' . $player->alliance_id . ',' . $players[$var['target']][ALLIANCE_ID] . ',' . $fleets[0][0] . ')');
        }
        $db->query('SELECT kills FROM alliance_vs_alliance WHERE alliance_id_1=' . $players[$var['target']][ALLIANCE_ID] . ' AND alliance_id_2=' . $player->alliance_id . ' AND game_id=' . SmrSession::$game_id);
        if ($db->next_record()) {
            $db->query('UPDATE alliance_vs_alliance SET kills=kills+' . $fleets[1][0] . ' WHERE alliance_id_1=' . $players[$var['target']][ALLIANCE_ID] . ' AND alliance_id_2=' . $player->alliance_id . ' AND game_id=' . SmrSession::$game_id . ' LIMIT 1');
        } else {
            $db->query('INSERT INTO alliance_vs_alliance VALUES (' . SmrSession::$game_id . ',' . $players[$var['target']][ALLIANCE_ID] . ',' . $player->alliance_id . ',' . $fleets[1][0] . ')');
        }
    }
}
$account_ids = array_keys($players);
foreach ($account_ids as $account_id) {
    update_player($players, $account_id, $hqs, $ships);
    update_player_stats($players, $account_id, $ships);
}
$db->query('UPDATE sector SET battles=battles+1 WHERE sector_id=' . $player->sector_id . ' AND game_id=' . SmrSession::$game_id . ' LIMIT 1');
$db->query('INSERT INTO combat_logs VALUES("",' . SmrSession::$game_id . ',"PLAYER",' . $player->sector_id . ',' . time() . ',' . SmrSession::$old_account_id . ',' . $player->alliance_id . ',' . $var['target'] . ',' . $players[$var['target']][ALLIANCE_ID] . ',"' . mysql_real_escape_string(gzcompress($results)) . '", "FALSE")');
$container = array();
$container["url"] = "skeleton.php";
$container["body"] = "trader_attack_new.php";
// If their target is dead there is no continue attack button
if (!$players[$var["target"]][KILLER]) {
    $container["target"] = $var["target"];
} else {
    $container["target"] = 0;
}
// If they died on the shot they get to see the results
if ($players[$player->account_id][KILLER]) {