English [PHP] Stats:Extract [0.6] icon

25 comments
08.03.15 10:49:33 pm
like 13 like it!
9 kb, 83 Downloads
Nekomata
User
Offline Off
IMG:http://i.imgur.com/N0XW5Qz.png

Original Post

• INFOGRAPH
• [official] Live Demo
• [fws] Live Demo
• -[IFwsI]- Server Stats Screenshot
• -[IFwsI]- User Ranking Screenshot

The main reason of this update is to make S:E faster as most of the code is refactored in a better way.

Features
• Get real-time server info (server name, map name, players, bots, etc)
• Get real-time players on a server! *NEW*
• Get decoded user rankings from your userstats.dat (kills, deaths, score, time on server, usgn, etc)
• Get parsed serverstats.html statistics (server uptime, total upload, total download, etc)
• Get parsed serverstats.html graph data for Today and Yesterday (upload, download, players for every hour) so you can make your own custom serverstats.html
• Use unrealsoftware's web API to get player Name & Avatar
• Helpful utility functions included
• Light-weight
• Windows & Linux


How to use it (updated - 0.5) >

Methods >

Changelog >


Credits
• user _Yank - Idea!
• user MikuAuahDark - PHP userstats.dat decryption
• user dahele - feedback & testing
• user DC - real-time server info
• user PyKemis - real-time server players

• Github (view source)
imageimageimageimage
edited 29×, last 20.08.16 08:26:32 am
ok This file has been reviewed and approved by Infinite Rain (03.12.15 11:24:13 pm)

Comments

25 comments
Goto Page
To the start Previous 1 2 Next To the start

Log in!

You need to log in to be able to write comments!Log in
06.10.15 07:25:08 am
like I like it!
Up
SlowPoke101
User
Offline Off
hi all scept gud plx no h8 & dunt fregt 2 don8
09.09.15 01:08:13 pm
Up
Nekomata
User
Offline Off
ver. 0.2d
Another minor hotfix which fixes another fclose issue in the parse_live_server_info function.

ver. 0.2c
More >


Thank you Lubs, Glix and Dizio. ;0

Just a quick update tho. This version is a stable release. No more bugs. (hopefully)
ver. 0.2b
-Fixed parse_serverstats user ranking bug with time on server and broken sorting.
edited 2×, last 14.09.15 08:32:50 am
09.09.15 12:24:16 pm
like I like it!
Up
Lubo
User
Offline Off
It's quite impressive for autistic person like yourself.
07.09.15 05:46:23 pm
like I like it!
Up
Black Wolf
User
Offline Off
veri gud mai frend
06.09.15 10:19:17 pm
like I like it!
Up
DiZiO
User
Offline Off
Great work,mikasa You deserve my like
06.09.15 04:09:47 pm
Up
Nekomata
User
Offline Off
Thank you user Ajmin ;0

Update: [Quick Fix]. There was an error where file close wasnt called when extracting the serverstats.html. If you had a VPS this resulted in a "too many files open" error. It's patched now and here's a new live demo of S.E 0.2!
http://fwsstatistics.tk
03.09.15 05:16:42 pm
like I like it!
Up
Ajmin
User
Offline Off
Thats Epic..
03.09.15 08:43:43 am
Up
Nekomata
User
Offline Off
Version 0.2 is out. Welp the delay. Re-did err-thing.

user oxytamine: You might like the code now. ;0
10.07.15 08:31:07 pm
like I like it!
Up
gamus
User
Offline Off
nice.
03.05.15 04:26:47 pm
Up
Nekomata
User
Offline Off
Thank you! You motivate me quite the lot. :")
02.05.15 05:48:42 pm
like I like it!
Up
dahele
User
Offline Off
Liking this so you won't end up crying in a corner.
13.03.15 07:11:22 pm
Up
Nekomata
User
Offline Off
@user Pagyra; there already is a Lua version and an executable version.
Sources creds: user Starkkz.
13.03.15 06:55:44 am
like I like it!
Up
Pagyra
User
Offline Off
You can add a Lua script to write in stats more information about every player than it is in normal CS2D.
12.03.15 08:41:07 pm
Up
Nekomata
User
Offline Off
@user oxytamine; Goddit, thanks for the tip! I'll add it in the next update. :3
11.03.15 10:39:05 am
Up
oxytamine
User
Offline Off
@user Nekomata:
Just keep them in memory and unload them automatically, wrap it in one function, something like this.
Code:
1
2
$se->parse_userdata();
$se->parse_html_stats();

This'll make code much easier & cleaner to use.

