• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP valid_coordinates函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中valid_coordinates函数的典型用法代码示例。如果您正苦于以下问题:PHP valid_coordinates函数的具体用法?PHP valid_coordinates怎么用?PHP valid_coordinates使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了valid_coordinates函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1:

*
*  You should have received a copy of the GNU General Public License
*  along with this program; if not, write to the Free Software
*  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
*/
/**
 * Galaxy map
 *
 * @author Mauri Kujala <[email protected]>
 * @copyright Copyright (C) 2016, Mauri Kujala
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
*/
//http://ed-board.net/3Dgalnet/
$pagetitle = "Galaxy Map&nbsp;&nbsp;&&nbsp;&nbsp;Neighborhood Map";
require_once "" . $_SERVER["DOCUMENT_ROOT"] . "/style/header.php";
if (valid_coordinates($curSys["x"], $curSys["y"], $curSys["z"])) {
    $ucoordx = $curSys["x"];
    $ucoordy = $curSys["y"];
    $ucoordz = -$curSys["z"];
} else {
    // get last known coordinates
    $last_coords = last_known_system();
    $ucoordx = $last_coords["x"];
    $ucoordy = $last_coords["y"];
    $ucoordz = -$last_coords["z"];
    $is_unknown = " *";
}
?>
<div style="display:none" id="curx"><?php 
echo $ucoordx;
?>
开发者ID:padthaitofuhot,项目名称:EDTB,代码行数:31,代码来源:galmap.php


示例2: date_create

        $log_coordx = $lb_arr["x"] == "" ? "" : $lb_arr["x"];
        $log_coordy = $lb_arr["y"] == "" ? "" : $lb_arr["y"];
        $log_coordz = $lb_arr["z"] == "" ? "" : $lb_arr["z"];
    }
    if (valid_coordinates($log_coordx, $log_coordy, $log_coordz)) {
        $log_date = $log_row["stardate"];
        $date = date_create($log_date);
        $log_added = date_modify($date, "+1286 years");
        $text = $log_row["log_entry"];
        if (mb_strlen($text) > 40) {
            $text = "" . substr($text, 0, 40) . "...";
        }
        $cat = ',"cat":[11]';
        $info .= '<div class="map_info"><span class="map_info_title">Logged System</span><br />';
        $info .= '<strong>Log entry</strong><br /><a href="/log.php?system=' . urlencode($log_system) . '" style="color:inherit;font-weight:bold" title="View the log for this system">' . $text . ' </a><br /><br />';
        $info .= '<strong>Added</strong><br />' . date_format($log_added, "j M Y, H:i") . '';
        $info .= '</div>';
        $data = '{"name":"' . $log_system . '"' . $cat . ',"coords":{"x":' . $log_coordx . ',"y":' . $log_coordy . ',"z":' . $log_coordz . '},"infos":' . json_encode($info) . '}' . $last_row . '';
        $last_row = "," . $data . "";
    }
}
//$info = '</div>';
$cur_sys_data = "";
if (strtolower($last_system_name) == strtolower($curSys["name"]) && valid_coordinates($curSys["x"], $curSys["y"], $curSys["z"])) {
    $comma = !empty($data) ? "," : "";
    $cur_sys_data = $comma . '{"name":"' . $curSys["name"] . '","cat":[5],"coords":{"x":' . $curSys["x"] . ',"y":' . $curSys["y"] . ',"z":' . $curSys["z"] . '}}';
}
$data = $data_start . $data . $cur_sys_data . "]}";
$map_json = $_SERVER["DOCUMENT_ROOT"] . "/map_points.json";
file_put_contents($map_json, $data);
edtb_common("last_map_update", "unixtime", true, time());
开发者ID:tripflip,项目名称:EDTB,代码行数:31,代码来源:getMapPoints.json.php


