[GRASS-SVN] r29884 - grass-web/trunk

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jan 28 11:16:58 EST 2008


Author: neteler
Date: 2008-01-28 11:16:58 -0500 (Mon, 28 Jan 2008)
New Revision: 29884

Modified:
   grass-web/trunk/index.php
Log:
geocode the mirror

Modified: grass-web/trunk/index.php
===================================================================
--- grass-web/trunk/index.php	2008-01-28 14:48:24 UTC (rev 29883)
+++ grass-web/trunk/index.php	2008-01-28 16:16:58 UTC (rev 29884)
@@ -33,8 +33,20 @@
               <td nowrap="nowrap"> 
                 <center><br>
                   <h1>Welcome to GRASS GIS</h1>
-                   <font size="-1"><i>You are at the official GRASS site (or
-                   a <a href="mirrors.php">mirror site</a>)<br>
+<?php
+$MYIP = $_SERVER['SERVER_ADDR'];
+$file = fopen ("http://api.hostip.info/get_html.php?ip=$MYIP", "r");
+if (!$file) {
+    echo "[unknown mirror country]\n";
+    exit;
+}
+$line = fgets ($file, 1024);
+$MYSTATETMP = explode(":", $line);
+$MYSTATE = $MYSTATETMP[1];
+echo "<font size=\"-1\"><i>You are at the official GRASS site in $MYSTATE (or
+                   a <a href=\"mirrors.php\">mirror site</a>)<br>";
+fclose($file);
+?>
                    This site is updated daily: LASTUPDATED</i> <!-- processed by cron/sed -->
                    </font>
 		</center>



More information about the grass-commit mailing list