關於部落格
「 相本、程式....Not worth a rap 。」
  • 16698

    累積人氣

  • 0

    今日人氣

    0

    追蹤人氣

細說Nuke Map

 

if(!eregi("modules.php", $_SERVER['PHP_SELF'])){
    die ("You can't access this file directly...");
}
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
get_lang($module_name);
$index = 0;
$apikey = "ABQIAAAAPndrXJYYZwy_O4deGC_7ExSAs95Zm9k9Q5fn0myZW3IuLw6EXhTm4fNAD0ACx3lqfOFDu29WsKiLbQ";

// Addlist 這個 function 是測量距離的
function Addlist() {
 global $module_name, $user, $apikey;
 include("header.php");
// title("Member List Map"); // title 名稱是什麼區域名稱就會顯示什麼,如下↓
 OpenTable(); // 開啟主要map區塊
 if($userinfo = getusrinfo($user)){
 echo "<p class = "mapmenu">" . _maptext051 . " | <a href="modules.php?name=$module_name">" . _maptext001 . "</a> | <a href="modules.php?name=$module_name&amp;file=index&amp;func=location">" . _maptext004 . "</a></p><br>";
 }else{
 echo "<p class = "mapmenu">" . _maptext051 . " | <a href="modules.php?name=$module_name">" . _maptext001 . "</a></p><br>";
 } 
 
echo "<table border="0" width="100%" height="650" id="table1">
    <tr>   
       <td colspan="2">    
       <script src="http://maps.google.com/maps?file=api&v=2.s&key=$apikey" type="text/javascript"></script> 
     <input type="button" value="計算距離" onclick="showInfo()" />
     <input type="button" value="重新整理" onclick="location.reload()">
 
<div id="map" style="width: 100%; height: 100%; color:black"></div ><br />    
<script type="text/javascript">
   //<![CDATA[       
    GMarker.prototype.setIndex = function(index){
            this.index = index;
         }    
    var map;    
    var polyline;    
    var markers = [];
 
   // 通過複製產一個個的標記點
 var myIcon= new GIcon(G_DEFAULT_ICON, "images/map/marker.png");
 
  //創建地標
function createMarker(point) {
     var marker = new GMarker(point, {icon: myIcon, draggable: true, bouncy: true});
     var index = markers.length;       
 
  //雙擊地標刪除該地標
     GEvent.addListener(marker, 'dblclick', function(){
     deleteMarker(marker);
           });
      
      // drag事件
      // 注意,如果新增了polyline,則拖動地標時需要重畫路線
      GEvent.addListener(marker, 'drag', function() {
                            redrawPolyline();
                          });
     
      marker.setIndex(index);
      markers[index] = marker;
      map.addOverlay(marker);
       
     // 每創建一個新的地標就重畫一次
      redrawPolyline();
    }
   
    // 雙擊地標刪除該地標 
function deleteMarker(marker){
    // 彈出視窗尋問是否要刪除該標記點
      if(!confirm("確定刪除該地標嗎?")) return;    
      var index = marker.index;      
      //移除該圖層
      map.removeOverlay(marker);      
      //從數組中刪除指定GMarker並更新index
      for(var i = index; i<markers.length-1; i++){
          markers[i+1].setIndex(i);
          markers[i] = markers[i+1];
      }
      markers.length = markers.length-1;
    }
    
    // 載入地圖
    function loadMap(){
      if (GBrowserIsCompatible()){ 
        map = new GMap2(document.getElementById("map"));
    
    // 小的控制軸,其它類型請看這裡
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
        var centerPoint= new GLatLng(23.095265, 120.276151);
        map.setCenter(centerPoint, 12);         
        GEvent.addListener(map, 'click', function(overlay,  point) {
                           if(point) createMarker(point);
                         });
      }
    }
   
    // 新增行程路線
function addPolyline(){
    // 創建
      var points = [];
      for(var i=0; i<markers.length; i++){
      points[i] = markers[i].getPoint();
  }
       polyline = new GPolyline(
       points, //GLatLng()數組
        "#FF0000", // 折線顏色
        5, // 折線寬度
        0.5 // 透明度
        );
      map.addOverlay(polyline);
    }
   
    // 刪除行程路線
    function removePolyline() {
    polyline.remove();
    polyline = null;
    }
   
    // 重畫行程路線
    function redrawPolyline(){
      if(polyline){
        removePolyline();
      }
      addPolyline();
    }
 

// 距離算式    
function getDistance2(from, to, unit) {
        // 地球半徑
        var R = 6378.137;
        // 千米英里轉化進制
        var M = 1.609344;
        with (Math){
        var lat1 = from.latRadians();
        var lng1 = from.lngRadians();
        var lat2 = to.latRadians();
        var lng2 = to.lngRadians();             
        var dist = Math.round((2 * asin(sqrt( pow( (sin( (lat1 - lat2) /2 ) ), 2) + cos(lat1) * cos(lat2) * pow( (sin( (lng1 - lng2) / 2) ) ,2) ) ) * R) * Math.pow(2, 2)) / Math.pow(2, 2);
        }         
        if (unit=="M") {
            dist = dist / M;
        }
        return dist;
    }
   
    function getDistance() {
        var dist  = 0;         
        // 折線上總的頂點數
        var count = polyline.getVertexCount();
         // 歷遍所有頂點,計算距離
        for(var i=0; i<count-1; i++){ 
        dist  += Math.round((getDistance2(polyline.getVertex(i), polyline.getVertex(i+1))) * Math.pow(2,2)) / Math.pow(2,2);
       }
        return dist;
    }
    
    function showInfo() {
        alert("折線總距離為 " + getDistance() + " 公里");
    }

 //監聽下載事件
     if (window.attachEvent) {
      window.attachEvent("onload", function() {
       loadMap(); // Internet Explorer
      }
      );
     }
     else {
      window.addEventListener("load", function() {
       loadMap(); // Firefox and standard browsers
      }, false);
     }
     
     if (window.attachEvent)   {
      window.attachEvent("onunload", function()  {
       GUnload(); // Internet Explorer
      }
      );
     } else  {
      window.addEventListener("onunload", function()  {
      // GUnload(); // Firefox and standard browsers
      }, false);
     }
   
     //]]&gt;
    </script>
    </td>
   </tr>
   <tr>
<!-- 版權宣告 -->
     <td height="10" colspan="2" align="center" >Powered&nbsp;&nbsp;by&nbsp;&nbsp;<a href="http://umi.tw" target="_blank">UMI</a></td>
   </tr>     
  </table>";
    CloseTable();
    include("footer.php");   
}