示例3: has_screenshots

            $c_rares_data .= "-&nbsp";
            $c_rares_data .= $rare_arr["max_landing_pad_size"];
            $c_rares_data .= "</span><br /><br />";
            $actual_num_res++;
        }
    }
} else {
    $c_rares_data .= "No rares nearby";
}
$c_rares_data .= "</div>";
// check if system has screenshots
$si_screenshots = has_screenshots($si_system_name) ? '<a href="/gallery.php?spgmGal=' . urlencode($si_system_name) . '" title="View image gallery"><img src="/style/img/image.png" alt="Gallery" style="margin-left:5px;vertical-align:top" /></a>' : "";
// check if system is logged
$si_loglink = is_logged($si_system_name) ? '<a href="log.php?system=' . urlencode($si_system_name) . '" style="color:inherit" title="System has log entries"><img src="/style/img/log.png" style="margin-left:5px" /></a>' : "";
$num_visits = mysqli_num_rows(mysqli_query($GLOBALS["___mysqli_ston"], "SELECT id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM user_visited_systems\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE system_name = '" . mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $si_system_name) . "'"));
if ($actual_num_res > 0 && valid_coordinates($curSys["x"], $curSys["y"], $curSys["z"])) {
    $rare_text = "&nbsp;&nbsp;<span onclick='\$(\"#rares\").fadeToggle(\"fast\");'><a href='javascript:void(0);' title'Click for more info'>[ Rares within " . $settings["rare_range"] . " ly: " . $actual_num_res . " ]</a>" . $c_rares_data . "</span>";
}
$data['si_name'] .= "" . $si_system_display_name . "" . $si_loglink . $si_screenshots . " <span style='font-size:11px;text-transform:uppercase;vertical-align:middle;'>[ State: " . $si_system_state . " - Security: " . $si_system_security . " - Visits: " . $num_visits . " ]" . $rare_text . "" . $user_dists . "</span>";
/*
*    station info for system.php
*/
$si_res = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT SQL_CACHE *\n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM edtb_stations\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE system_id = '" . $si_system_id . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY -ls_from_star DESC, name") or write_log(mysqli_error($GLOBALS["___mysqli_ston"]), __FILE__, __LINE__);
$station_exists = mysqli_num_rows($si_res);
if ($station_exists == 0) {
    $data['si_stations'] = "No station data available";
} else {
    while ($sarr2 = mysqli_fetch_assoc($si_res)) {
        $s_name = $sarr2["name"];
        $s_explode = explode(" ", $s_name);
        $count = count($s_explode);
开发者ID:padthaitofuhot,项目名称:EDTB,代码行数:31,代码来源:getData_systemInfo.php


示例4: get_distance

/**
 * Return distance from current to $system
 *
 * @param string|int $system
 * @return string $distance
 * @author Mauri Kujala <[email protected]>
 */
function get_distance($system)
{
    global $mysqli;
    /**
     * fetch target coordinates
     */
    $esc_sys = $mysqli->real_escape_string($system);
    $query = "  (SELECT\n                edtb_systems.x AS target_x,\n                edtb_systems.y AS target_y,\n                edtb_systems.z AS target_z\n                FROM edtb_systems\n                WHERE edtb_systems.name = '{$esc_sys}')\n                UNION\n                (SELECT\n                user_systems_own.x AS target_x,\n                user_systems_own.y AS target_y,\n                user_systems_own.z AS target_z\n                FROM user_systems_own\n                WHERE user_systems_own.name = '{$esc_sys}')\n                LIMIT 1";
    $result = $mysqli->query($query) or write_log($mysqli->error, __FILE__, __LINE__);
    $obj = $result->fetch_object();
    $target_x = $obj->target_x;
    $target_y = $obj->target_y;
    $target_z = $obj->target_z;
    $result->close();
    // figure out what coords to calculate from
    $usable_coords = usable_coords();
    $usex = $usable_coords["x"];
    $usey = $usable_coords["y"];
    $usez = $usable_coords["z"];
    $exact = $usable_coords["current"] === true ? "" : " *";
    if (valid_coordinates($target_x, $target_y, $target_z)) {
        $dist = number_format(sqrt(pow($target_x - $usex, 2) + pow($target_y - $usey, 2) + pow($target_z - $usez, 2)), 2);
        $distance = $dist . ' ly' . $exact;
    } else {
        $distance = '';
    }
    return $distance;
}
开发者ID:DBnR1,项目名称:EDTB,代码行数:35,代码来源:functions.php


示例5: maketable

/**
 * Make item table
 *
 * @param resource $res
 * @param string $type
 * @return string
 * @author Mauri Kujala <[email protected]>
 */
function maketable($res, $type)
{
    global $curSys;
    $num = mysqli_num_rows($res);
    echo '<table>';
    if ($num > 0) {
        if (!valid_coordinates($curSys["x"], $curSys["y"], $curSys["z"])) {
            echo "<tr><td class='dark' style='min-width:420px;max-width:500px;'><p><strong>No coordinates for current location, last known location used.</strong></p></td></tr>";
        }
        $i = 0;
        $to_last = array();
        while ($arr = mysqli_fetch_assoc($res)) {
            echo makeitem($arr, $type, $i);
        }
    } else {
        if ($type == "Poi") {
            echo '<tr><td class="dark" style="min-width:420px;max-width:500px"><strong>No points of interest.<br />Click the "Points of Interest" text to add one.</strong></td></tr>';
        } else {
            echo '<tr><td class="dark" style="min-width:420px;max-width:500px"><strong>No bookmarks.<br />Click the allegiance icon on the top left corner to add one.</strong></td></tr>';
        }
    }
    echo '</table>';
}
开发者ID:Richterr,项目名称:EDTB,代码行数:31,代码来源:poi.php


示例6: show_list


//.........这里部分代码省略.........
         }
         $count = 0;
         while ($rij = mysqli_fetch_assoc($result)) {
             $count++;
             $this_row = '';
             if ($background == '#38484F') {
                 $background = '#273238';
             } else {
                 $background = '#38484F';
             }
             $dist = false;
             $dist1 = false;
             $exact = "";
             $d_x = "";
             $d_y = "";
             $d_z = "";
             if (array_key_exists("x", $rij) && array_key_exists("y", $rij) && array_key_exists("z", $rij) || array_key_exists("system_name", $rij) || array_key_exists("system_id", $rij)) {
                 $dist = true;
                 $dist1 = true;
                 if (isset($rij["x"]) && isset($rij["y"]) && isset($rij["z"])) {
                     $d_x = $rij["x"];
                     $d_y = $rij["y"];
                     $d_z = $rij["z"];
                 } elseif (isset($rij["system_id"])) {
                     $sys_res = mysqli_query($GLOBALS["___mysqli_ston"], "\tSELECT x, y, z\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM edtb_systems\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE id = '" . $rij["system_id"] . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tLIMIT 1");
                     $found = mysqli_num_rows($sys_res);
                     if ($found > 0) {
                         $sys_arr = mysqli_fetch_assoc($sys_res);
                         $d_x = $sys_arr["x"];
                         $d_y = $sys_arr["y"];
                         $d_z = $sys_arr["z"];
                     }
                 } elseif (isset($rij["system_name"]) || $found == 0) {
                     if (valid_coordinates($rij["ritem_coordx"], $rij["ritem_coordy"], $rij["ritem_coordz"])) {
                         $d_x = $rij["ritem_coordx"];
                         $d_y = $rij["ritem_coordy"];
                         $d_z = $rij["ritem_coordz"];
                     } else {
                         $sys_res = mysqli_query($GLOBALS["___mysqli_ston"], "\tSELECT x, y, z\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM edtb_systems\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE name = '" . mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $rij["system_name"]) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tLIMIT 1");
                         $found = mysqli_num_rows($sys_res);
                         if ($found > 0) {
                             $sys_arr = mysqli_fetch_assoc($sys_res);
                             $d_x = $sys_arr["x"];
                             $d_y = $sys_arr["y"];
                             $d_z = $sys_arr["z"];
                         } else {
                             $sys_own_res = mysqli_query($GLOBALS["___mysqli_ston"], "\tSELECT x, y, z\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM user_systems_own\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE name = '" . mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $rij["system_name"]) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tLIMIT 1");
                             $own_found = mysqli_num_rows($sys_own_res);
                             if ($own_found > 0) {
                                 $sys_own_arr = mysqli_fetch_assoc($sys_own_res);
                                 $d_x = $sys_own_arr["x"];
                                 $d_y = $sys_own_arr["y"];
                                 $d_z = $sys_own_arr["z"];
                             } else {
                                 $d_x = "";
                                 $d_y = "";
                                 $d_z = "";
                             }
                         }
                     }
                 } else {
                     $d_x = "";
                     $d_y = "";
                     $d_z = "";
                 }
             }
开发者ID:padthaitofuhot,项目名称:EDTB,代码行数:67,代码来源:mte.php


示例7: set_data

/**
 * Parse data for Data Point
 *
 * @param string $key field name
 * @param string $value field value
 * @param float $d_x x coordinate
 * @param float $d_y y coordinate
 * @param float $d_z z coordinate
 * @param bool $dist
 * @param string $table table name
 * @param bool $enum
 *
 * @return string $this_row parsed html td tag
 * @author Mauri Kujala <[email protected]>
 */
function set_data($key, $value, $d_x, $d_y, $d_z, &$dist, $table, $enum)
{
    $this_row = "";
    // Regular Expression filter for links
    $reg_exUrl = "/(http|https|ftp|ftps)\\:\\/\\/[a-zA-Z0-9\\-\\.]+\\.[a-zA-Z]{2,3}(\\/\\S*)?/";
    $value = $value == "" ? "n/a" : $value;
    /**
     * show distances
     */
    if ($dist !== false) {
        // figure out what coords to calculate from
        $usable_coords = usable_coords();
        $usex = $usable_coords["x"];
        $usey = $usable_coords["y"];
        $usez = $usable_coords["z"];
        $exact = $usable_coords["current"] === true ? "" : " *";
        if (valid_coordinates($d_x, $d_y, $d_z)) {
            $distance = number_format(sqrt(pow($d_x - $usex, 2) + pow($d_y - $usey, 2) + pow($d_z - $usez, 2)), 2);
            $this_row .= '<td class="datapoint_td" style="white-space:nowrap">' . $distance . $exact . '</td>';
        } else {
            $this_row .= '<td class="datapoint_td">n/a</td>';
        }
        $dist = false;
    }
    /**
     * make a link for systems with an id
     */
    if ($key == "system_id" && $value != "0") {
        $this_row .= '<td class="datapoint_td">';
        $this_row .= '<a href="/System?system_id=' . $value . '">' . $value . '</a>';
        $this_row .= '</td>';
    } elseif (strpos($key, "system_name") !== false && $value != "0" || $key == "name" && $table == "edtb_systems") {
        /**
         * provide crosslinks to screenshot gallery, log page, etc
         */
        $item_crosslinks = System::crosslinks($value);
        $this_row .= '<td class="datapoint_td">';
        $this_row .= '<a href="/System?system_name=' . urlencode($value) . '">' . $value . $item_crosslinks . '</a>';
        $this_row .= '</td>';
    } elseif (strpos($key, "price") !== false || strpos($key, "ls") !== false || strpos($key, "population") !== false || strpos($key, "distance") !== false) {
        if (is_numeric($value) && $value != null) {
            $this_row .= '<td class="datapoint_td">' . number_format($value) . '</td>';
        } else {
            $this_row .= '<td class="datapoint_td">n/a</td>';
        }
    } elseif (preg_match($reg_exUrl, $value, $url)) {
        if (mb_strlen($value) >= 80) {
            $urli = substr($value, 0, 80) . "...";
        } else {
            $urli = $value;
        }
        $this_row .= '<td class="datapoint_td">';
        $this_row .= preg_replace($reg_exUrl, '<a href="' . $url[0] . '" target="_blank">' . $urli . '</a> ', $value);
        $this_row .= '</td>';
    } elseif ($enum !== false) {
        switch ($value) {
            case "0":
                $real_value = '<span class="enum_no">&#10799;</span>';
                break;
            case "1":
                $real_value = '<span class="enum_yes">&#10003;</span>';
                break;
            default:
                $real_value = "n/a";
        }
        $this_row .= '<td class="datapoint_td" style="text-align:center">' . $real_value . '</td>';
    } else {
        $this_row .= '<td class="datapoint_td">' . substr(strip_tags($value), 0, 100) . '</td>';
    }
    /**
     *  parse log entries
     */
    if ($key == "log_entry") {
        if (mb_strlen($value) >= 100) {
            $this_row = '<td class="datapoint_td">' . substr(strip_tags($value), 0, 100) . '...</td>';
        } else {
            $this_row = '<td class="datapoint_td">' . $value . '</td>';
        }
    }
    return $this_row;
}
开发者ID:DBnR1,项目名称:EDTB,代码行数:96,代码来源:functions.php


示例8: get_distance

/**
 * Return distance from current to $system
 *
 * @param string|int $system
 * @param bool $is_id
 * @return string $distance
 * @author Mauri Kujala <[email protected]>
 */
function get_distance($system, $is_id = false)
{
    // fetch target coordinates
    $res = mysqli_query($GLOBALS["___mysqli_ston"], "\t(SELECT\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tedtb_systems.x AS target_x,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tedtb_systems.y AS target_y,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tedtb_systems.z AS target_z\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM edtb_systems\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE edtb_systems.name = '" . mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $system) . "')\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tUNION\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t(SELECT\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tuser_systems_own.x AS target_x,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tuser_systems_own.y AS target_y,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tuser_systems_own.z AS target_z\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM user_systems_own\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE user_systems_own.name = '" . mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $system) . "')\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tLIMIT 1") or write_log(mysqli_error($GLOBALS["___mysqli_ston"]), __FILE__, __LINE__);
    $arr = mysqli_fetch_assoc($res);
    $target_x = $arr["target_x"];
    $target_y = $arr["target_y"];
    $target_z = $arr["target_z"];
    // figure out what coords to calculate from
    $usable_coords = usable_coords();
    $usex = $usable_coords["x"];
    $usey = $usable_coords["y"];
    $usez = $usable_coords["z"];
    $exact = $usable_coords["current"] === true ? "" : " *";
    if (valid_coordinates($target_x, $target_y, $target_z)) {
        $dist = number_format(sqrt(pow($target_x - $usex, 2) + pow($target_y - $usey, 2) + pow($target_z - $usez, 2)), 2);
        $distance = $dist . ' ly' . $exact;
    } else {
        $distance = '';
    }
    return $distance;
}
开发者ID:tripflip,项目名称:EDTB,代码行数:30,代码来源:functions.php


示例9: __construct

 /**
  * NearestSystems constructor.
  */
 public function __construct()
 {
     global $server, $user, $pwd, $db;
     /**
      * connect to database
      */
     $this->mysqli = new mysqli($server, $user, $pwd, $db);
     if ($this->mysqli->connect_errno) {
         echo "Failed to connect to MySQL: " . $this->mysqli->connect_error;
     }
     /**
      * determine what coordinates to use
      */
     $this->system = isset($_GET["system"]) ? $_GET["system"] + 0 : "";
     if (!empty($this->system)) {
         $query = "  SELECT name, id, x, y, z\n                        FROM edtb_systems\n                        WHERE id = '{$this->system}'\n                        LIMIT 1";
         $result = $this->mysqli->query($query) or write_log($this->mysqli->error, __FILE__, __LINE__);
         $sys_obj = $result->fetch_object();
         $sys_name = $sys_obj->name;
         $sys_id = $sys_obj->id;
         $this->usex = $sys_obj->x;
         $this->usey = $sys_obj->y;
         $this->usez = $sys_obj->z;
         $result->close();
         $this->text .= ' (to <a href="/System?system_id=' . $sys_id . '">' . $sys_name . '</a>) ';
         $this->power_params .= "&system=" . $this->system;
         $this->allegiance_params .= "&system=" . $this->system;
         $this->hidden_inputs .= '<input type="hidden" name="system" value="' . $sys_id . '" />';
     } elseif (valid_coordinates($curSys["x"], $curSys["y"], $curSys["z"]) && empty($this->system)) {
         $this->usex = $curSys["x"];
         $this->usey = $curSys["y"];
         $this->usez = $curSys["z"];
     } else {
         // get last known coordinates
         $last_coords = last_known_system();
         $this->usex = $last_coords["x"];
         $this->usey = $last_coords["y"];
         $this->usez = $last_coords["z"];
         $this->is_unknown = " *";
     }
     /**
      * If we still don't have valid coordinates, center on Sol
      */
     if (!valid_coordinates($this->usex, $this->usey, $this->usez)) {
         $this->usex = "0";
         $this->usey = "0";
         $this->usez = "0";
         $this->is_unknown = " *";
     }
 }
开发者ID:DBnR1,项目名称:EDTB,代码行数:53,代码来源:NearestSystems.php


示例10: json_decode

 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 */
if (isset($_GET["do"])) {
    /** @require config */
    require_once $_SERVER["DOCUMENT_ROOT"] . "/source/config.inc.php";
    /** @require functions */
    require_once $_SERVER["DOCUMENT_ROOT"] . "/source/functions.php";
    /** @require MySQL */
    require_once $_SERVER["DOCUMENT_ROOT"] . "/source/MySQL.php";
    $data = json_decode($_REQUEST["input"], true);
    $p_system = $data["poi_system_name"];
    $p_name = $data["poi_name"];
    $p_x = $data["poi_coordx"];
    $p_y = $data["poi_coordy"];
    $p_z = $data["poi_coordz"];
    if (valid_coordinates($p_x, $p_y, $p_z)) {
        $addc = ", x = '" . $p_x . "', y = '" . $p_y . "', z = '" . $p_z . "'";
        $addb = ", '" . $p_x . "', '" . $p_y . "', '" . $p_z . "'";
    } else {
        $addc = ", x = null, y = null, z = null";
        $addb = ", null, null, null";
    }
    $p_entry = $data["poi_text"];
    $p_id = $data["poi_edit_id"];
    $category_id = $data["category_id"];
    if ($p_id != "") {
        mysqli_query($GLOBALS["___mysqli_ston"], "\tUPDATE user_poi SET\n\t\t\t\t\t\t\t\t\t\t\t\t\tpoi_name = '" . mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $p_name) . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\tsystem_name = '" . mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $p_system) . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\ttext = '" . mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $p_entry) . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\tcategory_id = '" . $category_id . "'" . $addc . "\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE id = '" . $p_id . "'") or write_log(mysqli_error($GLOBALS["___mysqli_ston"]), __FILE__, __LINE__);
    } elseif (isset($_GET["deleteid"])) {
        mysqli_query($GLOBALS["___mysqli_ston"], "\tDELETE FROM user_poi\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE id = '" . $_GET["deleteid"] . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\tLIMIT 1") or write_log(mysqli_error($GLOBALS["___mysqli_ston"]), __FILE__, __LINE__);
    } else {
        mysqli_query($GLOBALS["___mysqli_ston"], "\tINSERT INTO user_poi (poi_name, system_name, text, category_id, x, y, z)\n\t\t\t\t\t\t\t\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t('" . mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $p_name) . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $p_system) . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $p_entry) . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $category_id . "'" . $addb . ")") or write_log(mysqli_error($GLOBALS["___mysqli_ston"]), __FILE__, __LINE__);
