Author Topic: PHP Utilities for PvPGN (Ladder Stats)  (Read 231674 times)

Offline USA~Archer

  • Grunt
  • ***
  • Posts: 158
  • Don't shoot the sheep!
    • View Profile
PHP Utilities for PvPGN (Ladder Stats)
« on: April 13, 2015, 04:10:07 PM »
iL / mouse,

I am trying to install PHP PvPGN utilities on my PvPGN server, is this what RU server uses for ladder stats?

Is some of your PHP custom coded like "oldgames.php"?

If so, once I get it working on my test server, then I can experiment with writing PHP code to contribute for things like this:

Would it be a lot of work to display how many times was a certain map hosted? for example from the last month?

Extended report statistics is in plans.
To clearly parse the reports and collect all data.

Any help with php-coding for this task is appreciated.



I'm having some issues with PHP Utils install:

OS: CentOS 7
DB: MySQL
PvPGN: ver 1.99

Now I am trying to install PHP Utilities

http://sourceforge.net/projects/pvpgn-phputils/

The index page works, but when i go to War2 Ladder stats, it shows

Connection Error to Mysql Server



But I have the MySQL server configured correctly in the config file, I'm pretty sure




CONFIG FILE of PHP UTILS FOR PVPGN



Code: [Select]


<?php
// ----------------------------------------------------------------------
// Player -vs- Player Gaming Network Statistics System
// http://pvpgn.spfree.net/
// ----------------------------------------------------------------------
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------
// Author from 2.4.4: Pelish (pelish@gmail.com)
// Original author: jfro (imeepmeep@hotmail.com)
// Author from 2.3.20: Snaiperx (http://www.rino.com.co/)
// Author from 2.3.16: STORM (http://www.stormzone.ru/)
// Tanzania theme author: Tanzania (tanzania@gmx.net)
// ----------------------------------------------------------------------


// ---------------------------------------------------------------------------------
// Database & System Config settings - Key
//
//      db_type:           Database type (mysql, pgsql, etc.)
//      db_host:           SQL Server Hostname or IP address
//      db_port:           SQL Server port
//      db_database:       SQL Database Name
//      db_user:           SQL Username
//      db_pass:           SQL Password
//      db_prefix          SQL Database Prefix
//      db_record:         Name of the table with player records in yourSQL DB
//      db_bnet:           Name of the table with player info`s in your SQL DB
//      db_profile:        Name of the table with player profile in your SQL DB
//      db_teams:          Name of the table with team records in your SQL DB
//      db_friend:         Name of the table with friends records in your SQL DB
//      db_counters:       Name of the table with counter records in your SQL DB
//      db_d2:             Name of the table with d2ladder records in your SQL DB
//
// *NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*
// *NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*
// (Provided my Gambit)
// For better support for everyone, I have added a central location to assign links for
// all PHP and HTML pages.  Now you don't have to scour HTML code for links/URL's to wrong domains.
// Assighn the values below to correct all links and refrences to your webpage.
//
//      (DO NOT UNCOMMENT, CHANGE BELOW UNDER "// System Config settings")
//      homepage           Full URL to your websites Home Page
//      ladderroot         Full URL to main stats page
//      (DO NOT UNCOMMENT, CHANGE BELOW UNDER "// System Config settings")
//
// *NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*
// *NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*NEW*

// System Config settings
$site_name "PvPGN server";
$db_type "mysql";
$db_host "127.0.0.1";
$db_port 3306/* 3306 is the most common MySQL port */
$db_database "my-mysql-user";
$db_user "my-user";
$db_pass "my-mysql-password";
$db_prefix "pvpgn_";
$db_record $db_prefix."Record";
$db_bnet $db_prefix."BNET";
$db_profile $db_prefix."profile";
$db_teams $db_prefix."team";
$db_friend $db_prefix."friend";
$db_counters $db_prefix."counters";
$db_d2 $db_prefix."d2ladder";
$homepage "http://10.1.1.126/";
$ladderroot "http://10.1.1.126/"/* can also be something like "http://www.myserver.net/ladder/" */


$theme "bnet";

$use_php_xslt true// only change this if you know you have xsltproc installed and not php-xslt
$xslt_command "xsltproc"// for when you don't have php4-xslt but have the xsltproc command or sabcmd

// set pvpgn_dir to where you pvpgn directory is, include trailing slash
$pvpgn_dir "/usr/local/pvpgn/";
$ladders_dir $pvpgn_dir."var/pvpgn/ladders/";

