|
From: <ma...@sc...> - 2006-04-13 12:49:37
|
Update of /cvsroot/meshdb/www/db2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19456 Modified Files: google.php Log Message: forgot about both html and xml data escaping. how very embrarrasment. Index: google.php =================================================================== RCS file: /cvsroot/meshdb/www/db2/google.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- google.php 13 Apr 2006 09:51:27 -0000 1.1 +++ google.php 13 Apr 2006 12:49:23 -0000 1.2 @@ -4,6 +4,7 @@ /* declare content type */ header("Content-Type: application/keyhole"); + //header("Content-Type: text/plain"); function nice_die($error) { echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; @@ -42,13 +43,13 @@ $updated = intval($row[0]); /* comment this out if testing */ - header("Last-Modified: ".gmdate("D, d M Y H:i:s", $updated)." GMT"); + //header("Last-Modified: ".gmdate("D, d M Y H:i:s", $updated)." GMT"); /* give back memory */ mysql_free_result($result); /* single or multiple query */ - $query = "SELECT a.nodeid,a.nodename,a.status,a.updated,p.e,p.n,p.h,c.contactname,n.channel,n.antspread,n.direction,n.polarisation FROM admin a, physloc p, contact c, config n where a.nodeid = p.nodeid and a.nodeid=c.nodeid and a.nodeid = n.nodeid and p.e is not NULL and p.n is not null and (DATE_SUB(CURDATE(),INTERVAL $maxdays DAY) <= a.updated)"; + $query = "SELECT a.nodeid,a.nodename,a.status,a.updated,p.e,p.n,p.h,c.contactname FROM admin a, physloc p, contact c where a.nodeid = p.nodeid and a.nodeid=c.nodeid and p.e is not NULL and p.n is not null and (DATE_SUB(CURDATE(),INTERVAL $maxdays DAY) <= a.updated)"; if (isset($nodeid)) { $query = $query . " and a.nodeid=$nodeid"; } else { @@ -84,10 +85,16 @@ $lat = $lat_lon[0]; $lon = $lat_lon[1]; + /* skip invalid values */ + if ($lat == 0 || $lon == 0) { + echo "<!-- zero lat=$lat OR lon=$lon, skipping -->/n"; + continue; + } + /* display the row */ echo " <Placemark>\n"; - echo " <description><![CDATA[Contact's Name: ".$row['contactname']."<br>" . "View <a href=\"http://www.itee.uq.edu.au/~mesh/db-srtm/view.php?nodeid=".$row['nodeid']."\">Node Details</a> on BrisMESH<br>Last Updated: ".$updated."]]></description>\n"; - echo " <name>" . $row['nodename'] . "</name>\n"; + echo " <description><![CDATA[Contact's Name: " . htmlspecialchars($row['contactname']) . "<br>View <a href=\"http://www.itee.uq.edu.au/~mesh/db-srtm/view.php?nodeid=".$row['nodeid']."\">Node Details</a> on BrisMESH<br>Last Updated: ".$updated."]]></description>\n"; + echo " <name><![CDATA[" . htmlspecialchars($row['nodename']) . "]]></name>\n"; echo " <LookAt>\n"; echo " <longitude>$lon</longitude>\n"; echo " <latitude>$lat</latitude>\n"; |