コード例 #1
0
ファイル: fleet3.php プロジェクト: sonicmaster/RPG
if ($planettype == 2) {
    $planettype_e = 1;
}
$target = doquery("SELECT * FROM {{table}} WHERE `galaxy` = '" . $galaxy . "' AND `system` = '" . $system . "' AND `planet` = '" . $planet . "' AND `planet_type` = '" . $planettype_e . "' LIMIT 1 ;", "planets", true);
//Does the planet exist?
if ($target['id'] > 0) {
    //Yes
    $UsedPlanet = true;
    //it is the users?
    if ($target['id_owner'] == $user['id']) {
        //Yes
        $YourPlanet = true;
    }
}
//Parse the missions list
$parse['missions'] = AllowedMissions($UsedPlanet, $YourPlanet, $planet, $planettype, $fleetarray, $fleet_group_mr, false);
//We can trust the results from post here, if the user hacked it it will just make life complicated for himself. No point validating as it will be passed back to post in a bit anyway. Will validate at fleet4.php though.
//Where are we going?
$parse['target'] = $target['galaxy'] . ":" . $target['system'] . ":" . $target['planet'] . " " . ($target['planet_type'] == 3 ? $lang['Moon'] : ($target['planet_type'] == 2 ? $lang['DF'] : $lang['Planet']));
//How long?
$parse['duration'] = $_GET['duration'] * 1;
$parse['pduration'] = pretty_time($parse['duration']);
//How much fuel?
$parse['consumption'] = pretty_number($_GET['consumption']);
//How much space?
$parse['space'] = $_GET['fleet_cargo'] - $_GET['consumption'];
$parse['bays'] = pretty_number($parse['space']);
$page = parsetemplate(gettemplate('fleet/3'), $parse);
if ($_GET['axah']) {
    makeAXAH($page);
} else {
コード例 #2
0
ファイル: fleet4.php プロジェクト: sonicmaster/RPG
//Clear some memory
unset($select);
//Some SQL Info
$targetrow = doquery("SELECT * FROM {{table}} WHERE `galaxy` = '" . $galaxy . "' AND `system` = '" . $system . "' AND `planet` = '" . $planet . "' AND `planet_type` = '" . $planettype . "';", 'planets', true);
//Get the fleet array...
$fleetarray = unserialize(stripslashes($_GET["fleet_array"]));
//Is there a fleet array, if not either he's wasting our time or something is wrong.
if (!is_array($fleetarray)) {
    die($lang['fl_error'] . "<br /> \$fleetarray is not an array.");
}
//Does mission exist?
if (empty($missiontype[$fleetmission])) {
    die($lang['fl_bad_mission']);
}
//Check if mission is legit.
$legit = AllowedMissions($UsedPlanet, $YourPlanet, $planet, $planettype, $fleetarray, $fleet_group_mr, true);
if ($legit[$fleetmission] != $fleetmission) {
    die($lang['fl_bad_mission'] . "<br >~" . $legit[$fleetmission] . "<br >~" . $fleetmission);
}
//Is he cheating on the fleet? die if he is.
foreach ($fleetarray as $Ship => $Count) {
    if ($Ship != idstring($Ship)) {
        unset($fleetarray[$Ship]);
    } else {
        $Count = idstring($Count);
        $fleetarray[$Ship] = $Count;
        if ($Count > $planetrow[$resource[$Ship]]) {
            die($lang['fl_fleet_err'] . "<br />User is trying to send more " . $Ship . " than he owns.");
        }
    }
}