if ($player->is_fed_protected()) {
    create_error("You are under federal protection! That wouldn't be fair.");
}
if (!$sector->has_port()) {
    create_error("There is no port in that sector!");
}
// check if he got enough turns
if ($player->get_info('turns') < 3) {
    create_error("You do not have enough turns to attack this port!");
}
$db->query("SELECT * FROM ship_has_weapon NATURAL JOIN weapon_type " . "WHERE account_id = {$player->account_id} AND " . "game_id = {$player->game_id} " . "ORDER BY order_id");
if (!$db->next_record()) {
    //do we have drones to attack?
    $db->query("SELECT * FROM ship_has_hardware WHERE hardware_type_id = HARDWARE_COMBAT AND account_id = {$player->account_id} AND game_id = {$player->game_id}");
    if (!$db->next_record()) {
        create_error("What are you gonna do? Insult it to death?");
    }
}
//set the attack start time
$time = time();
//only 1 shot per 2 seconds (stop double port raids)
$db->lock("port_attack_times");
//init vars
$db->query("SELECT * FROM port_attack_times WHERE game_id = {$player->game_id} AND sector_id = {$player->sector_id}");
if ($db->next_record()) {
    $att_time = $db->f("time");
} else {
    $att_time = 0;
}
while ($att_time + 2 >= $time) {
    usleep(50000);
Beispiel #2
0
<?php

if ($account->isVeteran()) {
    create_error('You cannot join a newbie game, shooo!');
}
require_once ENGINE . 'Default/game_join.php';
//(22,25,23,75,43,55,61,24,21,38,67,33,49)
// Top racials minus ATM + top UG/FED are restricted
if ($newShip['AlignRestriction'] == 2 && $player->getAlignment() > -100) {
    create_error('You can\'t buy smuggler ships!');
}
if ($newShip['AlignRestriction'] == 1 && $player->getAlignment() < 100) {
    create_error('You can\'t buy federal ships!');
}
if ($newShip['RaceID'] != 1 && $player->getRaceID() != $newShip['RaceID']) {
    create_error('You can\'t buy other race\'s ships!');
}
/*if ($player->getAccountID() == 101)
	create_error('Cheaters do NOT get ships!');*/
// do we have enough cash?
if ($player->getCredits() < $cost) {
    create_error('You do not have enough cash to purchase this ship!');
}
// adapt turns
$player->setTurns(round($player->getTurns() * $newShip['Speed'] / $ship->getSpeed()));
//Don't times by game speed as getSpeed doesn't include it meaning ratio will be the same but less work.
// take the money from the user
if ($cost > 0) {
    $player->decreaseCredits($cost);
} else {
    $player->increaseCredits(-$cost);
}
// assign the new ship
$ship->decloak();
$ship->disableIllusion();
$ship->setShipTypeID($shipID);
// update again
        }
        // now transfer
        $planet->shields += $amount;
        $ship->hardware[1] -= $amount;
        $account->log(11, "Player puts {$amount} shields on planet.", $player->sector_id);
        // do the user wants to transfer drones?
    } else {
        if ($type_id == 4) {
            // do we want transfer more than we have?
            if ($amount > $ship->hardware[4]) {
                create_error("You can't transfer more combat drones than you carry!");
            }
            // do we want to transfer more than we can carry?
            if ($amount + $planet->drones > $planet->construction[2] * 20) {
                create_error("The planet can't hold more than " . $planet->construction[2] * 20 . " drones!");
            }
            // now transfer
            $planet->drones += $amount;
            $ship->hardware[4] -= $amount;
            $account->log(11, "Player puts {$amount} drones on planet.", $player->sector_id);
        }
    }
} else {
    create_error("You must choose if you want to transfer to planet or to the ship!");
}
$ship->mark_seen();
// update both
$planet->update();
$ship->update_hardware();
$ship->mark_seen();
forward(create_container("skeleton.php", "planet_defense.php"));
    }
} else {
    create_error($access_token, 'PHP', 'init_user.php', 'No user found.', $db);
    die('No user found.');
}
$result_token = mysql_query("select * from access_token where token = '" . $keyTok . "'", $db);
$row_token = mysql_fetch_array($result_token, MYSQL_ASSOC);
if ($row_user['password'] == $password) {
    $row_array['accessTok'] = $row_token['token'];
    $row_array['username'] = $row_user['username'];
    $row_array['email'] = $row_user['email'];
} else {
    create_error($access_token, 'PHP', 'init_user.php', 'Wrong password!', $db);
    die('Wrong password!');
}
$session_get_query = mysql_query("select * from session where user_id = '" . $userId . "'", $db);
if (mysql_num_rows($session_get_query) > 0) {
} else {
    $session_insert_query = mysql_query("insert into session (user_id) values('" . $userId . "')", $db);
}
if (!$session_get_query || mysql_num_rows($session_get_query) <= 0) {
    create_error($access_token, 'PHP', 'init_user.php', 'No session found', $db);
    die('No session found');
}
$session_get_row = mysql_fetch_array($session_get_query, MYSQL_ASSOC);
$sessionId = $session_get_row['id'];
$time_of_creation = date("Y/m/d H:i:s");
$history_insert_query = mysql_query("insert into history (session_id,time_of_creation) values('" . $sessionId . "','" . $time_of_creation . "')", $db);
echo json_encode($row_array);
//Close the database connection
mysql_close($db);
<?php

