Author Topic: Zitro Stats error  (Read 2463 times)

0 Members and 1 Guest are viewing this topic.

Offline HEX

  • Major
  • *
  • Posts: 77
  • =tNt=
    • SoldatX Brazilian Community
Zitro Stats error
« on: June 18, 2009, 02:11:20 pm »
Hey guys, I'm getting some errors while trying to install Zitro Stats.

Here is the error:
<b>Warning</b>:  Invalid argument supplied for foreach() in <b>C:\xampp\htdocs\zitro\include\update_sync.inc.php</b> on line <b>91</b><br />


Here is the complete update.php

Code: [Select]
  ____ _ ____ __  __
 [__  ] |_ __]  \/  \  Stats  -  Version 1.20080821
   / /| || || O  )O  |  ---------------------------
  / /_| || ||   <    |  (C)2008-08-21 Stefan Schulz
 [____]_||_||_|\_\__/       o_zilla@hotmail.com

         http://zitrostats.sourceforge.net/

==[ SYNCHRONIZE ]====================================
 server 1 (189.1.174.10:23102) tNt
<br />
<b>Warning</b>:  Invalid argument supplied for foreach() in <b>C:\xampp\htdocs\zitro\include\update_sync.inc.php</b> on line <b>91</b><br />
  log files: 0 total, 0 changed, 0 new

==[ CLEAN EXPIRED ]==================================
 expiredate: 2009-03-19 10:09:27
 events before deadline: 0

==[ CALCULATING NEW ]================================
 parsing new events from 0 log(s)

==[ UPDATE DATABASE ]================================
 insert new                                     done
 delete old                                     done

==[ PLUGINS ]========================================

  ERROR: opendir failed!

The logdir is configured like this: ftp://login:password@189.1.174.10/189.1.174.10%20port%2023102/logs/

I can access it through the browser... but seems that zitro stats doesn't access.
In soldat.ini Logging and Allow_Download are set to 1.

What can it be?



Offline koolazngy94

  • Major(1)
  • Posts: 41
    • Clan [H]avoc
Re: Zitro Stats error
« Reply #1 on: June 18, 2009, 03:48:06 pm »
Wrong section.

Offline HEX

  • Major
  • *
  • Posts: 77
  • =tNt=
    • SoldatX Brazilian Community
Re: Zitro Stats error
« Reply #2 on: June 18, 2009, 03:49:30 pm »
What's the right one then?



Offline Leo

  • Soldat Beta Team
  • Veteran
  • ******
  • Posts: 1011
Re: Zitro Stats error
« Reply #3 on: June 18, 2009, 04:04:54 pm »
Try running your ftp at default port 21 and remove the "port" thing. So it looks like:

ftp://login:password@189.1.174.10/logs/

*If "23102" is an ftp folder then your path should look like this:

ftp://login:password@189.1.174.10/23102/logs/
« Last Edit: June 18, 2009, 04:18:53 pm by Leo »

Offline HEX

  • Major
  • *
  • Posts: 77
  • =tNt=
    • SoldatX Brazilian Community
Re: Zitro Stats error
« Reply #4 on: June 18, 2009, 04:39:27 pm »
Leo, the ftp server runs at port 21.
The name of the folder is "189.1.174.10 port 23102" without quotes



Offline Toumaz

  • Veteran
  • *****
  • Posts: 1906
Re: Zitro Stats error
« Reply #5 on: June 18, 2009, 05:05:44 pm »
For future reference, and it case Hex won't end up seeing my PM on IRC:

Open up include\update_sync.inc.php.

Replace
Code: [Select]
$list = ftp_rawlist($ftp,'.');with
Code: [Select]
$list = ftp_rawlist($ftp, urldecode($reg[5]).'kills');
And see if that helps.

EDIT: Sorry, that won't work because Hex's provider is using some... very weird FTP server.

Instead, do this:

Replace
Code: [Select]
$list = ftp_rawlist($ftp,'.');
foreach($list as $line) {
if(preg_match('/^-r[w-][x-]r[w-][x-]r[w-][x-]\s+\d+\s+\S+\s+\S+\s+(\d+)\s\S+\s+\d+\s+\d+:\d+\s(.*)$/',$line,$line,0) && $line[1]>0)
$new[$line[2]] = $line[1];
}
with
Code: [Select]
$list = ftp_rawlist($ftp, urldecode($reg[5]).'kills');
foreach($list as $line) {
if(preg_match('/^.* (\d+) (.*)$/',$line,$line,0) && $line[1]>0)
$new[$line[2]] = $line[1];
}
« Last Edit: June 18, 2009, 05:17:55 pm by Toumaz »

