]> git.mjollnir.org Git - moodle.git/commitdiff
Arg .. so much for quick hacks ... this code is so messy it's
authormoodler <moodler>
Wed, 9 Oct 2002 14:20:24 +0000 (14:20 +0000)
committermoodler <moodler>
Wed, 9 Oct 2002 14:20:24 +0000 (14:20 +0000)
a hassle to hack ... going back to the way it was originally, with
just a more informative error message instead.

lib/ipatlas/plot.inc

index 0baf8ae3e34548eff2d25f6b9dc2fb0dc8d196e7..5f5aabfbadffa14cb04c6c44c2923b98f62805d5 100644 (file)
@@ -48,13 +48,11 @@ function s10_rfc_1918_ip($in) {
 
 function stuffanalyze($stuff) {
 
-$badstuff = array("bad", "bad", "bad", "bad", "bad");
-
-$stuff2[0] = array_values(preg_grep ("/CITY:/", $stuff)) or return $badstuff;
-$stuff2[1] = array_values(preg_grep ("/STATE:/", $stuff)) or return $badstuff;
-$stuff2[2] = array_values(preg_grep ("/COUNTRY:/", $stuff)) or return $badstuff;
-$stuff2[3] = array_values(preg_grep ("/LAT:/", $stuff)) or return $badstuff;
-$stuff2[4] = array_values(preg_grep ("/LONG:/", $stuff)) or return $badstuff;
+$stuff2[0] = array_values(preg_grep ("/CITY:/", $stuff)) or die("Sorry, but the lookup for this IP address failed! (CITY)");
+$stuff2[1] = array_values(preg_grep ("/STATE:/", $stuff)) or die("Sorry, but the lookup for this IP address failed! (STATE)");
+$stuff2[2] = array_values(preg_grep ("/COUNTRY:/", $stuff)) or die("Sorry, but the lookup for this IP address failed! (COUNTRY)");
+$stuff2[3] = array_values(preg_grep ("/LAT:/", $stuff)) or die("Sorry, but the lookup for this IP address failed! (LAT)");
+$stuff2[4] = array_values(preg_grep ("/LONG:/", $stuff)) or die("Sorry, but the lookup for this IP address failed! (LONG)");
 
 // all the stuff2 values are actually arrays, making the following code look like crap
 
@@ -70,10 +68,14 @@ for ($count = 0; $count < count($stuff2); $count++) {
  } else {
 
    // if no data was found 
-   return $badstuff;
+   $stuff2 = array("bad", "bad", "bad", "bad", "bad");
 
  }
 
+$count = 0;
+
+ return $stuff2;
+
 }
 
 function getlatdata($ip) {