$w3ladder_xsl_file getcwd()."/themes/$theme/w3ladder.xsl";
$d2ladder_xml_file $ladders_dir."d2ladder.xml";
$d2ladder_xsl_file getcwd()."/themes/$theme/d2ladder.xsl";
// ---------------------------------------------------------------------------------

// ---------------------------------------------------------------------------------
// PvPGN variables settings
//
//     icon_levelx:          Wins required for TFT icon
//
// ---------------------------------------------------------------------------------

$icon_level1 25;
$icon_level2 50;
$icon_level3 100;
$icon_level4 200;
$icon_level5 500;

// ---------------------------------------------------------------------------------
// Page settings
//
//      site_theme:        Theme you want to run
//      page_max:          How many players you want to display on one page
//      default_game:      Defines stats for which game user will see on entering
//      default_type:      Defines which type of game user will see on entering
//      date_format:       Defines PHP date format used in stats displaying
//      d2ladder_file:     Path on your system which shows ladder.D2DV location
//      d2update_time:     Time to update your D2 DB (in seconds), 0 is off
//      stats_version:     Don't change, just for easier version display
//
// ---------------------------------------------------------------------------------

$site_theme "bnet";
$page_max "50";
$default_game "W2BE";
$default_type "solo";
$date_format " F j - G:i";
$d2ladder_file "/usr/local/pvpgn/var/pvpgn/ladders/ladder.D2DV";
$d2update_time "3600";
$stats_version "2.4.5";

// ---------------------------------------------------------------------------------
// Administration Interface settings
//
//      max_rank:          Maximum rank number allowed on your server
//      default_sort_by:   Can be auth_lock, auth_admin, uid or acct_username
//      default_sort_dir:  Can be DESC or ASC
//
// ---------------------------------------------------------------------------------

$max_rank "1000";
$default_sort_by "auth_admin";
$default_sort_dir "DESC";


// ---------------------------------------------------------------------------------
// Optional User file settings (unfinished, doesn`t work)
//
//      pvpgn_users:       Path on your system which shows user dir location
//      use_files:         Defines whether we use files or database
//
// ---------------------------------------------------------------------------------

$pvpgn_users "/usr/local/pvpgn/var/pvpgn/users";
$use_files false;

// ---------------------------------------------------------------------------------
// END of conf file.
?>











Offline USA~Archer

  • Grunt
  • ***
  • Posts: 158
  • Don't shoot the sheep!
    • View Profile
Re: PHP Utilities for PvPGN (Ladder Stats)
« Reply #1 on: April 13, 2015, 04:29:00 PM »
I got it working, its very strange, it looks like i found a bug in the PHP PvPGN Utility:

after looking at /var/log/httpd/error_log

it had a PHP Warning, at mysql_handler.php line 35

So I go look at the mysql_handler php code, and see its trying to connect to "$db_hostname" but the variable used should actually be $db_host

Changed it to $dbhost and now it works.

Code: [Select]
<?php
// ----------------------------------------------------------------------
// Player -vs- Player Gaming Network Statistics System
// http://pvpgn.spfree.net/
// ----------------------------------------------------------------------
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------
// Author from 2.4.4: Pelish (pelish@gmail.com)
// Original author: jfro (imeepmeep@hotmail.com)
// Author from 2.3.20: Snaiperx (http://www.rino.com.co/)
// Author from 2.3.16: STORM (http://www.stormzone.ru/)
// Tanzania theme author: Tanzania (tanzania@gmx.net)
// ----------------------------------------------------------------------