Offline HEX

  • Major
  • *
  • Posts: 77
  • =tNt=
    • SoldatX Brazilian Community
Re: Zitro Stats error
« Reply #6 on: June 18, 2009, 10:12:34 pm »
Wow, that's so awesome. Thanks Toumaz, really!



Offline HEX

  • Major
  • *
  • Posts: 77
  • =tNt=
    • SoldatX Brazilian Community
Re: Zitro Stats error
« Reply #7 on: June 19, 2009, 09:17:11 am »
Hey, now I am getting these error:

*********************************************************
 [__  ] |_ __]  \/  \  Stats  -  Version 1.20080821
   / /| || || O  )O  |  ---------------------------
  / /_| || ||   <    |  (C)2008-08-21 Stefan Schulz
 [____]_||_||_|\_\__/       o_zilla@hotmail.com

         http://zitrostats.sourceforge.net/

==[ SYNCHRONIZE ]====================================
 server 1 (189.1.174.20:23102) =tNt=
  log files: 55 total, 0 changed, 1 new
  ERROR: touch for KillLog-09-06-19-03.txt failed!

==[ CLEAN EXPIRED ]==================================
 expiredate: 2009-03-20 05:11:25
 events before deadline: 0

==[ CALCULATING NEW ]================================
 parsing new events from 0 log(s)

==[ UPDATE DATABASE ]================================
 insert new                                     done
 delete old                                     done

==[ PLUGINS ]========================================

  ERROR: opendir failed!
*********************************************************

I could update only 1 time. Now I get that...



Offline Toumaz

  • Veteran
  • *****
  • Posts: 1906
Re: Zitro Stats error
« Reply #8 on: June 19, 2009, 09:35:39 am »
EDIT:
17:37 <Toumaz> hex`: if you've haven't tried that code i gave you already, don't
17:37 <Toumaz> it won't work
17:37 <Toumaz> mostly because i'm stupid like an idiot


I'm not entirely certain this solution will work; open up the very same include\update_sync.inc.php again.

Replace
Code: [Select]
                                $temp = "temp/ftp-${server}-${log}";
                                if(!$offset) @unlink($temp);
                                if(!@touch($temp)) {
                                        fecho("  ERROR: touch for $log failed!\n");
                                        continue;
                                }
                                fecho("  caching $log");
                                if(!@ftp_get($ftp,$temp,$log,FTP_BINARY,$offset)) {
                                        fecho("\n  ERROR: ftp_get for $log failed!\n");
                                        continue;
                                }
with
Code: [Select]
                                $temp = "temp/ftp-${server}-${log}";
                                if(!$offset) @unlink($temp);
                                fecho("  caching $log");
                                if(!@ftp_get($ftp,$temp,$log,FTP_BINARY,$offset)) {
                                        fecho("\n  ERROR: ftp_get for $log failed!\n");
                                        continue;
                                }
                                if(!@ftp_put($ftp, $log, $temp, FTP_BINARY)) {
                                        fecho("  ERROR: manual reupload for $log failed!\n");
                                        continue;
                                }

It's not very efficient, it's a rather dirty solution on the whole, but hopefully it'll act as a workaround. If it doesn't seem to work regardless (wouldn't surprise me), gimme a poke in #soldat.devs and I'll try to assist you further.

And if possible, you might want to have a word with your hosting provider to see if they can somehow get a better FTP daemon running than whatever they're using now.
« Last Edit: June 19, 2009, 10:39:42 am by Toumaz »

Offline jrgp

  • Administrator
  • Flamebow Warrior
  • *****
  • Posts: 5025
Re: Zitro Stats error
« Reply #9 on: June 19, 2009, 10:33:50 am »
Are you sure the folders temp/ and plugins/ both exist and the webserver user has write permissions to them?
Careful with that axe, Eugene.

Offline HEX

  • Major
  • *
  • Posts: 77
  • =tNt=
    • SoldatX Brazilian Community
Re: Zitro Stats error
« Reply #10 on: June 19, 2009, 10:40:37 am »
Yes I am.

Maybe this will help: if I try access update.php locally (localhost), it updates. If I try to access the external update.php, I get that error.


I modified to 777 and now it works. Thanks to jrgp and Toumaz (again)!
« Last Edit: June 19, 2009, 10:54:34 am by HEX »