//共乘網文字快速搜尋
function Wrdsearch(){
 global $module_name, $user;
 include("header.php");
 OpenTable();
 if($userinfo = getusrinfo($user)){
 echo "<p class = "mapmenu"><a href="modules.php?name=$module_name&amp;file=index&amp;func=addlist">" . _maptext051 . "</a> | <a href="modules.php?name=$module_name">" . _maptext001 . "</a> | " . _maptext056 . " | <a href="modules.php?name=$module_name&amp;file=index&amp;func=location">" . _maptext004 . "</a></p><br>";
 }else{
 echo "<p class = "mapmenu"><a href="modules.php?name=$module_name&amp;file=index&amp;func=addlist">" . _maptext051 . "</a> | <a href="modules.php?name=$module_name">" . _maptext001 . "</a> | " . _maptext056 . " </p><br>";
 }

//之所以會寫22是因為大概是我的sql判斷式會讓它自動減二所以用22讓它扣這樣一頁就維持20個
// 在select 裡把正確的資料庫名稱key上

$rows = mysql_query("SELECT username,useridentity, usersex, user_start, user_aim, user_ovatime, user_lastvisit FROM ".$prefix."_users where name > "0" and user_latitude > "0" and user_start > "0" order by user_lastvisit DESC");   
$total = mysql_num_rows($rows);
$show = ceil($total/22); //每頁幾筆資料
echo ""._maptext047."<font color="#ff0000"> $total </font>"._maptext054.""._maptext055."";
for($i=1;$i<=$show;$i++){
echo "<a href="modules.php?op=modload&amp;name=$module_name&amp;func=wrdsearch&amp;page=$i">$i</a> │ ";
}
$page = $_GET["page"];
if(empty($page))$page=1;
$start=22*($page-1);
$sql = "SELECT username,useridentity, usersex, user_start, user_aim, user_ovatime, user_lastvisit FROM ".$prefix."_users where name > "0" and user_latitude > "0" and user_start > "0" order by user_lastvisit DESC limit $start,22";
$result = mysql_query($sql);

echo "<table width="100%" border="1" align="center" cellpadding="5" cellspacing="0">
  <tr>
    <td align="center">"._maptext039."</td>
    <td align="center">"._maptext057."</td>
    <td align="center">"._maptext059."</td>
    <td align="center">"._maptext036."</td>
    <td align="center">"._maptext037."</td>
    <td align="center">"._maptext052."</td>
    <td align="center">"._maptext058."</td>
    <td align="center">"._maptext020."</td>
  </tr>";

// 照變數順序寫唷!
while (list($username, $useridentity, $usersex, $userstart, $useraim, $userovatime, $usrinfo[user_lastvisit]) = mysql_fetch_row($result)){ 
$usrinfo[user_lastvisit] = date("Y/m/j H:i:s", $usrinfo[user_lastvisit]);
// D M j H:i:s T Y  →  Thu Sep 18 17:33:39 CST 2008 ← 時間碼的轉換,這段超重要的。
if ($useridentity == 0){
  $useridentity = "駕駛";
   }elseif($useridentity == 1){
  $useridentity = "乘客";
   } 
if ($usersex == 0){
  $usersex = "女";
   }elseif($usersex == 1){
  $usersex = "男";
   } 
echo "<tr>
    <td align="center">$username</td>
    <td align="center">$useridentity</td>
    <td align="center">$usersex</td>
    <td align="center">$userstart</td>
    <td align="center">$useraim</td>
    <td align="center">$userovatime</td>
    <td align="center">$usrinfo[user_lastvisit]</td>";
if($userinfo = getusrinfo($user)){   
echo "<td align="center"><a href="modules.php?name=Your_Account&op=userinfo&username=$username">" . _maptext020 . "</a></td>";
}else{
echo "<td align="center">" . _maptext020 . "</td>";
}
echo "</tr>";

 }
echo "</table>";  
 CloseTable();
  include("footer.php");
}

