Page 1 of 16

(X)Aseco+RASP Website Stats v3.6

Posted: 07 Jan 2011 01:03
by Ant
Ok after a bit of a wait, I'd like to present the newest version of this stats script :D

*The download link is at the bottom of this post*

Previous versions:
v3.0 by w1lla
v2.3 by sn3p
v1.9b by Cypher80 (original author)

Version 3.1
This now has support for Stunts mode, so all you Stunts server hosters can now have proper functioning stats !!
I'd like to give a big thanks to W1lla for testing it out for me and also for adding a couple of new info cells under Server Stats, which are:
Current Ladder Mode under the Server tab & Number of CP's under the Challenge tab.
Thanks a lot for all your help W1lla, it was very much appreciated :thumbsup:
Also added in this version is a Server Banners tab under Server Stats, made by lidor5353
so a thanks goes out to you as well :)
In this version, a new line was also added into the config which is:

Code: Select all

$stunt[$i] = 0;								// 0 = false; 1 = true;	
This tells the script whether the server is stunts or not and displays pages accordingly.
---------------------------------------------------------------------------------------------------------------------------------------------------
For anyone that didn't know, W1lla previously released version 3.0 of these stats and the updates in that version were as follows:
TMX Smilies in author Comments.
Fixed hyperlinks where in author comments stood Link and not the real url.
Added how many awards a track has on TMX.
Visit TMX track on TMX webpage.
Edited ENG.php in languages folder for updates.
Download First offline record on TMx of the occuring track.
Dedimania read-only access:
Shows first 10 world records and on which server it is made.
---------------------------------------------------------------------------------------------------------------------------------------------------
Version 3.2
Changed deprecated ereg_replace and eregi_replace functions to preg_replace in serverstats.php
and playerstats.php
Updated all language files so there is now no missing translations.
Updated includes/tmx_get.php to fix broken links on the TMX info page (Thanks W1lla)
Updated pages/tmx_info.php to show correct page layout if $tmx_info = 2; is used in config.php
Removed checkpoints column in pages/trecords.php because cp times were not able to be displayed
correctly.
The following files were also updated although i'm not sure they're still being used, but
they were using deprecated ereg_replace and eregi_replace functions which have now been
replaced with preg_replace functions:
includes/playername.php
includes/servername.php
includes/comment.php
includes/trackname.php

Version 3.3
playerstats.php (stripFormatting Function added)
includes/tmfdatafetcher.inc.php (Added v1.5b)
pages/search_players.php (Updated so the tables match the players page)
pages/search_tracks.php (Updated so the tables match the tracks page)

I was unable to use the ARIALUNI.TTF font in the end - you can find the reason for that in this post

Version 3.4
The credit for this update goes completely to Assembler Maniac, all banner problems should be fixed now. Some nicknames however will still display funny characters (but no TM formatting codes) and this is due to the fact (as Nocturne pointed out) that the supplied fonts aren't able to handle the scope of characters that some players use in their nicknames. This Post from Noc details a few fonts that could be better to use. Below is a summary of the changes that Assembler Maniac made (Also included in the readme)

playerstats.php
serverstats.php

Changed both files to use ONE stripping function (stripFormatting) for all player, track and
server name variables.

Code is also easier to read (spaces added for clarity within string manipulation and assigns).

A few vars renamed to reflect their content:
$servername -> $sname_stripped
$servername1 -> $sname_tmtags
(same for track & player)

Version 3.5
The updates for this version are as follows:

pages\tmx_info.php and includes\tmx_get.php (Updated to show TMX World Record) Thanks W1lla
All language files (Updated with World Record and No record found translations as well as a blank space to be used in player banners)
playerstats.php (Removed the word "server" from statsboxes 2 and 3, then added a blank space into statsbox 2 to make these banners look nicer) Thanks for the tip AM :)
includes\ColorParser.php (Added isset checks for certain array items) Thanks AM
index.php (Version changes and download link)
config.php (version change)
img\statsbox\serverstats.png (changed image for TMF and renamed the old image to serverstats_tmn.png)
readme.txt (Updated some out of date information)

I have to say, this version has relied heavily on input from W1lla and Assembler Maniac so thanks a lot guys its really appreciated :D

Version 3.6
The updates for this version are as follows:

pages\dedimania_info.php (Updated with an easier to read layout and links to selected players Dedimania stats) Thanks W1lla and TheM
pages\search_players.php (Added result limits per page and next & previous buttons) Thanks W1lla
pages\search_tracks.php (Added result limits per page and next & previous buttons) Thanks W1lla
All language files (Updated translations for the new Dedimania info page)
index.php (Version changes and download link)
config.php (version change)

---------------------------------------------------------------------------------------------------------------------------------------------------
A full changelog can be found in the included readme file.
Please post any comments/suggestions/improvements/bug reports about this and i'll do my best to answer all queries.