$notify_id = $_REQUEST['notify_id'];
if (!isset($notify_id)) {
    create_error('You must choose the messages you want to delete.');
}
$db->query('DELETE FROM message_notify WHERE notify_id IN (' . $db->escapeArray($notify_id) . ')');
forward(create_container('skeleton.php', 'notify_view.php'));
        } else {
            if ($var['task'] == 'reset_website') {
                $db->query('UPDATE album SET website = \'\' WHERE account_id = ' . $db->escapeNumber($account_id));
            } else {
                if ($var['task'] == 'reset_birthdate') {
                    $db->query('UPDATE album SET day = 0, month = 0, year = 0 WHERE account_id = ' . $db->escapeNumber($account_id));
                } else {
                    if ($var['task'] == 'reset_other') {
                        $db->query('UPDATE album SET other = \'\' WHERE account_id = ' . $db->escapeNumber($account_id));
                    } else {
                        if ($var['task'] == 'delete_comment') {
                            $comment_ids = $_REQUEST['comment_ids'];
                            // we just ignore if nothing was set
                            if (count($comment_ids) > 0) {
                                $db->query('DELETE
					FROM album_has_comments
					WHERE album_id = ' . $db->escapeNumber($account_id) . ' AND
						  comment_id IN (' . $db->escapeArray($comment_ids) . ')');
                            }
                        } else {
                            create_error('No action chosen!');
                        }
                    }
                }
            }
        }
    }
}
$container = create_container('skeleton.php', 'album_moderate.php');
transfer('account_id');
forward($container);
Beispiel #8
0
<?php