About unsetting values - remember, PHP does it for you, all the variables inside function will be free when function finishes work.

If you deal with large arrays, prefer pre-increment since it's about 10% faster and performance matters in scripts like yours. Just keep in mind that $i++ will return new value while ++$i will return old.
edited 1×, last 11.03.15 11:04:09 am
11.03.15 04:39:05 am
Up
Nekomata
User
Offline Off
@user Rainoth, thanks for your opinion and for removing all the crap. Yeahp, I'm pretty well aware it wouldn't be much of a use since the number of VPS server hosters are not that many and most of them probably would not even consider the use of it. I primarily created this because I was already creating it for user _Yank and I thought It'd be a good idea to create a library for public use too, even if the use may not be that much, it would be useful for someone. As it's pretty much restricted.
• Less people willing to use it
• Requires PHP knowledge
• And other minor factors

So it's just here incase someone decides to use it.

@user oxytamine, Thanks for the feedback!

The main process of S:E is made by the general rule of first loading the file at start and then extracting it. I followed the "fopen" procedures for this one. First opening the file, then read/writing to it. I kind of found it better that way imo.

Code:
1
2
$se->unload_html_stats();
$se->unload_userdata();

These methods were required before as I loaded the files (userstats.dat and serverstats.html) both in the same variable
Code:
1
2
public $file = NULL;
public $file_path = NULL;

But then I realized that It'd be better to create seperate variables for each to play it safe otherwise it would become a muck up for someone somewhere.
Other than that
Code:
1
$this->user = array();

is used by both userdata & serverstats extraction, and I tend to destruct most variables by returning them to their default states (null).

Code:
1
2
$this->userdata_file                = NULL;
$this->userdata_file                = NULL;

And I believe I found another bug already. I recently started formatting it like that because It seemed "clean", but I'll stop the urges now.

Yes, I suck at documenting and It's a todo to create a proper documentation for S:E as I didn't have enough time right then.
I'm unsetting it again, just to play the safe side. .__.
As for the post-increment, I guess it's just habit. o.O I'll consider pre-increment from now since
Code:
1
$this->entry = 0;


Again, thanks!


Quote:
PHP. PHP programmers never change.

I guess quite so.
edited 1×, last 11.03.15 05:31:11 am
10.03.15 10:59:44 pm
Up
oxytamine
User
Offline Off
Code:
1
2
$se->unload_html_stats();
$se->unload_userdata();

Why these methods, why do you even need them? You use OOP but actually whole structure is almost functional.
Code:
1
2
3
4
$this->userdata_file                = NULL;
$this->userdata_file                = NULL;
$this->html_userdata_file           = NULL;
$this->html_userdata_file_path      = NULL;

Never ever format your code like this - it's really ugly.
Code:
1
2
3
4
/**
*     Logs!
*     Log crap & stuff.
*/

You do know what phpDocumentator is but you're doing it wrong.
Code:
1
unset($html);

Why? You do understand that it's being unset at the end of function anyway?
Code:
1
$this->entry++;

There is no reason not to use pre-increment.

PHP. PHP programmers never change.
edited 3×, last 10.03.15 11:15:09 pm
10.03.15 05:33:06 pm
Up
Rainoth
Moderator
Online On
Alright, please no more. I've been clicking intensively for past 4 hours (heh user Infinite Rain) and now I got to do it again just because u guys can't act properly.

Allow me to explain how comment section works.
1) If you like the file and you think it's great and doesn't need anything to be better, you can thank the creator or say how useful his file is
2) If you don't like the file, you can also express it, however phrases such as "quite sucks", "sucks" or alike are meaningless and thus not needed. This scaled to the point that you had to call each other assholes and bitches so I've removed this whole mess.

Now, if you've got any PERSONAL GRUDGES you can say them via PRIVATE MESSAGE instead of whining/flaming/w/e here.

If I see you bros misbehaving again, I won't hesitate to punish you. Punish you heavily. Am I clear? Great! Now lets all make up and appreciate the efforts of user Nekomata

@user Nekomata: I think it's a great feature but most people on us.de won't notice this so it's kind of a waste. I personally don't host servers so I cannot say this will be useful for me but I guess it will be useful to some.
09.03.15 08:22:39 pm
Up
Nekomata
User
Offline Off
Thank you user ZxC & user Cheetz! I hope it fulfills its purpose. C:
09.03.15 08:05:57 pm
like I like it!
Up
ZxC
Moderator
Offline Off
I find it at least good, great work.
To the start Previous 1 2 Next To the start