Files

> > CS2D > Misc. > [PHP] Stats:Extract [0.6]
Files overviewCS2D overviewMisc. overview

English [PHP] Stats:Extract [0.6] >

26 comments9 kb, 571 Downloads

old [PHP] Stats:Extract [0.6]

Nekomata
User Off Offline

IMG:https://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 eledah - feedback & testing
• user DC - real-time server info
• user Apache uwu - real-time server players

• Github (view source)
edited 29×, last 20.08.16 08:26:32 am
Approved by Infinite Rain

Download Download

9 kb, 571 Downloads

Comments

26 comments
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

old

mrc
User Off Offline

how to use?

old

Mami Tomoe
User Off Offline

hi all scept gud plx no h8 & dunt fregt 2 don8
I like it!

old Quick Fixes!

Nekomata
User Off Offline

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

old

Lubo
User Off Offline

It's quite impressive for autistic person like yourself.
I like it!

old

Black Wolf
User Off Offline

veri gud mai frend
I like it!

old

DiZiO
User Off Offline

Great work,mikasa You deserve my like
I like it!

old

Nekomata
User Off Offline

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

old

Ajmin
User Off Offline

Thats Epic..
I like it!

old

Nekomata
User Off Offline

Version 0.2 is out. Welp the delay. Re-did err-thing.

user oxytamine: You might like the code now. ;0

old

gamus
User Off Offline

nice.
I like it!

old /s

Nekomata
User Off Offline

Thank you! You motivate me quite the lot. :")

old

eledah
User Off Offline

Liking this so you won't end up crying in a corner.
I like it!

old

Pagyra
User Off Offline

You can add a Lua script to write in stats more information about every player than it is in normal CS2D.
I like it!

old

Nekomata
User Off Offline

@user oxytamine; Goddit, thanks for the tip! I'll add it in the next update. :3

old

oxytamine
User Off Offline

@user Nekomata:
Just keep them in memory and unload them automatically, wrap it in one function, something like this.
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

old

Nekomata
User Off Offline

@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.

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
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
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).

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
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

old

oxytamine
User Off Offline

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.
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.
1
2
3
4
/**
*	Logs!
*	Log crap & stuff.
*/
You do know what phpDocumentator is but you're doing it wrong.
1
unset($html);
Why? You do understand that it's being unset at the end of function anyway?
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

old

Rainoth
Moderator Off Offline

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.
To the start Previous 1 2 Next To the start