The download can be found Here

The download is also mirrored Here

View a working example of the site Here

Re: (X)Aseco+RASP Website Stats v3.1

Posted: 07 Jan 2011 16:24
by Tecktonik1231
Ant, I have problems with encoding. Worth all right everywhere, but what questions are worth. What should I do?

Re: (X)Aseco+RASP Website Stats v3.1

Posted: 07 Jan 2011 16:31
by Ant
Can you post me a link to your stats please ? I'm not sure exactly what you mean.

Edit: Ok, I got the link you pm'd me, have you set everything properly in config.php (root directory) and tmfdatafetcher.config.php (includes directory) ? It looks like you haven't.

Re: (X)Aseco+RASP Website Stats v3.1

Posted: 07 Jan 2011 19:24
by Ant
I've just updated the download package because I included the older version of tmfdatafetcher.inc.php - It has now been changed to W1lla's 1.5 version, this is needed if you have any problems with strange characters in nicknames.

For anyone that has already downloaded this package though, you can download the tmfdatafetcher here

(Place it in the includes directory)

Edit: One more thing I forgot about was the search page, it wasn't returning the proper results for a stunt server - this has now been fixed in the download in my 1st post.

Again though, the fixed files can be downloaded here for anyone who has already downloaded this package.

Edit: Last fix as far as I can see - in stranking.php I was using

Code: Select all

$player['BestTime'];
instead of

Code: Select all

$player['Score'];
to return a live score in the stats - I've fixed this in the main download now but if anyone just needs to update this file, heres the code (place this file in /subpages)

stranking.php

Code: Select all

<?php
if($Ranking){
echo "<p class=\"tabletitle\">".$lng_stats_r_headline."</p>
<table width=\"100%\" border=\"0\" align=\"center\" bgcolor=\"".$bg4."\" >
  <tr bgcolor=\"".$resultbg."\" class=\"tablehead\">
          <td width=\"15%\" class=\"tablehead\">".$lng_stats_r_rank."</td>
          <td width=\"35%\" class=\"tablehead\">".$lng_stats_r_nick."</td>
          <td width=\"25%\" class=\"tablehead\">".$lng_stats_r_login."</td>
          <td width=\"25%\" class=\"tablehead\">".$lng_stats_r_stbest."</td>
        </tr>";
		foreach ($Ranking as $player) {
		$playername=$player['NickName'];
		//include("includes/playername.php");
		$bg = $bg1;
		if ($bg==$bg1) {
		$bg=$bg2;
		} else {
		$bg=$bg1;
		}
		$MWTime = $player['Score'];
		$time=sprintf("%02d", $MWTime);
		$ranking=$player['Rank'];
		if ($time=="-1") {
			$time="not ranked";
			$ranking="---";
			}
		echo "<tr bgcolor=".$bg." onMouseOver=\"this.style.backgroundColor='".$bg3."'\" onMouseOut=\"this.style.backgroundColor='".$bg."'\">
          		<td class=\"celltext\">".$ranking."</td>
				<td class=\"celltext\">".$cp->toHTML($playername)."</td>
          		<td class=\"celltext\">".$player['Login']."</td>
          		<td class=\"celltext\">".$time."</td>
        	</tr>";
		}
		echo "</table>";
}else {
 echo "<p class=\"tmxoffline\">".$lng_stats_r_status."</p>";
}
?>
I can confirm now that the above code works as intended, thanks to Tecktonik1231 for testing it :thumbsup:

Re: (X)Aseco+RASP Website Stats v3.1

Posted: 08 Jan 2011 11:07
by nocturne
I just now finally started working on a stats script for use on the LR website, trying to figure out a simple concise page layout to cover all the necessary info. So obviously, I started out by looking for what little tidbits I could steal from pre-existing controllers and scripts...