// ViewMembers 這個 function 是共乘會員的
function ViewMembers() {
 global $module_name, $user, $apikey;
    include("header.php");
    //title("Member List Map");
    $visitornumber = $db->sql_query("select * from ".$prefix."_session");
   $numbervisitors = $db->sql_numrows($visitornumber);
  // $iconstyle="purple.png"; 原先的ICON,但因這裡分二種(駕駛/會員),所以註解掉
 
OpenTable();
if($userinfo = getusrinfo($user)){
   echo "<p class = "mapmenu"><a href="modules.php?name=$module_name&amp;file=index&amp;func=addlist">" . _maptext051 . "</a> │ " . _maptext001 . " | <a href="modules.php?name=$module_name&amp;file=index&amp;func=location">" . _maptext004 . "</a>";
  echo " │ <a href="javascript:location='/modules.php?name=Nuke_Map'; window.open('http://shyau.com.tw/nestedif.php','characters','height=480, width=740, scrollbars=no')">" . _maptext042 . "</a> | <a href="javascript:location='/modules.php?name=Nuke_Map'; window.open('/usetext/005.html','characters','height=1169, width=850, scrollbars=yes')"><img src="usetext/next.gif" width="17" height="11" border="0" />"._tech."</a></p></br> ";  
     $userinfo = getusrinfo($user);
     $theuser = $userinfo[username];   
} else {
 echo "<p class = "mapmenu"><a href="modules.php?name=$module_name&amp;file=index&amp;func=addlist">" . _maptext051 . "</a> │ " . _maptext001 . "";
 
 echo " │ <a href="javascript:location='/modules.php?name=Nuke_Map'; window.open('http://shyau.com.tw/nestedif.php','characters','height=480, width=740, scrollbars=no')">" . _maptext042 . "</a> | <a href="javascript:location='/modules.php?name=Nuke_Map'; window.open('/usetext/005.html','characters','height=1169, width=850, scrollbars=yes')"><img src="usetext/next.gif" width="17" height="11" border="0" />"._tech."</a></p></br> ";  
 } 

$sql = "SELECT * FROM $prefix"._users." WHERE useridentity=0";
$result = $db->sql_query($sql);
$driver_num = $db->sql_numrows($result);

$sql = "SELECT * FROM $prefix"._users." WHERE useridentity=1";
$result = $db->sql_query($sql);
$passenger_num = $db->sql_numrows($result);
 

echo "<style type="text/css">
// 加入搜尋引擎的CSS,也可以下載改路徑丟到自己的資料夾中
      @import url("http://www.google.com/uds/css/gsearch.css");
      @import url("http://www.google.com/uds/solutions/localsearch/gmlocalsearch.css");
      }
    </style>
