[GRASS-SVN] r29894 - grass-web/trunk
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Jan 30 05:03:53 EST 2008
Author: neteler
Date: 2008-01-30 05:03:53 -0500 (Wed, 30 Jan 2008)
New Revision: 29894
Modified:
grass-web/trunk/index.php
Log:
also (maybe) do geoIP if PHP-curl absent
Modified: grass-web/trunk/index.php
===================================================================
--- grass-web/trunk/index.php 2008-01-29 21:40:00 UTC (rev 29893)
+++ grass-web/trunk/index.php 2008-01-30 10:03:53 UTC (rev 29894)
@@ -59,8 +59,23 @@
echo "<font size=\"-1\"><i>You are at a GRASS mirror site in $MYSTATE (other
<a href=\"mirrors.php\">mirror sites</a>)<br>";
} else {
+ if (function_exists('fopen')) {
+ $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, 34);
+ $MYSTATETMP = explode(":", $line);
+ $MYSTATE = $MYSTATETMP[1];
+ echo "<font size=\"-1\"><i>You are a GRASS mirror site in $MYSTATE (other
+ <a href=\"mirrors.php\">mirror sites</a>)<br>";
+ fclose($file);
+ } else {
echo "<font size=\"-1\"><i>You are at a GRASS mirror site
(other <a href=\"mirrors.php\">mirror sites</a>)<br>";
+ }
}
?>
This site is updated daily: LASTUPDATED</i> <!-- processed by cron/sed -->
More information about the grass-commit
mailing list