So I obviously checked out what's been done with cypher's old stats script. Honestly, I'm surprised what all has been done with it, though it's almost a bit too much. The page organization is incredibly confusing -- there's different info about either the given server or current track on one of several different subpages. For example, for a track you have the records page, the corresponding TMX and DM pages, and the challenge stats page -- all of which can be condensed easily onto one page. There's also countless subpages that provide the same server info, including such useless info such as server version and build date (rather not advertise the version myself, in case there's an exploit for a specific version), and whether or not the ladder is in official mode. Just way too much info, in a very unintelligible format.

What I'm working on is basically organized into 4 tabs per server -- info/stats, rankings, tracks, and search (player/track), along with two subpages showing the track/player info of a given POSTed UID/login. I just can't think of any reason it'd take more than that.

Re: (X)Aseco+RASP Website Stats v3.1

Posted: 08 Jan 2011 19:32
by Ant
Well I suppose people will have different opinions of these stats, personally I find the extra information quite useful and not really that confusing. Also I think the format isn't really that unintelligible and for me its quite easy to understand to be fair.

About your point on server version and build date being shown, isn't it possible to view this anyway on any game server that you enter (Not too sure about that, but I think thats the case)

Anyway, i'll be interested to see your completed version of a stats site - its always nice to have a good comparison :)

Re: (X)Aseco+RASP Website Stats v3.1

Posted: 18 Jan 2011 09:20
by DnBfreak
Hi there,

I've installed this script, everything is working fine. The TMFDatafetcher on the other hand is not fully working.
I received login and all, some player banners work properly, but most just don't appear. i tried a lot but right now im a little stuck. Also the little squares in the server name are a pain in the ass. any idea?

my stats page

Thx in advance.

dnbfreak

Re: (X)Aseco+RASP Website Stats v3.1

Posted: 18 Jan 2011 22:12
by nocturne
The thai accent characters (there's a special name for them.. but I forget) in your name will never be displayed properly. What you should see is is a circle, with the accent tacked onto it. If you see a square with no accent, then you need to enable Asian/Far east font support in your windows.

As far as the TMF data fetcher goes, you can get a lot of denied requests and other errors, especially if the caching isn't properly set up. You can also attempt to switch cURL support on/off in the fetcher's config, as well as setting the refresh after midnight setting to false.

I haven't checked how the stats script calls the fetcher class, but it's best to do it within a loop like the example script:

Code: Select all

		include_once('./classes/tmfdatafetcher.inc.php');
		do {
			$info = new TMFDataFetcher($challenge_info['author']);
			$error = $info->getError();
			$errorCode = $error['code'];
		} while ($errorCode == 125);
That way it'll keep attempting until it get's a proper response. You could also code how many times to try:

Code: Select all

		include_once('./classes/tmfdatafetcher.inc.php');
		$tries = 0;
		do {
			$info = new TMFDataFetcher($challenge_info['author']);
			$error = $info->getError();
			$errorCode = $error['code'];
			$tries++;
		} while ($errorCode == 125 && $tries <= 10);

Re: (X)Aseco+RASP Website Stats v3.1

Posted: 18 Jan 2011 22:46
by Ant
Just to let you all know, I've updated these files so far for these stats:

pages/trecords.php
pages/tmx_info.php
playerstats.php
serverstats.php
languages/ENG.php
languages/FRA.php
languages/GER.php
languages/NED.php

The download hasn't been updated yet, but will be soon. I'll post here again when its all sorted.

Re: (X)Aseco+RASP Website Stats v3.1

Posted: 18 Jan 2011 23:00
by nocturne
Hmm... looking at your sig, seems like somebody at TM-Ladder figured out the accent problem.. Just sent them an inquiry.

Re: (X)Aseco+RASP Website Stats v3.1

Posted: 18 Jan 2011 23:21
by nocturne
The strip color functions need updating for php 5.3 (going to be updating the server to it soon enough, hehe). Since the color parser is always loaded, you can just use it like : "$cp-toHTML($str, true, true, 'all')". The community-built stripformatting function has also been fixed up pretty good: viewtopic.php?f=28&t=6856&start=45

Also, if you need to just handle the server/player names in a 'php-safe' manor, can always just use htmlspecialchars(), or url_encode() along with url_decode() before display.

Re: (X)Aseco+RASP Website Stats v3.1

Posted: 18 Jan 2011 23:56
by Ant
I've actually updated the stripColors function in playerstats.php - but not only that, there were a few other ereg_replace and eregi_replace functions there too that i've also updated to preg_replace. serverstats.php also had these deprecated functions which have now been updated - The main download will be updated soon people !!

Re: (X)Aseco+RASP Website Stats v3.1

Posted: 19 Jan 2011 07:53
by w1lla
There are some problems with some pages at the moment.

Those are being fixed...

Re: (X)Aseco+RASP Website Stats v3.2

Posted: 19 Jan 2011 23:15
by Ant
Version 3.2 is now available - see the details in my first post.

Re: (X)Aseco+RASP Website Stats v3.2

Posted: 22 Jan 2011 03:50
by Ant
Quick fix - includes/tmx_get.php was using

Code: Select all

'http://nations.tm-exchange.com/main.aspx?action=trackshow&id=' . $file[0]
at line 31 as part of the visit track link, this means some of the links will be broken. I've updated the main download with this change

Code: Select all

'http://'.$prefix.'.tm-exchange.com/main.aspx?action=trackshow&id=' . $file[0]
Also, in pages/tmx_info.php I added this under lines 98 and 179

Code: Select all

<td width="25%" height="25" bgcolor="<?php echo $bg1 ?>"</td>
      <td height="25" bgcolor="<?php echo $bg1 ?>"</td> 
just to make the background a little neater.