开发者ID:tripflip,项目名称:EDTB,代码行数:31,代码来源:poi.php


示例11: mysqli_query

$add = "";
$hidden_inputs = "";
//  determine what coordinates to use
if (!empty($system)) {
    $sys_res = mysqli_query($GLOBALS["___mysqli_ston"], "\tSELECT name, id, x, y, z\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM edtb_systems\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE id = '" . $system . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tLIMIT 1") or write_log(mysqli_error($GLOBALS["___mysqli_ston"]), __FILE__, __LINE__);
    $sys_arr = mysqli_fetch_assoc($sys_res);
    $sys_name = $sys_arr["name"];
    $sys_id = $sys_arr["id"];
    $usex = $sys_arr["x"];
    $usey = $sys_arr["y"];
    $usez = $sys_arr["z"];
    $text .= " (to <a href='system.php?system_id=" . $sys_id . "'>" . $sys_name . "</a>) ";
    $addtolink .= "&system=" . $system . "";
    $addtolink2 .= "&system=" . $system . "";
    $hidden_inputs .= '<input type="hidden" name="system" value="' . $sys_id . '" />';
} elseif (valid_coordinates($curSys["x"], $curSys["y"], $curSys["z"]) && empty($system)) {
    $usex = $curSys["x"];
    $usey = $curSys["y"];
    $usez = $curSys["z"];
} else {
    // get last known coordinates
    $last_coords = last_known_system();
    $usex = $last_coords["x"];
    $usey = $last_coords["y"];
    $usez = $last_coords["z"];
    $is_unknown = " *";
}
$ship_name = isset($_GET["ship_name"]) ? $_GET["ship_name"] : "";
$facility = isset($_GET["facility"]) ? $_GET["facility"] : "";
$only = isset($_GET["allegiance"]) ? $_GET["allegiance"] : "";
$system_allegiance = isset($_GET["system_allegiance"]) ? $_GET["system_allegiance"] : "";
开发者ID:padthaitofuhot,项目名称:EDTB,代码行数:31,代码来源:nearest_systems.php


示例12: last_known_system

/**
 * determine coordinates for the map distance calculations
 */
if (valid_coordinates($curSys["x"], $curSys["y"], $curSys["z"])) {
    $ucoordx = $curSys["x"];
    $ucoordy = $curSys["y"];
    $ucoordz = -$curSys["z"];
} else {
    // get last known coordinates
    $last_coords = last_known_system();
    $ucoordx = $last_coords["x"];
    $ucoordy = $last_coords["y"];
    $ucoordz = -$last_coords["z"];
    $is_unknown = " *";
}
if (!valid_coordinates($ucoordx, $ucoordy, $ucoordz)) {
    $ucoordx = "0";
    $ucoordy = "0";
    $ucoordz = "0";
    $is_unknown = " *";
}
?>
    <!-- Three.js -->
    <script src="/source/Vendor/three.min.js"></script>
    <!-- ED3D-Galaxy-Map -->
    <link href="Vendor/ED3D-Galaxy-Map/css/styles.css?ver=<?php 
echo $settings["edtb_version"];
?>
" rel="stylesheet" type="text/css" />
    <script src="Vendor/ED3D-Galaxy-Map/js/ed3dmap.js"></script>
开发者ID:DBnR1,项目名称:EDTB,代码行数:30,代码来源:index.php


示例13: show_list


//.........这里部分代码省略.........
                $field_type[$Field] = $Type;
            }
            $cols->close();
            $count = 0;
            while ($data = $result->fetch_object()) {
                $count++;
                $this_row = "";
                $background = $background == "#38484f" ? "#273238" : "#38484f";
                $dist = false;
                $dist1 = false;
                $d_x = "";
                $d_y = "";
                $d_z = "";
                $esc_sys_name = $this->mysqli->real_escape_string($data->system_name);
                if (property_exists($data, "x") && property_exists($data, "y") && property_exists($data, "z") || property_exists($data, "system_name") || property_exists($data, "system_id")) {
                    $dist = true;
                    $dist1 = true;
                    if (isset($data->x) && isset($data->y) && isset($data->z)) {
                        $d_x = $data->x;
                        $d_y = $data->y;
                        $d_z = $data->z;
                    } elseif (isset($data->system_id)) {
                        $query = "  SELECT x, y, z\n                                    FROM edtb_systems\n                                    WHERE id = '{$data->system_id}'\n                                    LIMIT 1";
                        $coord_result = $this->mysqli->query($query);
                        $found = $coord_result->num_rows;
                        if ($found > 0) {
                            $obj = $coord_result->fetch_object();
                            $d_x = $obj->x;
                            $d_y = $obj->y;
                            $d_z = $obj->z;
                        }
                        $coord_result->close();
                    } elseif (isset($data->system_name) || $found == 0) {
                        if (valid_coordinates($data->ritem_coordx, $data->ritem_coordy, $data->ritem_coordz)) {
                            $d_x = $data->ritem_coordx;
                            $d_y = $data->ritem_coordy;
                            $d_z = $data->ritem_coordz;
                        } else {
                            $query = "  SELECT x, y, z\n                                        FROM edtb_systems\n                                        WHERE name = '{$esc_sys_name}'\n                                        LIMIT 1";
                            $coord_result = $this->mysqli->query($query);
                            $found = $coord_result->num_rows;
                            if ($found > 0) {
                                $obj = $coord_result->fetch_object();
                                $d_x = $obj->x;
                                $d_y = $obj->y;
                                $d_z = $obj->z;
                            } else {
                                $query = "  SELECT x, y, z\n                                            FROM user_systems_own\n                                            WHERE name = '{$esc_sys_name}'\n                                            LIMIT 1";
                                $coord_result = $this->mysqli->query($query);
                                $own_found = $coord_result->num_rows;
                                if ($own_found > 0) {
                                    $obj = $coord_result->fetch_object();
                                    $d_x = $obj->x;
                                    $d_y = $obj->y;
                                    $d_z = $obj->z;
                                } else {
                                    $d_x = "";
                                    $d_y = "";
                                    $d_z = "";
                                }
                            }
                            $coord_result->close();
                        }
                    } else {
                        $d_x = "";
                        $d_y = "";
开发者ID:DBnR1,项目名称:EDTB,代码行数:67,代码来源:mte.php


示例14: add_poi

 /**
  * Add, update or delete poi from the database
  *
  * @param object $data
  */
 public function add_poi($data)
 {
     $p_system = $data->{"poi_system_name"};
     $p_name = $data->{"poi_name"};
     $p_x = $data->{"poi_coordx"};
     $p_y = $data->{"poi_coordy"};
     $p_z = $data->{"poi_coordz"};
     if (valid_coordinates($p_x, $p_y, $p_z)) {
         $addc = ", x = '{$p_x}', y = '{$p_y}', z = '{$p_z}'";
         $addb = ", '{$p_x}', '{$p_y}', '{$p_z}'";
     } else {
         $addc = ", x = null, y = null, z = null";
         $addb = ", null, null, null";
     }
     $p_entry = $data->{"poi_text"};
     $p_id = $data->{"poi_edit_id"};
     $category_id = $data->{"category_id"};
     $esc_name = $this->mysqli->real_escape_string($p_name);
     $esc_sysname = $this->mysqli->real_escape_string($p_system);
     $esc_entry = $this->mysqli->real_escape_string($p_entry);
     if ($p_id != "") {
         $stmt = "   UPDATE user_poi SET\n                        poi_name = '{$esc_name}',\n                        system_name = '{$esc_sysname}',\n                        text = '{$esc_entry}',\n                        category_id = '{$category_id}'" . $addc . "\n                        WHERE id = '{$p_id}'";
     } elseif (isset($_GET["deleteid"])) {
         $stmt = "   DELETE FROM user_poi\n                        WHERE id = '" . $_GET["deleteid"] . "'\n                        LIMIT 1";
     } else {
         $stmt = "   INSERT INTO user_poi (poi_name, system_name, text, category_id, x, y, z, added_on)\n                        VALUES\n                        ('{$esc_name}',\n                        '{$esc_sysname}',\n                        '{$esc_entry}',\n                        '{$category_id}'" . $addb . ",\n                        UNIX_TIMESTAMP())";
     }
     $this->mysqli->query($stmt) or write_log($this->mysqli->error, __FILE__, __LINE__);
 }
开发者ID:DBnR1,项目名称:EDTB,代码行数:34,代码来源:PoiBm.php



注:本文中的valid_coordinates函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP valid_email函数代码示例发布时间:2022-05-23
下一篇:
PHP valid_auth函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap