cvs: php-master-web /scripts ip-to-country
| From: | Gabor Hojtsy | Date: | Wed, 30 Jun 2004 17:37:45 +0000 |
| Subject: | cvs: php-master-web /scripts ip-to-country | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-25181@lists.php.net to get a copy of this message | ||
goba Wed Jun 30 13:37:45 2004 EDT
Modified files:
/php-master-web/scripts ip-to-country
Log:
more debug code
http://cvs.php.net/diff.php/php-master-web/scripts/ip-to-country?r1=1.7&r2=1.8&ty=u
Index: php-master-web/scripts/ip-to-country
diff -u php-master-web/scripts/ip-to-country:1.7 php-master-web/scripts/ip-to-country:1.8
--- php-master-web/scripts/ip-to-country:1.7 Tue Jun 29 15:06:44 2004
+++ php-master-web/scripts/ip-to-country Wed Jun 30 13:37:45 2004
@@ -48,15 +48,20 @@
// the file is expected to be ok
$state = 'firstline'; $fileok = TRUE;
+ $DEBUG = '';
+
// While we can read a line from the file
while (!feof($ipdbf) && ($line = fgets($ipdbf))) {
+ $DEBUG .= 'file read|';
+
// Check the input depending on the state
switch ($state) {
// First line is defined, and after it we
// switch to the 'data' state
case 'firstline' :
+ $DEBUG .= 'first line|';
if (trim($line) != "#Directi IP-to-Country Db: Start") {
$fileok = FALSE;
break 2;
@@ -68,6 +73,7 @@
// which case we write it out to the local rewritten
// database
case 'data' :
+ $DEBUG .= 'data line|';
if (trim($line) == "#Directi IP-to-Country Db: End") {
$state = 'lastline';
} elseif (!preg_match("!\\d{20}\\w{3}\n!", $line)) {
@@ -81,6 +87,7 @@
// We should not receive any data after the last
// line, only whitespace is allowed
case 'lastline' :
+ $DEBUG .= 'last line|';
if (strlen(trim($line)) > 0) {
$fileok = FALSE;
break 2;
@@ -92,10 +99,10 @@
fclose($ipdbcf);
if ($fileok) {
- mail("goba@php.net", "ip-to-country: proper format", "");
+ mail("goba@php.net", "ip-to-country: proper format", $DEBUG);
}
else {
- mail("goba@php.net", "ip-to-country: improper format", "");
+ mail("goba@php.net", "ip-to-country: improper format", $DEBUG);
}
// Remove the temp file. If the data is ok, move