";

echo "<table border="0" width="100%" height="650" id="table1">
     <tr><td colspan="2" height="40"><table width="100%" >
     <tr>
        <td rowspan="2" align="center" width="80" height="30" ><img src="images/map/car.gif" border="0"  width="38" height="25" ><br> " . _maptext038 . "" . _maptext040 . "</td>
        <td rowspan="2" align="center" width="80" height="30" ><img src="images/map/human.png" border="0" height="25" ><br> " . _maptext038 . "" . _maptext041 . "</td>
        <td align="right" height="20" ><!--" . _maptext047 . "<font color="red"> $driver_num </font>" . _maptext048 . "<font color="red"> $passenger_num </font>" . _maptext049 . "--></td>
      </tr>
      <tr>
        <td colspan="3" align="right"><font color="#FF0000"><b>" . _maptext053 . "</b></font></td>
      </tr>
</table></td></tr>
    <tr>
     <td width="20%">
         <div id="side_bar" valign="top" style="width: 100%; height: 100%; background-color:#F4F4F4; color: #4444ff;"></div>
     </td>    
     <td width="80%">
<script src=http://maps.google.com/maps?file=api&v=2.s&key=$apikey type="text/javascript"></script> 
<!-- GSEARCH 必需加入的JAVA -->
<script src="http://www.google.com/uds/api?file=uds.js&amp;v=1.0" type="text/javascript"></script>
<script src="/modules/Nuke_Map/gmlocalsearch.js" type="text/javascript"></script>  
     <div id="map" style="width: 100%; height: 100%; color:black"></div ><br />
     <script type="text/javascript">
     //<![CDATA[
     var icon = new GIcon();
     icon.image = "images/map/marker.png";
     //icon.shadow = "images/map/shadow.png";
     icon.iconSize = new GSize(30, 30); //小汽球的尺寸
     //icon.shadowSize = new GSize(33, 20);
     icon.iconAnchor = new GPoint(9, 20);
     icon.infoWindowAnchor = new GPoint(9, 2);
     icon.infoShadowAnchor = new GPoint(18, 25);
     
