Dateien

> > CS2D > Misc. > [PHP] Stats:Extract [0.6]
DateiübersichtCS2D-ÜbersichtMisc.-Übersicht

Englisch [PHP] Stats:Extract [0.6] >

26 Kommentare9 kb, 535 Downloads

alt [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)
29× editiert, zuletzt 20.08.16 08:26:32
Zugelassen von Infinite Rain

Download Download

9 kb, 535 Downloads

Kommentare

26 Kommentare
Seite
Zum Anfang Vorherige 1 2 Nächste Zum Anfang

Logge dich ein!

Du musst dich einloggen, um selber Kommentare verfassen zu können!Einloggen

alt

mrc
User Off Offline

how to use?

alt

Mami Tomoe
User Off Offline

hi all scept gud plx no h8 & dunt fregt 2 don8
Ich mag es!

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


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.
2× editiert, zuletzt 14.09.15 08:32:50

alt

Lubo
User Off Offline

It's quite impressive for autistic person like yourself.
Ich mag es!

alt

Black Wolf
User Off Offline

veri gud mai frend
Ich mag es!

alt

DiZiO
User Off Offline

Great work,mikasa You deserve my like
Ich mag es!

alt

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

alt

Ajmin
User Off Offline

Thats Epic..
Ich mag es!

alt

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

alt

gamus
User Off Offline

nice.
Ich mag es!

alt /s

Nekomata
User Off Offline

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

alt

eledah
User Off Offline

Liking this so you won't end up crying in a corner.
Ich mag es!

alt

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.
Ich mag es!

alt

Nekomata
User Off Offline

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

alt

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.
1× editiert, zuletzt 11.03.15 11:04:09

alt

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!


Zitat
PHP. PHP programmers never change.

I guess quite so.
1× editiert, zuletzt 11.03.15 05:31:11

alt

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.
3× editiert, zuletzt 10.03.15 23:15:09

alt

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.
Zum Anfang Vorherige 1 2 Nächste Zum Anfang