class sql_handle {
var $db_connection;

// ----------------------------------------------------------------------------------------------
// This is how we connect to DB
// ----------------------------------------------------------------------------------------------
function db_connect([size=14pt][b]$db_hostname,[/b][/size$db_username$db_password$db)
{ global $db_port;
$this->db_connection=mysql_connect($db_hostname.":".$db_port$db_username$db_password)
OR die ("Connection Error to Mysql Server");
mysql_select_db($db)
OR die("Connection Error to Database");
return $this->db_connection;
}

Offline USA~Archer

  • Grunt
  • ***
  • Posts: 158
  • Don't shoot the sheep!
    • View Profile
Re: PHP Utilities for PvPGN (Ladder Stats)
« Reply #2 on: April 13, 2015, 04:31:03 PM »
So I can see by looking at this, it looks exactly like war2.me's ladder, but doesnt look anything like ladder.war2.ru



So are you guys using different utilities or is ladder.war.2ru just themed differently?

Offline O4L

  • Ogre Mage
  • ********
  • Posts: 2043
    • View Profile
    • Warcraft 2 Server
Re: PHP Utilities for PvPGN (Ladder Stats)
« Reply #3 on: April 13, 2015, 07:52:12 PM »
Blid made ladder.war2.ru

Offline Delete mine too

  • Death Knight
  • *********
  • Posts: 2652
  • http://meatspin.com
    • View Profile
    • http://meatspin.com
Re: PHP Utilities for PvPGN (Ladder Stats)
« Reply #4 on: April 13, 2015, 09:37:03 PM »
Yeah I used this along time ago. But i dont remember having that issue.... did you download from the original source?

Offline USA~Archer

  • Grunt
  • ***
  • Posts: 158
  • Don't shoot the sheep!
    • View Profile
PHP Utilities for PvPGN (Ladder Stats)
« Reply #5 on: April 13, 2015, 11:06:16 PM »
Yeah, from the sourceforge link there

Ive run into tons of little glitches like that trying to set this thing up. Just finally got ladder rank fully working, it involved having to manually add several mysql tables and columns that the PHP utils program was trying to use but hadnt created for itself

At one point i deleted the wrong table on accident, luckily i had a snapshot of my pvpgn VM, had to revert back, dump mysql, go back and import the db and try again

Hope blid will share the PHP code for the current ladder and oldgames.php so i can run on my sever, experiment, and come up with some new features, then give back to RU

For example, i was on RUs oldgames.php today and manually searching for games by using CTRL F, so that i could find tournament games and record them for the bracket at my site

The "games today" and "yesterday" works fine but when you try to dump "games this week" the page crawls and sometimes crashes the browser


I would like to make a search feature so i can search for "pball" or "60men" and get all the games within a specified time period.

Maybe even set up to send me an email when someone makes a pball game

Also the feature request that started this discussion: making a PHP script that figured out the most popular maps this week, month, etc


Sent from my iPhone using Tapatalk
« Last Edit: April 13, 2015, 11:11:00 PM by USA~Archer »

Offline mousEtopher

  • Administrator
  • Ogre Mage
  • *****
  • Posts: 2065
    • View Profile
    • War2.me
Re: PHP Utilities for PvPGN (Ladder Stats)
« Reply #6 on: April 14, 2015, 08:57:03 AM »
Ive run into tons of little glitches like that trying to set this thing up. Just finally got ladder rank fully working, it involved having to manually add several mysql tables and columns that the PHP utils program was trying to use but hadnt created for itself

Yeah, I remember having to do that too. I think this script is more geared towards D2/W3 isn't it? But yeah, afaik ru doesn't use this or any of the other open source pvpgn scripts. Custom ladder, custom server status, etc.

oldgames.php is also some custom thing, I don't know who created it. All views of it are slow as hell for me, especially when you initially visit the page. It works by parsing the game reports pvpgn generates in /var/reports/ but it's so inefficient since the reports just pile up in that directory and are never purged I think? I haven't look at it too closely. The whole thing should probably be scrapped and rewritten, which I was thinking about messing with in the future.

I also don't really see a problem with making some of this stuff open source and letting you & others contribute to it, but that's not a decision I'm going to make on my own, especially given that the code we're discussing right now isn't even my work. You may want to contact iL directly about that and see what he says. If he supports it then I will too.
squeak!

Offline USA~Archer

  • Grunt
  • ***
  • Posts: 158
  • Don't shoot the sheep!
    • View Profile
PHP Utilities for PvPGN (Ladder Stats)
« Reply #7 on: April 14, 2015, 09:22:56 AM »
iL, Blid, lets work together to code some new game data tools

As long as RU is top result on google for Warcraft 2, its going to continue to be the only War2 server in the world (that matters). No ones going to try make their own server, split this tiny community, just so they can have the burden of supporting it themselves 24/7


Let me know if you want to share your game data PHP codes so we can all rework it and improve RU


Sent from my iPhone using Tapatalk

Offline iL

  • Administrator
  • Ogre Mage
  • *****
  • Posts: 1653
    • View Profile
Re: PHP Utilities for PvPGN (Ladder Stats)
« Reply #8 on: April 15, 2015, 05:11:20 AM »
iL, Blid, lets work together to code some new game data tools

Sure, welcome to our team!
Are you experienced in php-programming or w/e?

Ive run into tons of little glitches like that trying to set this thing up

I didn't try PHP PvPGN utilities because i don't think that's really what we need.

For example, i was on RUs oldgames.php today and manually searching for games by using CTRL F, so that i could find tournament games and record them for the bracket at my site

The "games today" and "yesterday" works fine but when you try to dump "games this week" the page crawls and sometimes crashes the browser

oldgames.php is a small separate script have been made by one of old russian players, he doens't play last 5-6 years.
That script is far from perfect and should be refactored i think.

"games this week" makes the server highload and i'm happy to keep it separately from bnet-server hosting.
I plan to rewrite oldgames.php as a part of new extended reports statistics.

I would like to make a search feature so i can search for "pball" or "60men" and get all the games within a specified time period.

Maybe even set up to send me an email when someone makes a pball game

Also the feature request that started this discussion: making a PHP script that figured out the most popular maps this week, month, etc

Yes, i think the best way is to move the reports to the database totally.
Then you will be able to easily add 1 more sql-request with 1 more page to receive as complicated request as you wish.

Let me know if you want to share your game data PHP codes so we can all rework it and improve RU

Sure, i think we can share oldgames.php and probably ladder.war2.ru (if Blid agrees) to you if that help. But existing scripts are ugly, i'd say it's much easier to make new code than to change the existing one.

The first task i see on this project is to make the report parser for reports here: http://reportb.war2.ru/
To parse about 200 000 reports for the start and continual parsing every several minutes. That will be a directory, need to check which reports should be parsed.

Also to make the database table structure to keep all the report data and to let us make any reports we want.
Need help to translate War2Combat to German, French, Italian, Polish or another language: http://forum.war2.ru/index.php/topic,4728.0.html
Please, contact me if you are interested in that.

Offline USA~Archer

  • Grunt
  • ***
  • Posts: 158
  • Don't shoot the sheep!
    • View Profile
Re: PHP Utilities for PvPGN (Ladder Stats)
« Reply #9 on: April 15, 2015, 04:31:27 PM »
Cool,
I'm a Network + VoIP Engineer,  also making websites has always been a hobby.

Ive always wanted to learn how to write a useful program, but  i never got far in studying because i have always been studying network and VoIP.

But now I have been studying PHP and having fun with it so hope i can contribute some good code.

Also, i always have security in mind when writing code because I have studied network, voip, and application security. So i will make sure to sanitize user input and test against sql injection before contributing anything


Sent from my iPhone using Tapatalk

Offline Delete mine too

  • Death Knight
  • *********
  • Posts: 2652
  • http://meatspin.com
    • View Profile
    • http://meatspin.com
Re: PHP Utilities for PvPGN (Ladder Stats)
« Reply #10 on: April 15, 2015, 07:45:31 PM »
Bravo archer rock that shit.

Offline I hate naggers

  • Ogre Mage
  • ********
  • Posts: 2345
    • View Profile
Re: PHP Utilities for PvPGN (Ladder Stats)
« Reply #11 on: April 21, 2015, 04:23:08 AM »
So, is anything being done about this?

Offline USA~Archer

  • Grunt
  • ***
  • Posts: 158
  • Don't shoot the sheep!
    • View Profile
PHP Utilities for PvPGN (Ladder Stats)
« Reply #12 on: April 21, 2015, 09:38:55 AM »
I think the first thing that needs to be done is to have PvPGN store the game data in the database instead of text files

Once the data is stored in a database, we can work on writing PHP to talk to the db and display game data more efficiently

So far I dont know how to do either of those things however...


Sent from my iPhone using Tapatalk

Offline Delete mine too

  • Death Knight
  • *********
  • Posts: 2652
  • http://meatspin.com
    • View Profile
    • http://meatspin.com
Re: PHP Utilities for PvPGN (Ladder Stats)
« Reply #13 on: April 21, 2015, 11:13:53 AM »
Pvpgn asks in the config how to save the files and where... let me double check lol

Edit yea super easy to do.
« Last Edit: April 21, 2015, 11:15:46 AM by tupac »

Offline USA~Archer

  • Grunt
  • ***
  • Posts: 158
  • Don't shoot the sheep!
    • View Profile
PHP Utilities for PvPGN (Ladder Stats)
« Reply #14 on: April 21, 2015, 11:31:08 AM »
Ok cool! i will setup my pvpgn server to write game data to db and start working on the php side then


Sent from my iPhone using Tapatalk