// 左邊的會員邊條     

     var side_bar_html = "";
     var gmarkers = [];  
     var i = 0;  
      function createMarker(point, html, style, name, time, start, end) {
      // FF 1.5 fix
      html = '<div align="left" style="white-space:nowrap;"><font color="#000000">' + html + '</font></div>';
        icon.image = 'images/map/' + style + '.gif';      
      var marker = new GMarker(point, icon);
      GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml(html);});          
          gmarkers[i] = marker;
            side_bar_html += '&#8211;<a href="javascript:myclick(' + i + ')"><font color="#BF0000">' + name + '&nbsp;&nbsp;' + time + '</font><br>&nbsp;&nbsp;&nbsp;'+ start + '&#8211;' + end + '</a><br>';
            i++;                  
          return marker;          
        }
          function myclick(i) {
              // trigger 觸發
              GEvent.trigger(gmarkers[i], "click", function() {marker.openInfoWindowHtml(html);});
        }                

  function loadMap()
     {
      var map = new GMap2(document.getElementById("map"));
      map.addControl(new GSmallMapControl());
      map.addControl(new GMapTypeControl()); 
      map.setCenter(new GLatLng(23.095265, 120.276151), 11); 
      map.addControl(new google.maps.LocalSearch(), new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(5,5)));   
      ";
      
       $sql = "SELECT avatar_path, avatar_gallery_path FROM FROM ".$prefix."_bbconfig";
      if( !($result = $db->sql_query($sql)) )
      {
       $avatarpath = "modules/Forums/images/avatars";
       $avatargallerypath = "modules/Forums/images/avatars";
    
  } else {
       $avatarpath = $row['avatar_path'];
       $avatargallerypath = $row['avatar_gallery_path'];
      }

      $sql = "SELECT username, user_avatar, user_id, user_regdate, user_from, user_start, user_ovatime, user_aim, user_icq, user_aim, user_yim, useridentity, user_posts, user_avatar_type, user_latitude, user_longitude FROM ".$prefix."_users where name > "0" order by user_lastvisit desc LIMIT 0,10";
      if( !($result = $db->sql_query($sql)) ) {
       message_die(GENERAL_ERROR, 'Could not query users', '', __LINE__, __FILE__, $sql);
      }

      if ( $row = $db->sql_fetchrow($result) ) {
       do {
        if ( $row['user_latitude'] == "") {
         // No location
        } else  {
         $username = $row['username'];
         $user_id = $row['user_id'];
         $userlat = $row['user_latitude'];
         $userlong = $row['user_longitude'];
         $userpic = $row['user_avatar'];
         $userposts = $row['user_posts'];
         $userovatime = $row['user_ovatime'];
         $useravatartype = $row['user_avatar_type'];
         $userreg = $row['user_regdate'];
         $userloc = $row['user_from'];
         $userstart = $row['user_start'];
         $usericq = $row['user_icq'];
         $useraim = $row['user_aim'];
         $useridentity = $row['useridentity'];
         $iconstyle = "marker";   
         
         // Remove bad chars from the name and location
         $username = htmlspecialchars($username, ENT_QUOTES);
         $userloc = htmlspecialchars($userloc, ENT_QUOTES);
         $usericq = htmlspecialchars($usericq, ENT_QUOTES);
         $useraim = htmlspecialchars($useraim, ENT_QUOTES);
         $useridentity = htmlspecialchars($useridentity, ENT_QUOTES);
                 
                               
         // Setup the avatar images
         if ($useravatartype == 1) {
          // hosted by our site
          $userpic = $avatarpath . "/" . $userpic;
         }
         elseif ($useravatartype == 2) {
          // hosted externally so image should be ok
         } else {
          // user upload
          $userpic = $avatargallerypath . "/" . $userpic;
         }
         if ($useridentity == 0){
          $useridentity = "駕駛";
          $iconstyle = "car2";
         }
        elseif ($useridentity == 1){
           $useridentity = "乘客";
           $iconstyle = "human";
         }

// 跟上面的 function createMarker(point, html, style, name, time, start, end) 順序要相同,這是彼此對應的
if($userinfo = getusrinfo($user)){
         $markertext = "<table border="0" width="300" cellspacing="0" cellpadding="0" id="mapinfo"><tr><td width="120" valign="top"><p align="center"><img width="100" border="0" src="$userpic" align="left"></td><td valign="top"><font color="#000000">" . _maptext039 . ":<b>$username</b><br>" . _maptext038 . ": $useridentity<br>". _maptext036 . ": $userstart<br>". _maptext037 . ": $useraim<br>"  . _maptext018 . ": $userreg<br>" . _maptext052 . ": $userovatime<br><a href="modules.php?name=Your_Account&op=userinfo&username=$username">" . _maptext020 . "</a><br><a href="modules.php?name=Private_Messages&file=index&mode=post&u=$user_id">" . _maptext021 . "</a></font></td></tr></table>";
                 }else{
         $markertext = "<table border="0" width="300" cellspacing="0" cellpadding="0" id="mapinfo"><tr><td width="120" valign="top"><p align="center"><img width="100" border="0" src="$userpic" align="left"></td><td valign="top"><font color="#000000">" . _maptext039 . ":<b>$username</b><br>" . _maptext038 . ": $useridentity<br>". _maptext036 . ": $userstart<br>". _maptext037 . ": $useraim<br>"  . _maptext018 . ": $userreg<br>" . _maptext052 . ": $userovatime</font></td></tr></table>";
                } 
         
         echo "var point = new GPoint($userlong, $userlat);";
         echo "var marker = createMarker(point, '$markertext', '$iconstyle', '$username', '$usrinfo[user_lastvisit]', '$userstart', '$useraim');";
 
         echo "map.addOverlay(marker);";
         echo "document.getElementById("side_bar").innerHTML = side_bar_html;";         
        }
       }
       while ( $row = $db->sql_fetchrow($result) );
      }
      echo "
     }  