if (isset($var['alliance_id'])) {
    $alliance_id = $var['alliance_id'];
} else {
    $alliance_id = $player->alliance_id;
}
define('WITHDRAW', 0);
define('DEPOSIT', 1);
print_topic('Alliance Bank Report');
include get_file_loc('menue.inc');
print_bank_menue();
//get all transactions
$db->query("SELECT * FROM alliance_bank_transactions WHERE alliance_id = {$alliance_id} AND game_id = {$player->game_id}");
if (!$db->nf()) {
    create_error("Your alliance has no recorded transactions");
}
while ($db->next_record()) {
    if ($db->f("transaction") == 'Payment') {
        if (!$db->f("exempt")) {
            $trans[$db->f("payee_id")][WITHDRAW] += $db->f("amount");
        } else {
            $trans[0][WITHDRAW] += $db->f("amount");
        }
    } else {
        if (!$db->f("exempt")) {
            $trans[$db->f("payee_id")][DEPOSIT] += $db->f("amount");
        } else {
            $trans[0][DEPOSIT] += $db->f("amount");
        }
    }
function getFleet(&$players, &$weapons)
{
    if (DEBUG) {
        print "Get Fleet<br>";
    }
    global $db, $session, $player;
    $player_ids = array_keys($players);
    $fleet = array();
    // Is there a fed beacon in the sector?
    $db->query('SELECT
	location_type_id
	FROM
	location
	WHERE location_type_id=201
	AND sector_id=' . $player->sector_id . '
	AND game_id=' . SmrSession::$game_id . '
	LIMIT 1');
    if ($db->next_record()) {
        $have_beacon = TRUE;
        $db->query('SELECT account_id FROM ship_has_cargo WHERE good_id IN (5,9,12) AND game_id=' . SmrSession::$game_id . ' AND account_id IN (' . implode(',', $player_ids) . ')');
        while ($db->next_record()) {
            $illegal_goods[$db->f('account_id')] = TRUE;
        }
    } else {
        $have_beacon = FALSE;
    }
    foreach ($player_ids as $account_id) {
        // Remove players that are fed protected from the fighting
        if ($have_beacon && !isset($illegal_goods[$account_id]) && protected_rating($account_id, $players, $weapons)) {
            // Player and their target must not have dropped into fed protection
            if ($account_id == $player->account_id) {
                create_error("You are under federal protection");
            }
            unset($players[$account_id]);
        } else {
            if ($account_id != $player->account_id) {
                // We add the player and target to the fleet after capping
                if ($players[$account_id][ALLIANCE_ID] == $player->alliance_id) {
                    $fleet[] = $account_id;
                } else {
                    $fleet[] = $account_id;
                }
            }
        }
    }
    // Cap fleet to the required size
    $fleet_size = count($fleet);
    if ($fleet_size > MAXIMUM_FLEET_SIZE - 1) {
        // We shuffle to stop the same people being capped all the time
        shuffle($fleet);
        $temp = array();
        $count = 0;
        for ($j = 0; $j < $fleet_size; ++$j) {
            if ($count < MAXIMUM_FLEET_SIZE - 1) {
                $temp[] = $fleet[$j];
            } else {
                unset($players[$fleet[$j]]);
            }
            ++$count;
        }
        $fleet = $temp;
    }
    // Add the inital combatants to their respective fleets
    $fleet[] = (int) SmrSession::$old_account_id;
    // Shuffle for random firing order
    shuffle($fleet);
    return $fleet;
}
}
$row_user = mysql_fetch_array($user, MYSQL_ASSOC);
$userId = $row_user['user_id'];
$gallery = mysql_query("select * from user where id = '" . $userId . "' and exclude = '0'", $db);
if (!$gallery || mysql_num_rows($gallery) <= 0) {
    create_error($access_token, 'PHP', 'set_artist_status.php', 'No gallery found', $db);
    die('No gallery found');
}
$row_gallery = mysql_fetch_array($gallery, MYSQL_ASSOC);
$galleryId = $row_gallery['gallery_id'];
if ($artist_status == 'true') {
    $artist_update = mysql_query("update artist set display='1' where id='" . $artistId . "' and gallery_id='" . $galleryId . "'", $db);
    $artwork_update = mysql_query("update artwork set display='1' where artist_id='" . $artistId . "'", $db);
    if (!$artwork_update) {
        create_error($access_token, 'PHP', 'set_artist_status.php', 'Not able to update the status of the artwork', $db);
        die('Not able to update the status of the artwork');
    }
} else {
    $artist_update = mysql_query("update artist set display='0' where id='" . $artistId . "' and gallery_id='" . $galleryId . "'", $db);
    $artwork_update = mysql_query("update artwork set display='0' where artist_id='" . $artistId . "'", $db);
    if (!$artwork_update) {
        create_error($access_token, 'PHP', 'set_artist_status.php', 'Not able to update the status of the artwork', $db);
        die('Not able to update the status of the artwork');
    }
}
if (!$artist_update) {
    create_error($access_token, 'PHP', 'set_artist_status.php', 'Not able to update the status of the artist', $db);
    die('Not able to update the status of the artist');
}
//Close the database connection
mysql_close($db);
$db_name = $ini_array['db_name'];
$db_username = $ini_array['db_username'];
$db_password = $ini_array['db_password'];
##########################################
$db = mysql_connect($db_ip, $db_username, $db_password) or die("Could not connect");
mysql_select_db($db_name) or die("Could not select database");
include 'create_error.php';
//Get all information
$access_token = $_POST['access_token'];
if (!isset($access_token)) {
    create_error('-', 'PHP', 'get_information.php', 'Access Token is Missing!', $db);
    die('Access Token ID is Missing!');
}
$access = mysql_query("select * from access_token where token = '" . $access_token . "'", $db);
if (!$access || mysql_num_rows($access) <= 0) {
    create_error($access_token, 'PHP', 'get_information.php', 'No user found', $db);
    die('No user found');
}
$access_row = mysql_fetch_array($access, MYSQL_ASSOC);
$userId = $access_row['user_id'];
$infoForGallery = mysql_query("select * from info_for_user inner join information on info_for_user.info_id = information.id where user_id = '" . $userId . "'", $db);
$json_response_infos = array();
while ($row_infoForGallery = mysql_fetch_array($infoForGallery, MYSQL_ASSOC)) {
    $row_array['id'] = $row_infoForGallery['info_id'];
    $row_array['time'] = $row_infoForGallery['time'];
    $row_array['message'] = $row_infoForGallery['message'];
    array_push($json_response_infos, $row_array);
}
echo json_encode($json_response_infos);
//Close the database connection
mysql_close($db);
    die('No session found');
}
$session_row = mysql_fetch_array($session, MYSQL_ASSOC);
$row_options['session'] = $session_row['id'];
$user = mysql_query("select * from user where id = '" . $userId . "' and exclude = '0'", $db);
if (!$user || mysql_num_rows($user) <= 0) {
    create_error($access_token, 'PHP', 'get_errors.php', 'No user found', $db);
    die('No user found');
}
$user_row = mysql_fetch_array($user, MYSQL_ASSOC);
$galleryId = $user_row['gallery_id'];
$optionId = $user_row['settings_id'];
$sectionId = $user_row['section_id'];
$section = mysql_query("select * from section where id = '" . $sectionId . "'", $db);
if (!$section || mysql_num_rows($section) <= 0) {
    create_error($access_token, 'PHP', 'get_errors.php', 'No section found', $db);
    die('No section found');
}
$section_row = mysql_fetch_array($section, MYSQL_ASSOC);
$sectionRef = $section_row['ref'];
if ($sectionRef == 1000 || $sectionRef == '1000') {
    $result_errors = mysql_query("select * from error", $db);
    $json_response_errors = array();
    while ($row = mysql_fetch_array($result_errors, MYSQL_ASSOC)) {
        $row_array['id'] = $row['id'];
        $row_array['reference'] = $row['reference'];
        $row_array['source_file'] = $row['source'];
        $row_array['time'] = $row['time'];
        $row_array['message'] = utf8_encode($row['message']);
        $result_user = mysql_query("select user.username as username, gallery.name as gallery_name from user inner join gallery on user.gallery_id = gallery.id where user.id = '" . $row_array['user_id'] . "'", $db);
        $user_row = mysql_fetch_array($section, MYSQL_ASSOC);
<?php

$action = $_REQUEST['action'];
if ($action == 'Skip >>') {
    $container = array();
    $container['url'] = 'skeleton.php';
    $container['body'] = 'universe_create_ports.php';
    $container['game_id'] = $var['game_id'];
    forward($container);
}
$id = $_REQUEST['id'];
if (!isset($id)) {
    create_error('Error while transmitting data from previous form!');
}
include get_file_loc('universe_create_location.inc');
foreach ($id as $location_type_id => $location_array) {
    // first we deal with race HQ
    if ($location_type_id == GOVERNMENT) {
        foreach ($location_array as $galaxy_id => $hq_type) {
            // 1 means no hq
            if ($hq_type == 1) {
                continue;
            }
            // put actual hq in
            $hq_sector = create_location($var['game_id'], $galaxy_id, GOVERNMENT + $hq_type);
            // ship shop and co (for racials only)
            create_location($var['game_id'], $galaxy_id, RACIAL_SHIPS + $hq_type - 1, $hq_sector);
            create_location($var['game_id'], $galaxy_id, RACIAL_SHOPS + $hq_type - 1, $hq_sector);
            // create fed around hq
            create_fed($var['game_id'], $galaxy_id, $hq_sector);
        }
Beispiel #14
0
<?php

$sector =& $player->getSector();
if (!$sector->isLinked($var['target_sector']) && $sector->getSectorID() != $var['target_sector']) {
    create_error('You cannot scan a sector you are not linked to.');
}
// initialize vars
$scanSector =& SmrSector::getSector($player->getGameID(), $var['target_sector']);
$template->assign('PageTopic', 'Sector Scan of #' . $scanSector->getSectorID() . ' (' . $scanSector->getGalaxyName() . ')');
$friendly_forces = 0;
$enemy_forces = 0;
$friendly_vessel = 0;
$enemy_vessel = 0;
// iterate over all forces in the target sector
$scanSectorAllForces =& $scanSector->getForces();
foreach ($scanSectorAllForces as &$scanSectorForces) {
    // decide if it's a friendly or enemy stack
    if ($player->sameAlliance($scanSectorForces->getOwner())) {
        $friendly_forces += $scanSectorForces->getMines() * 3 + $scanSectorForces->getCDs() * 2 + $scanSectorForces->getSDs();
    } else {
        $enemy_forces += $scanSectorForces->getMines() * 3 + $scanSectorForces->getCDs() * 2 + $scanSectorForces->getSDs();
    }
}
unset($scanSectorForces);
$scanSectorPlayers =& $scanSector->getOtherTraders($player);
foreach ($scanSectorPlayers as &$scanSectorPlayer) {
    $scanSectorShip =& $scanSectorPlayer->getShip();
    // he's a friend if he's in our alliance (and we are not in a 0 alliance
    if ($player->traderMAPAlliance($scanSectorPlayer)) {
        $friendly_vessel += $scanSectorShip->getAttackRating();
    } else {
Beispiel #15
0
<?php

if (!$player->isLandedOnPlanet()) {
    create_error('You are not on a planet!');
}
// create planet object
$planet =& $player->getSectorPlanet();
$template->assign('PageTopic', 'Planet : ' . $planet->getName() . ' [Sector #' . $planet->getSectorID() . ']');
require_once get_file_loc('menu.inc');
create_planet_menu($planet);
$PHP_OUTPUT .= '<p>There are no goods present on your ship or the planet!</p>';
$present = false;
$table .= '<p>';
$table .= '<table class="standard">';
$table .= '<tr>';
$table .= '<th></th>';
$table .= '<th>Good</th>';
$table .= '<th>Ship</th>';
$table .= '<th>Planet</th>';
$table .= '<th>Amount</th>';
$table .= '<th>Transfer to</th>';
$table .= '</tr>';
$GOODS =& Globals::getGoods();
foreach ($GOODS as $goodID => $good) {
    if (!$ship->hasCargo($goodID) && !$planet->hasStockpile($goodID)) {
        continue;
    }
    if (!$present) {
        $present = true;
        $PHP_OUTPUT = "";
    }
$section_row = mysql_fetch_array($section, MYSQL_ASSOC);
$sectionRef = $section_row['ref'];
$gallery = mysql_query("select * from gallery where id = '" . $galleryId . "'", $db);
if (!$gallery || mysql_num_rows($gallery) <= 0) {
    create_error($access_token, 'PHP', 'get_user.php', 'No gallery found', $db);
    die('No gallery found');
}
$gallery_row = mysql_fetch_array($gallery, MYSQL_ASSOC);
$galleryName = $gallery_row['name'];
$galleryLocation = $gallery_row['city'];
$row_user['name'] = $userName;
$row_user['email'] = $userEmail;
$row_user['username'] = $userUsername;
$row_user['location'] = $galleryLocation;
$row_user['gallery_name'] = $galleryName;
$row_user['group'] = $sectionRef;
$artists = mysql_query("select * from artist where gallery_id = '" . $galleryId . "'", $db);
$artworks_qty = 0;
if (!$artists) {
    create_error($access_token, 'PHP', 'get_user.php', 'No artists found', $db);
    die('No artists found');
}
$row_user['qty_artists'] = mysql_num_rows($artists);
while ($row_artists = mysql_fetch_array($artists, MYSQL_ASSOC)) {
    $result_artworks = mysql_query("select * from artwork where artist_id= '" . $row_artists['id'] . "'", $db);
    $artworks_qty = $artworks_qty + 1;
}
$row_user['qty_artworks'] = $artworks_qty;
echo json_encode($row_user);
//Close the database connection
mysql_close($db);
			VALUES(' . $db->escapeNumber(SmrSession::$account_id) . ', ' . $db->escapeNumber($gameID) . ', 1, ' . $db->escapeNumber($amount_shields) . ', ' . $db->escapeNumber($amount_shields) . ')');
// give the player armour
$db->query('INSERT INTO ship_has_hardware (account_id, game_id, hardware_type_id, amount, old_amount)
			VALUES(' . $db->escapeNumber(SmrSession::$account_id) . ', ' . $db->escapeNumber($gameID) . ', 2, ' . $db->escapeNumber($amount_armour) . ', ' . $db->escapeNumber($amount_armour) . ')');
// give the player cargo hold
$db->query('INSERT INTO ship_has_hardware (account_id, game_id, hardware_type_id, amount, old_amount)
			VALUES(' . $db->escapeNumber(SmrSession::$account_id) . ', ' . $db->escapeNumber($gameID) . ', 3, 40, 40)');
// give the player weapons
$db->query('INSERT INTO ship_has_weapon (account_id, game_id, order_id, weapon_type_id)
			VALUES(' . $db->escapeNumber(SmrSession::$account_id) . ', ' . $db->escapeNumber($gameID) . ', 0, 46)');
// insert the huge amount of sectors into the database :)
$db->query('SELECT MIN(sector_id), MAX(sector_id)
			FROM sector
			WHERE game_id = ' . $db->escapeNumber($gameID));
if (!$db->nextRecord()) {
    create_error('This game doesn\'t have any sectors');
}
$min_sector = $db->getInt('MIN(sector_id)');
$max_sector = $db->getInt('MAX(sector_id)');
for ($i = $min_sector; $i <= $max_sector; $i++) {
    //if this is our home sector we dont add it.
    if ($i == $home_sector_id) {
        continue;
    }
    $db->query('INSERT INTO player_visited_sector (account_id, game_id, sector_id) VALUES (' . $db->escapeNumber(SmrSession::$account_id) . ', ' . $db->escapeNumber($gameID) . ', ' . $db->escapeNumber($i) . ')');
}
$db->query('INSERT INTO player_has_stats (account_id, game_id) VALUES (' . $db->escapeNumber(SmrSession::$account_id) . ', ' . $db->escapeNumber($gameID) . ')');
// update stats
$db->query('UPDATE account_has_stats SET games_joined = games_joined + 1 WHERE account_id = ' . $db->escapeNumber($account->getAccountID()));
// is this our first game?
$db->query('SELECT * FROM account_has_stats WHERE account_id = ' . $db->escapeNumber($account->getAccountID()));
<?php

$accountIDs = $_REQUEST['account_id'];
if (empty($accountIDs)) {
    create_error('You have to choose someone to remove them!');
}
if (in_array($player->getAlliance()->getLeaderID(), $accountIDs)) {
    create_error('You can\'t kick the leader!');
}
if (in_array($player->getAccountID(), $accountIDs)) {
    create_error('You can\'t kick yourself!');
}
foreach ($accountIDs as $accountID) {
    $currPlayer =& SmrPlayer::getPlayer($accountID, $player->getGameID());
    if (!$player->sameAlliance($currPlayer)) {
        throw new Exception('Cannot kick someone from another alliance!');
    }
    $currPlayer->leaveAlliance($player);
}
forward(create_container('skeleton.php', 'alliance_roster.php'));
function getImgOverviewPath($galleryDirectory, $imgName)
{
    $imgName = $imgName . '_sm';
    $imgPath = '';
    if ($handle = opendir($galleryDirectory)) {
        while (false !== ($file = readdir($handle))) {
            if (strpos($file, $imgName) !== false) {
                $img = $galleryDirectory . $file;
                $imgData = base64_encode(file_get_contents($img));
                $imgPath = 'data: ' . get_type($img) . ';base64,' . $imgData;
            }
        }
        closedir($handle);
    } else {
        create_error($access_token, 'PHP', 'create_artist_img.php', 'No image found in the gallery directory', $db);
        die('No image found in the gallery directory');
    }
    return $imgPath;
}
<?php

$db->query('SELECT 1 FROM draft_leaders WHERE game_id=' . $db->escapeNumber($player->getGameID()) . ' AND account_id=' . $db->escapeNumber($player->getAccountID()));
if ($db->nextRecord()) {
    require_once ENGINE . 'Default/alliance_create_processing.php';
} else {
    create_error('You cannot create an alliance in a draft game.');
}
<?php

if (empty($_REQUEST['webboard']) || empty($_REQUEST['ircnick']) || empty($_REQUEST['started']) || empty($_REQUEST['reasons']) || empty($_REQUEST['time']) || empty($_REQUEST['online'])) {
    create_error('You must fill in all the fields!');
}
$new_sub = 'Beta Application';
$message = 'Login: '******'-----------' . EOL . EOL . 'Account ID: ' . $account->getAccountID() . EOL . EOL . '-----------' . EOL . EOL . 'E-Mail: ' . $account->getEmail() . EOL . EOL . '-----------' . EOL . EOL . 'Webboard Name: ' . $_REQUEST['webboard'] . EOL . EOL . '-----------' . EOL . EOL . 'IRC Nick: ' . $_REQUEST['ircnick'] . EOL . EOL . '-----------' . EOL . EOL . 'Start Time: ' . $_REQUEST['started'] . EOL . EOL . '-----------' . EOL . EOL . 'Reasons: ' . $_REQUEST['reasons'] . EOL . EOL . '-----------' . EOL . EOL . 'Time spent on beta: ' . $_REQUEST['time'] . EOL . EOL . '-----------' . EOL . EOL . 'Online time: ' . $_REQUEST['online'];
//mail('*****@*****.**',
//	$new_sub,
//	$message,
//	'From: '.$account->getEmail());
$player->sendMessageToBox(BOX_BETA_APPLICATIONS, $message);
$container = array();
$container['url'] = 'skeleton.php';
if (SmrSession::$game_id > 0) {
    if ($player->isLandedOnPlanet()) {
        $container['body'] = 'planet_main.php';
    } else {
        $container['body'] = 'current_sector.php';
    }
} else {
    $container['body'] = 'game_play.php';
}
forward($container);
<?php

// Why is this here? Is there a reason?
// sleep(1);
if ($var['action'] == 'Enable') {
    $ship->enable_cloak();
} elseif ($var['action'] == 'Disable') {
    $ship->disable_cloak();
} elseif ($var['action'] == 'Set Illusion') {
    if (!is_numeric($_REQUEST['ship_id']) || !is_numeric($_REQUEST['attack']) || !is_numeric($_REQUEST['defense'])) {
        create_error('Numbers only please');
    }
    $ship->set_illusion($_REQUEST['ship_id'], $_REQUEST['attack'], $_REQUEST['defense']);
} elseif ($var['action'] == 'Disable Illusion') {
    $ship->disable_illusion();
}
$container = array();
$container['url'] = 'skeleton.php';
if ($player->land_on_planet == 'TRUE') {
    $container['body'] = 'planet_main.php';
} else {
    $container['body'] = 'current_sector.php';
}
forward($container);
Beispiel #23
0
<?php

$account_id = $_REQUEST['account_id'];
$exception = $_REQUEST['exception'];
if (!is_array($account_id)) {
    create_error('Please check the boxes next to the names you wish to open.');
}
$action = $_REQUEST['action'];
if ($action == 'Reopen and add to exceptions') {
    foreach ($account_id as $id) {
        $curr_exception = $exception[$id];
        $bannedAccount =& SmrAccount::getAccount($id);
        $bannedAccount->unbanAccount($account, $curr_exception);
    }
} else {
    foreach ($account_id as $id) {
        $bannedAccount =& SmrAccount::getAccount($id);
        $bannedAccount->unbanAccount($account);
    }
}
forward(create_container('skeleton.php', 'admin_tools.php'));
$location = $_POST['gallery_location'];
if (!isset($access_token)) {
    create_error('-', 'I-100', 'set_user.php', 'Access Token is Missing!', $db);
    die('Access Token ID is Missing!');
}
$user = mysql_query("select * from access_token where token = '" . $access_token . "'", $db);
if (!$user || mysql_num_rows($user) <= 0) {
    create_error($access_token, 'I-100', 'set_user.php', 'No user found', $db);
    die('No user found');
}
$row = mysql_fetch_array($user, MYSQL_ASSOC);
$userId = $row['user_id'];
$gallery = mysql_query("select * from user where id = '" . $userId . "' and exclude = '0'", $db);
if (!$gallery || mysql_num_rows($gallery) <= 0) {
    create_error($access_token, 'I-100', 'set_user.php', 'No gallery found', $db);
    die('No gallery found');
}
$row = mysql_fetch_array($gallery, MYSQL_ASSOC);
$galleryId = $row['gallery_id'];
$sql_user = mysql_query("update user set username = '******', name ='" . $name . "' where id='" . $userId . "'", $db);
if (!$sql_user) {
    create_error($access_token, 'I-250', 'set_user.php', 'Not able to find or update the user', $db);
    die('Not able to find or update the user');
}
$sql_gallery = mysql_query("update gallery set name = '" . $gallery_name . "', location = '" . $location . "' where id='" . $galleryId . "'", $db);
if (!$sql_gallery) {
    create_error($access_token, 'I-200', 'set_user.php', 'Not able to find or update the gallery', $db);
    die('Not able to find or update the gallery');
}
//Close the database connection
mysql_close($db);
<?php

$action = $_REQUEST['action'];
if ($action == 'Marked Messages') {
    if (!isset($_REQUEST['message_id'])) {
        create_error('You must choose the messages you want to delete.');
    }
    foreach ($_REQUEST['message_id'] as $id) {
        $db->query('DELETE FROM message_boxes WHERE message_id = ' . $db->escapeNumber($id));
    }
} else {
    if ($action == 'All Messages') {
        if (!isset($var['box_type_id'])) {
            create_error('No box selected.');
        }
        $db->query('DELETE FROM message_boxes WHERE box_type_id = ' . $db->escapeNumber($var['box_type_id']));
    }
}
forward(create_container('skeleton.php', 'box_view.php'));
$amount = $_REQUEST['amount'];
if (!is_numeric($amount)) {
    create_error("Numbers only please");
}
if ($amount <= 0) {
    create_error("You must actually enter an ammount > 0!");
}
//lets make sure there is actually that much on the ship
if ($amount > $ship->cargo[$good_id]) {
    create_error("You can't dump more than you have.");
}
if ($sector->has_fed_beacon()) {
    create_error("You can't dump cargo in a Federal Sector!");
}
if ($player->turns < 1) {
    create_error("You do not have enough turns to dump cargo!");
}
require_once "shop_goods.inc";
// get the distance
$good_distance = get_good_distance($good_id, "Buy");
$lost_xp = (round($amount / 30) + 1) * 2 * $good_distance;
$player->experience -= $lost_xp;
if ($player->experience < 0) {
    $player->experience = 0;
}
// take turn
$player->take_turns(1);
$player->update();
$ship->cargo[$good_id] -= $amount;
$ship->update_cargo();
// log action
//Get all artists
$access_token = $_POST['access_token'];
if (!isset($access_token)) {
    create_error('-', 'PHP', 'get_artists.php', 'Access Token is Missing!', $db);
    die('Access Token ID is Missing!');
}
$access = mysql_query("select * from access_token where token = '" . $access_token . "'", $db);
if (!$access || mysql_num_rows($access) <= 0) {
    create_error($access_token, 'PHP', 'get_artists.php', 'No access found', $db);
    die('No access found');
}
$access_row = mysql_fetch_array($access, MYSQL_ASSOC);
$userId = $access_row['user_id'];
$user = mysql_query("select * from user where id = '" . $userId . "' and exclude = '0'", $db);
if (!$user || mysql_num_rows($user) <= 0) {
    create_error($access_token, 'PHP', 'get_artists.php', 'No user found', $db);
    die('No user found');
}
$user_row = mysql_fetch_array($user, MYSQL_ASSOC);
$galleryId = $user_row['gallery_id'];
$galleryFolder = 'gallery_' . $galleryId . '/';
$galleryDirectory = $destination_folder . $galleryFolder;
$result_artists = mysql_query("select * from artist where gallery_id = '" . $galleryId . "'", $db);
$json_response_artists = array();
while ($row = mysql_fetch_array($result_artists, MYSQL_ASSOC)) {
    $row_array['id'] = $row['id'];
    $row_array['slug'] = $row['id'];
    $row_array['name'] = utf8_encode($row['name']);
    $row_array['imgName'] = utf8_encode($row['img']);
    $row_array['imgPath'] = getImgPath($galleryFolder, $galleryDirectory, utf8_encode($row['img']));
    $row_array['imgOverviewPath'] = getImgOverviewPath($galleryDirectory, utf8_encode($row['img']));
<?php

require_once get_file_loc("smr_planet.inc");
$planet = new SMR_PLANET($player->sector_id, $player->game_id);
$planet_player = new SMR_PLAYER($var["account_id"], SmrSession::$game_id);
$owner = new SMR_PLAYER($planet->owner_id, $player->game_id);
if ($owner->alliance_id != $player->alliance_id) {
    create_error("You can not kick someone off a planet your alliance does not own!");
}
$message = "You have been kicked from {$planet->planet_name} in #{$player->sector_id}";
$player->send_message($planet_player->account_id, 2, format_string($message, false));
$planet_player->land_on_planet = "FALSE";
//update their last active time so that they are visable if kicked
$worst = time() - 1500;
if ($planet_player->last_active < $worst) {
    $planet_player->last_active = $worst;
}
$planet_player->update();
forward(create_container("skeleton.php", "planet_main.php"));
$db->query('SELECT location_name
			FROM location JOIN location_type USING(location_type_id)
			WHERE location_type_id > ' . $db->escapeNumber(UNDERGROUND) . '
				AND location_type_id < ' . $db->escapeNumber(FED) . '
				AND game_id = ' . $db->escapeNumber($var['game_id']) . '
			ORDER BY location_type_id');
while ($db->nextRecord()) {
    // get the name for this race
    // HACK! cut ' HQ' from location name!
    $race_name = substr($db->getField('location_name'), 0, -3);
    // get race id for this race
    $db2->query('SELECT race_id FROM race WHERE race_name = ' . $db->escapeString($race_name) . ' LIMIT 1');
    if ($db2->nextRecord()) {
        $race_id = $db2->getField('race_id');
    } else {
        create_error('Couldn\'t find the ' . $race_name . ' in database!');
    }
    if (in_array($race_id, $only)) {
        continue;
    }
    $only[] = $race_id;
    // hack for the user mrspock
    if ($player_name == 'MrSpock' && $race_name == 'Salvene') {
        $selected = ' selected="selected"';
    } else {
        $selected = '';
    }
    $PHP_OUTPUT .= '<option value="' . $race_id . '"' . $selected . '>' . $race_name . '</option>';
}
$PHP_OUTPUT .= '</select><br><br><br>';
$PHP_OUTPUT .= '</p>';
Beispiel #30
0
<?php

create_error('Please use main album edit.');
print_topic("Edit Photo");
print "<p><span style=\"font-size:80%;\">Here you have a chance to add an entry to the Space Merchant Realms - The Photo Album!<br>";
print "We only accept jpg or gif images to a maximum of 500 x 500 in size.<br>";
print "Your image will be posted under your <i>Hall Of Fame</i> nick!<br>";
print "<b>Please Note:</b> Your entry needs to be approved by an admin before going online</p>";
print "<p style=\"font-size:150%;\">";
print "Status of your album entry: ";
$db->query("SELECT * FROM album WHERE account_id = " . SmrSession::$old_account_id);
if ($db->next_record()) {
    $location = stripslashes($db->f("location"));
    $email = stripslashes($db->f("email"));
    $website = stripslashes($db->f("website"));
    $day = $db->f("day");
    $month = $db->f("month");
    $year = $db->f("year");
    $other = stripslashes($db->f("other"));
    $approved = $db->f("approved");
    $disabled = $db->f("disabled");
    if ($approved == "TBC") {
        print "<span style=\"color:orange;\">Waiting approval</span>";
    } elseif ($approved == "NO") {
        print "<span style=\"color:red;\">Approval denied</span>";
    } elseif ($disabled == "TRUE") {
        print "<span style=\"color:red;\">Disabled</span>";
    } elseif ($approved == "YES") {
        print "<a href=\"" . URL . "/album/?{$account->HoF_name}\" style=\"color:green;\">Online</a>";
    }
} else {