1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

My modifi-union of scripts

Discussion in 'BF2Statistics discussion' started by armeagle, Jul 14, 2006.

  1. armeagle

    armeagle New Member

    As I made clear before, I plan to gathre statistics for a LANparty.
    So I've been playing with all the scripts here, added some of Brainpecker's Multi Server Checker scripts. And came up with the following: [link]http://cc8543-a.groni1.gr.home.nl:81/~armeagle/bf2stats1.2ae.zip[/url]

    BF2Statistics 1.2ae
    by ArmEagle (armeagle@gmail.com)

    Combination of:

    * www.bf2statistics.com: (Creative Commons)
    - BF2Statistics (1.2, 19 Feb 15:40)
    - BF2Statistics Web Interface (Beta, 01 Feb 18:02)
    - BF2Statistics Signature (1.0, 07 Feb 13:28)
    * www.brainpecker.com (GNU Generic Public License)
    - Multi Server Checker (v2.23)
    - Map pictures for BF1942, BFv, BF2
    * Other
    - I might have used patches for BF2Statistics scripts like
    an unlocks.py fix.

    Installation guidelines:

    Gratz, you succesfully extracted the zipfile!

    Contents of this zip/folder:
    * gameserver
    Altered python files, to replace the existing python and
    python_xpack directories (make backups! :)
    * webserver
    Three directories, all should be placed in the root of
    the webserver (if needed, use a virtual one), which is
    listening to port 80.
    This can be changed for some, but the ASP directory has
    to be in root; http://[address]:80/ASP

    bf2statistics.sql creates the tables and fills the
    ip2nation table.

    Installation steps:

    * DNS
    - Setup a DNS server and point bf2web.gamespy.com to the
    webserver's ip-address.

    * gameserver
    - Add the DNS server to the top of the list
    - Backup existing python, python_xpack directories and
    replace them with the new ones.
    - In both directories, edit stats/snapshot.py.
    + Set PREFIX to a simple string similar to the servername.
    + Set QUERYPORT similar to serversettings.com->sv.gameSpyPort.
    The webserver needs this port to gather live server info.
    # note: the servercore will increase this number till it
    finds a free port.

    * webserver
    - Edit /ASP/config.php, /bf2statistics/BF2Stats-config.php to
    set the right database settings.
    - Edit /ASP/config.php; $minplayers, to a decent value (1 for
    - For all free unlocks to online accounts; edit /ASP/config.php
    set '$allunlocks = 1;'

    * gameclient
    - For online accounts to view their progress in BFHQ and select
    unlocks when available, add the DNS server to the top of the
    lists on the client machines.


    Changelog from above versions:

    * BF2Statistics (Database)
    - Added a field 'serverid' to the table 'mapinfo', which
    points to new table 'servers'. Now 'id' and 'serverid' are
    set to 'PRIMARY'. Thus statistics are stored per map&server.
    Also added a 'lastupdate' field.
    - New table 'servers', which stores ip, prefix (from python),
    server name, gameport, GameSpy queryport and last update

    * BF2Statistics (Web, /ASP)
    - Prevention of SQL injection
    - prefix is used in the table now; will name a server till
    next GameSpy query by Brainpecker's Multi Server Check,
    queryport is stored so that live server information can be
    gathered using hte GameSpy protocol.
    - getPID.php added. This script will return the PlayerID of an
    existing entry in 'player'. Or create a new one. This replaces
    Chumps use of pid.txt and allows for multiple servers creating
    offline accounts / bot entries, whithout causing collisions or
    duplicate entries.

    * BF2Statistics (Web Interface, /bf2statistics)
    - Rearranged content of header, footer and 'center' scripts
    a bit.
    - Header script now includes CSS file for Multi Server Checker.
    and has a line of inter-site links. Removed the top image.
    - Added small private rank image for leaderboard.
    - Added 'servers.php' which shows a leaderboard of servers.
    Since 'mapinfo' is now stored per server&map it can show map
    info for a server. Brainpecker's Multi Server Checker is
    included to show detailed live server stats, using the GameSpy
    protocol, if the server is online.
    - Changed (Google) Firefox banner.

    * BF2Statistics (gameserver python script)
    * PlayerManager.py
    - Replaced Chump's offline account/bot support based on pid.txt
    with a central database backend.
    PIDs for these cases will start at 999998 and decreasing. When
    the python scripts can't connect to the central webserver, the
    PID 999999 is used instead.
    * stats/snapshot.py
    - Now also sends the GameSpy queryport in getSnapShot(), and
    the prefix is intended to be used as a simple server
    * stats/unlocks.py
    - onPlayerConnect() would crash my linux server when an offline
    account connected. Added some extra code to prevent that.

    * Multi Server Checker, Map pictures:
    - Included some of the files into bf2statistics. So this can
    be included inline in servers.php
    - Took the 'pics' directory
    - Renamed css.css to serverChecker.css, now included in the
    header.php. Redundant entries were removed.
    - And further all serverChecker*.php scripts needed for the
    active server overview
    - For compatibility and layout some things were disabled by
    config, other things were taken out of the code directly.
    - Ip and port are defined in servers.php before these scripts
    are included.
    - link in front of playernicks now point to player.php
    - Stores server detail in the 'servers' table entry

    * BF2Statistics Signature:
    - Added a very simple theme myself, all dirs are symlinks to
    the default theme, actually only the normal.png is a
    different image.



    + Get this nicely wrapped into about.php
    + Links to signatures should be added to the player info page.
    + For LAN, player should be able to change countrycode.
    + Central main configuration (database) for all webscripts.

    - Brainpecker's Multi Server Check should be converted to a
    single class. So that the encapsulating php script can simply
    call functions.
    - The python code should either read the server config, or an
    easier located config file, or get the settings from within
    the engine.
  2. csuno

    csuno New Member

    Nice work...i love it!

    But: in the sql import file is a bug, it doesnt creates a "ip2nation" table...so i've ad the createpart of the original sql file!

    And in "__init__.py" the row [blockquote]log = file('/tmp/bf2serverlog.txt', 'w')[/blockquote] dont work for me, i get a debug error! So i've edit it to [blockquote]log = file('bf2serverlog.txt', 'w')[/blockquote]

    ANd...(sorry) how to change the pagetitels of the server and leaderboard site? For leaderboard i've sucesfully made it, but for server he dont change the title, and he dont fetch the server status... but i've modified the "serverCheckerPreHead.php" for my server!?
    selffixed...it was just a fault of our proxycache! SORRY

    But now, my database dont grow....i get rankes in game...but it just fills the botnames in database but no kills and so...

    please help
  3. P@L

    P@L Member

    CREATE TABLE `ip2nation` (
    `ip` int(11) unsigned NOT NULL default '0',
    `country` char(2) NOT NULL default '',
    PRIMARY KEY (`ip`),
    KEY `ip` (`ip`)
    ) TYPE=MyISAM;

    Add this in the bf2statistics.sql just above

    -- Dumping data for table `ip2nation`

    and the database will work..

    as for the __init__.py file just make tmp folder with a file named bf2serverlog.txt in it.

    i havent tried the web interface from ArmEagle since i've modded my own so i cant give any heads up about that..

    and another thing ive noticed is that it doesnt creates a logfile after a completed game.. so no data get saved in the db aswell..
  4. csuno

    csuno New Member

    THX PaLL3

    withe the mysql, i've done so... i've wrote!

    but with the __init__.py that dont work. it always says no such file or directory... even with "/" or "\" with any subfolder it doesnt work!

    i will stay on testing...BY CSUNO
  5. P@L

    P@L Member

    in the __init__.py u find this code

    # Added by Chump - for bf2statistics
    sys.stdout = fake_stream('stdout')
    sys.stderr = fake_stream('stderr')
    log = file('c:/where/you/want/it/tmp/bf2serverlog.txt', 'w')
    sys.stdout = log
    sys.stderr = log
    import gui_log

    u can put a # infront of the last 4 rows chosing not to use it..
  6. csuno

    csuno New Member

    So, the 'bf2serverlog.txt' isnt needed?

    But, because of my DB wasnt fillt i've tried the original python scripts from bf2statistics 1.2. but even with them, i didnt get any ASP/logs/ nor any DB data!

    Any idea? And to understand, what is writing the db data? The phytonscripts itself, or the ASP scripts? I want to figure this out, but i need some help, plz.

  7. P@L

    P@L Member

    i think the bf2serverlog.txt is just a log to see whats been goin on.. and not for any db insertion..
  8. P@L

    P@L Member

    Im not sure really whats goin on.. been trying out some different stuff but with any luck.. thought i got it hence this "double" post..
    anyway.. goto go and be social.. bbl this evening..
  9. Wolverine

    Wolverine Member

    bf2serverlog.txt is for debug purposes only. The insertion into the database are done by ASP/bf2statistics.php.

  10. P@L

    P@L Member

    could it be the "sql injection prevention" thats not allowing insertion to the db?
  11. armeagle

    armeagle New Member

    Hi all, thanks for the responses.

    I was away for the weekend (so i guess the haste i amde to put it out made some flaws slip in :+).

    I had only tested it with a linux webserver, linux gameserver for now. hurr1k4ne reported having issues running it on a windows gameserver. So i'll check into that this week (only 4 days left till my LAN)

    about that "sql injection prevention"; mysql_real_escape_string requires php 4.3+ if you dont have that, use mysql_escape_string.

    You can test /ASP/bf2statistics.php by yourself, if you use a program like curl (linux; curl -d @[inputfile] ) to POST the data the way the game... So, as i said. More testing time this week..
  12. csuno

    csuno New Member

    would be great when you get it to work with windows boxes.
    I'am using windows,too!

    Lets hear about you. Good Job ArmEagle! CSUNO
  13. MrNiceGuy

    MrNiceGuy Founder Staff Member

    Sticky! ;)
  14. P@L

    P@L Member

    yup.. installed curl and it worked.. now im modding it to serve my "ill will" ;)

    ArmEagle: very good job indeed and tx alot for all the help... =)
  15. thomaskunze

    thomaskunze New Member

    Hi ArmEagle!

    I would really like to use your nice enhancements, but the link you posted a week ago seems to be dead now. Can you either reupload the archive or send it to me by mail (thomaskunze@gmx.li).

    Thank you very much and all the best for our overwhelming LAN-Party!

    Best regards,

  16. thomaskunze

    thomaskunze New Member

    Hi @ all!

    Since ArmEagle is organizing his huge LAN party, I am asking now all the others...
    Can anyone please upload the archive or email it to me?

    Best regards,

  17. Fisch.666

    Fisch.666 New Member

    Hi tom,

    i've uploaded the archive to rapidshare.de. Hope this helps...

  18. P@L

    P@L Member

    The file's gone awol... maybe this thread should be removed or moderators could upload the package again?