// arrange for our onload handler to 'listen' for onload events
     if (window.attachEvent) {
      window.attachEvent("onload", function(){
       loadMap(); // Internet Explorer
      }
    );
 }  else  {
      window.addEventListener("load", function() {
       loadMap(); // Firefox and standard browsers
      }, false);
     }
     //]]&gt;
        </script>
    </td>
   </tr>
   <tr>
     <td height="10" colspan="2" align="center" >Powered&nbsp;&nbsp;by&nbsp;&nbsp;<a href="http://umi.tw" target="_blank">UMI</a></td></tr></table>";
 
 CloseTable();
    include("footer.php");   
}

// SetupLocatioin 這個 function 是會員插針的
function SetupLocation() {
 global $module_name, $user, $apikey;
 include("header.php");
 //title("Member List Map");
OpenTable();
 if($userinfo = getusrinfo($user)) {
    echo "<p class = "mapmenu"><a href="modules.php?name=$module_name&amp;file=index&amp;func=addlist">" . _maptext051 . "</a> │ <a href="modules.php?name=$module_name">" . _maptext001 . "</a> | " . _maptext004 . "";
    echo " │ <a href="javascript:location='/modules.php?name=Nuke_Map'; window.open('http://shyau.com.tw/nestedif.php','characters','height=480, width=740, scrollbars=no')">" . _maptext042 . "</a></p></br> ";  

  $userinfo = getusrinfo($user);
  $theuser = $userinfo[username];

// 拉出使用者
  $sql = "SELECT user_id FROM ".$prefix."_users WHERE username = '$theuser'";
  $query = $db->sql_query($sql);
  $useridno = mysql_result($query, 0, 0);
  
// 使用者緯度
  $sql = "SELECT user_latitude FROM ".$prefix."_users WHERE username = '$theuser'";
  $query = $db->sql_query($sql);
  $userlat = mysql_result($query, 0, 0);
   
// 使用者經度
  $sql = "SELECT user_longitude FROM ".$prefix."_users WHERE username = '$theuser'";
  $query = $db->sql_query($sql);
  $userlong = mysql_result($query, 0, 0);

  if (!$userlat) {
 // 您尚未設定您的位置,說明文字
 echo "<a href="javascript:location='/modules.php?name=Nuke_Map'; window.open('http://shyau.com.tw/nestedif.php','characters','height=480, width=740, scrollbars=no')"><img src="/images/caul.jpg" width="124" height="25" border="0"  /></a></br> ";
   echo "<font size="2">" . _maptext022 . "<br><br>";
   echo "" . _maptext011 . "</font>";
  } else {
  //echo "<br>" . _maptext045 . "<br>";
    //echo "<br>" . _maptext046 . "<br>";
    echo "<MARQUEE direction=left onmouseout=this.start() onmouseover=this.stop() scrollAmount=3 scrollDelay=60 align=center><table border=0 width=150%><font color="#BF0000">"._MAP_EMPHASIS."</font></table></MARQUEE>";
  echo "<br><font size="2">" . _maptext008 . "<br>
   <table border="0" width="100%" id="table1">
    <tr>
     <td width="19">
      <font face="Verdana" size="2">
      <img border="0" src="images/map/icon_long.gif" width="19" height="19"></font></td>
     <td width="40" align="center"><font face="Verdana" size="2">" . _maptext010 . ":</font></td>
     <td width="150"><font face="Verdana" size="2">$userlong</font></td> 
     <td width="19">
      <font face="Verdana" size="2">
      <img border="0" src="images/map/icon_lat.gif" width="19" height="19"></font></td>
     <td valign="middle" width="40" align="center"><font face="Verdana" size="2">" . _maptext009 . ":</font></td>
     <td width="200" align="left"><font face="Verdana" size="2">$userlat</font></td>
     <td>
     <a href="modules.php?name=$module_name&file=index&func=clear"><img src="/images/remove.jpg" width="50" height="20" border="0"  /></a>
     </td>   
    </tr>  
   </table>";
  }

  echo "<table border="0" width="100%" height="650" id="table1">   
  <tr>
    <td width="25"></td>
    <td width="195" height="10"><div id="lon">" . _maptext010 . "</div ></td>
    <td width="19"></td>
    <td width="200"><div id="lat">" . _maptext009 . "</div ></td>
    <td><div align="left" id="savelocation">&nbsp;</div ></td>
  </tr>
  <tr>
    <td height="10" colspan="5" align="right">
        <form action="#" onsubmit="loadMap(address.value); return false">
           " . _maptext050 . " 
           <input type="text" size="60" name="address" />
           <input type="submit" value="Search" />
        </form>                  
 </td>
  </tr>
  <tr>
    <td colspan="5" align="center">  
     <script src="http://maps.google.com/maps?file=api&v=2.s&key=$apikey" type="text/javascript"></script>
         <div id="map" style="width: 100%; height: 100%; color:black"></div ><br />
       <script type="text/javascript">
     //&lt;![CDATA[
     var icon = new GIcon();
     icon.image = "images/map/marker.png";
     icon.shadow = "images/map/shadow.png";
     icon.iconSize = new GSize(12, 20);
     icon.shadowSize = new GSize(33, 20);
     icon.iconAnchor = new GPoint(9, 20);
     icon.infoWindowAnchor = new GPoint(9, 2);
     icon.infoShadowAnchor = new GPoint(18, 25);
  
   
     function createMarker(point,html) {
     // FF 1.5 fix
     html = '<div align="left" style="white-space:nowrap;"><font color="#000000">' + html + '</font></div>';
     var marker = new GMarker(point, icon);     
     GEvent.addListener(marker, "click",  function()
     {
// 從savelocation 紀錄經緯度
      document.getElementById("savelocation").innerHTML = '&nbsp;';
      document.getElementById("lat").innerHTML = '" . _maptext009 . ":';
      document.getElementById("lon").innerHTML = '" . _maptext010 . ":';
     }
     );
     return marker;
      }

// 輸入地址找到經緯度且可以紀錄儲存          
 function loadMap(address)     {
      var map = new GMap2(document.getElementById("map"));
     //map.addControl(new GLargeMapControl());
      map.addControl(new GSmallMapControl());
      map.addControl(new GMapTypeControl());
      map.setCenter(new GLatLng(23.08, 120.3), 11);
      map.addControl(new GOverviewMapControl(new GSize(200, 150)));
      
  var geocoder = new GClientGeocoder(); 
            if (geocoder) {
            geocoder.getLatLng(
            address,
            function(point){
              if (!point) {
           } else {
           map.setCenter(point, 11);
           var marker = new GMarker(point);
           map.addOverlay(marker);
           marker.openInfoWindowHtml(address); 
      var thelat = point.y;
      var thelon = point.x;    
      savecode = "<form method=post name=SaveMyLocation action=\"modules.php?name=$module_name\"><input type=hidden name=func value=save><input type=hidden name=latitude value=" + thelat + "><input type=hidden name=longitude value=" + thelon + "><a href=javascript:document.SaveMyLocation.submit()><img src='/images/savelocation.jpg' width='88' height='25' border='0'  /></a></form>";
      document.getElementById("lat").innerHTML = '" . _maptext009 . ": ' + thelat;
      document.getElementById("lon").innerHTML = '" . _maptext010 . ": ' + thelon;        
      document.getElementById("savelocation").innerHTML = savecode;         
            }
          }
        );
      }
      
     
      var omap = document.getElementById("map_overview");
      var place = document.getElementById("map");
      place.appendChild(omap);
      omap.style.right = "0px";
      omap.style.bottom = "8px";
      
      // Hides the info windows when the map is clicked
       GEvent.addListener(map, "click", function(marker, point){
         if (!marker) {
           map.closeInfoWindow();
         }
       });
      
      GEvent.addListener(map, "click", function(overlay, point)
      {
       map.clearOverlays();
       if (point)
       {
        map.addOverlay(new GMarker(point, icon));
        map.panTo(point);
     
        var thelat = point.y;
        var thelon = point.x;    
        
        savecode = "<form method=post name=SaveMyLocation action=\"modules.php?name=$module_name\"><input type=hidden name=func value=save><input type=hidden name=latitude value=" + thelat + "><input type=hidden name=longitude value=" + thelon + "><a href=javascript:document.SaveMyLocation.submit()><img src='/images/savelocation.jpg' width='88' height='25' border='0'  /></a></form>";
        
        document.getElementById("lat").innerHTML = '" . _maptext009 . ": ' + thelat;
        document.getElementById("lon").innerHTML = '" . _maptext010 . ": ' + thelon;
        document.getElementById("savelocation").innerHTML = savecode;

      
        var point = new GPoint(point.x, point.y);
        var marker = createMarker(point,'');
        map.addOverlay(marker);  
       }
      }
      );
      
      
     }
    
     
     // arrange for our onload handler to 'listen' for onload events
     if (window.attachEvent)
     {
      window.attachEvent("onload", function()
      {
       loadMap(); // Internet Explorer
      }
      );
     }
     else
     {
      window.addEventListener("load", function()
      {
       loadMap(); // Firefox and standard browsers
      }, false);
     }
     //]]&gt;
     </script >
 
    </td>
   </tr>
   <tr>
     <td height="10" colspan="2" align="center" >Powered&nbsp;&nbsp;by&nbsp;&nbsp;<a href="http://umi.tw" target="_blank">UMI</a></td>
   </tr>     
  </table>"; 
 }
 else
 {
  //  You're not supposed to be here!
  echo "" . _maptext014 . "";
 }
    CloseTable();
    include("footer.php");
}


