示例#1
0
 public static function generatePlanetOptions()
 {
     $curr_plan = \planets::getParam('pid');
     $planets = mysql_query("SELECT * FROM " . $GLOBALS['DB_table_prefix'] . "planets WHERE unpassable = 0 ORDER BY planet_name ASC");
     $options = '<option value="-1" name="none"';
     if ($curr_plan == '' || !\planets::planetExists($curr_plan)) {
         $options .= " SELECTED";
         $curr_plan = '';
     }
     $options .= ' DISABLED>None</option>';
     for ($i = 0; $i < mysql_num_rows($planets); $i++) {
         $pid = mysql_result($planets, $i, "planet_uid");
         $planet_name = mysql_result($planets, $i, "planet_name");
         $options .= '<option value="' . $pid . '" name="' . $planet_name . '"';
         if ($curr_plan == $pid) {
             $options .= " SELECTED";
         }
         $options .= '>' . $planet_name . '</option>';
     }
     return $options;
 }
示例#2
0
文件: index.php 项目: TCS13/SWCPM
    echo "<br/>";
}
//Processes submissions of new deposits
if (\planets::getParam('mode') == 'submit' && $pid != '') {
    $who = addslashes(\planets::getParam('who'));
    $mat = \planets::getParam('mat');
    $size = \planets::getParam('size');
    $x = \planets::getParam('surfX');
    $y = \planets::getParam('surfY');
    //Verifies no blank parameters
    if ($who == '' || $mat == '' || $size == '' || $x == '' || $y == '') {
        header("Location: " . $GLOBALS['site_name'] . "?pid=" . $pid . "&msg=1");
        exit;
    }
    //Verifies planet exists
    if (!\planets::planetExists($pid)) {
        header("Location: " . $GLOBALS['site_name'] . "?msg=2");
        exit;
    }
    //Verifies RM exists
    if (!\planets::matExists($mat)) {
        header("Location: " . $GLOBALS['site_name'] . "?pid=" . $pid . "&msg=3");
        exit;
    }
    //Removes formatting from numbers, verifies size is >= 0 and numeric
    $size = str_replace(",", '', $size);
    if ($size < 0 || !is_numeric($size)) {
        header("Location: " . $GLOBALS['site_name'] . "?pid=" . $pid . "&msg=4");
        exit;
    }
    //Verifies x-coordinate is valid given the current planet