// 儲存經緯度
function SaveLocation($latitude,$longitude) {
 global $module_name, $user, $apikey;
 include("header.php");
 require_once("mainfile.php");
 //title("Member List Map");
OpenTable(); 
 if($userinfo = getusrinfo($user)) {
  echo "<a href="modules.php?name=$module_name&amp;file=index&amp;func=addlist">" . _maptext051 . "</a> │ <a href="modules.php?name=$module_name">" . _maptext001 . "</a> | <a href="modules.php?name=$module_name&amp;file=index&amp;func=location">" . _maptext004 . "</a>";
  echo " │ <a href="javascript:location='/modules.php?name=Nuke_Map'; window.open('http://shyau.com.tw/nestedif.php','characters','height=480, width=740, scrollbars=no')"><font color="red">" . _maptext042 . "</font></a></br> ";  

  
  $userinfo = getusrinfo($user);
  $theuser = $userinfo[username];
   
  $sql = "SELECT user_id FROM ".$prefix."_users WHERE username = '$theuser'";
  $query = $db->sql_query($sql);
  $user_id = mysql_result($query, 0, 0);
  
  echo "<font size="2">" . _maptext035 . " (" . _maptext009 . ": $latitude " . _maptext010 . ":$longitude)";
  echo"<br><br><center><a href="modules.php?name=$module_name"><img src="/images/back.jpg" width="100" height="25" border="0"  /></a><p>Powered&nbsp;&nbsp;by&nbsp;&nbsp;<a href="http://umi.tw" target="_blank">UMI</a></p></center></font>";

  if (!$db->sql_query("UPDATE ".$prefix."_users SET user_latitude='$latitude', user_longitude='$longitude' WHERE user_id='$user_id'"))
  {
    die(mysql_error());
  }

 }
 else
 {
  echo "" . _maptext014 . "";
 }


    CloseTable();
    include("footer.php");

// 移除經緯度
function RemoveLocation() {
 global $module_name, $user, $apikey;
 include("header.php");
 require_once("mainfile.php");
 //title("Member List Map");
   
 OpenTable();

 if($userinfo = getusrinfo($user))
 {
   echo "<a href="modules.php?name=$module_name&amp;file=index&amp;func=addlist">" . _maptext051 . "</a> │ <a href="modules.php?name=$module_name">" . _maptext001 . "</a> | <a href="modules.php?name=$module_name&amp;file=index&amp;func=location">" . _maptext004 . "</a> │ <a href="javascript:location='/modules.php?name=Nuke_Map'; window.open('/estedif.php','characters','height=480, width=740, scrollbars=no')"><font color="red">" . _maptext042 . "</font></a><br><br>";
   $userinfo = getusrinfo($user);
  $theuser = $userinfo[username];
   
  $sql = "SELECT user_id FROM ".$prefix."_users WHERE username = '$theuser'";
  $query = $db->sql_query($sql);
  $user_id = mysql_result($query, 0, 0);

  echo "<font size="2">" . _maptext015 . "";
  echo"<br><br><center><a href="modules.php?name=$module_name"><img src="/images/back.jpg" width="100" height="25" border="0"  /></a><p>Powered&nbsp;&nbsp;by&nbsp;&nbsp;<a href="http://umi.tw" target="_blank">UMI</a></p></center></font>";

  if (!$db->sql_query(&

相簿設定
標籤設定
相簿狀態