Jump to content

[BF4] Stats webpage for XpKiller's Stats Logger Plugin


tyger07

Recommended Posts

Originally Posted by ty_ger07*:

 

My only concern is that APIs change. Sometimes, as popularity and their server load increases, they change their service to a paid service or require the request URL to be changed to include an API key obtained after creating an account with their service.

 

I will probably do a two-factor solution where the less accurate query of the database for players with IPs similar to the game server's IP address is used if the GeoLocation API service returns an unexpected result.

Code:

$location = '';
$s_explode = explode(":",$ip);
$server_ip = $s_explode[0];

$json = @file_get_contents('http://ip-api.com/json/' . $server_ip);
$data = @json_decode($json,true);
$location = $data['countryCode'];

if($location == '')
{
	while(@mysqli_num_rows($Location_q) == 0 && strlen($server_ip) > 1)
	{
		$Location_q = @mysqli_query($BF4stats,"
			SELECT `CountryCode`
			FROM `tbl_playerdata`
			WHERE `IP_Address` LIKE '{$server_ip}%'
			LIMIT 1
		");
		$server_ip = substr($server_ip, 0, -1);
		$Location_r = @mysqli_fetch_assoc($Location_q);
		$location = strtoupper($Location_r['CountryCode']);
	}
}
* Restored post. It could be that the author is no longer active.
Link to comment
  • Replies 1.7k
  • Created
  • Last Reply

Originally Posted by ty_ger07*:

 

That looks very nice sir! Good job! :biggrin:

 

It it too much to ask to get the country flag too?

 

And maybe place the Players: Previous 24 hrs above the graph not inside? :ohmy:

How is this?

http://open-web-community.com/bf4stats/player-stats/banner/banner.png_sid=2&onomatopoeia=supercalifragilisticexpialidocious

http://open-web-community.com/bf4sta...expialidocious

 

 

 

You will probably need to urlencode the source into your image resizer page (if you haven't already):

 

http://www.nbfc.no/gtimg/gtimg.php_q=100&h=62&src=http://open-web-community.com/bf4sta...nner.png_sid=1

 

... because of the query string inside a query string

 

http://www.nbfc.no/gtimg/gtimg.php_q...ner/banner.png?sid%3D1

 

 

Another cool thing you can do is this:

 

If you are calling /banner/banner.png_sid=1 from within a php file on your site, you can append a junk query string containing the current timestamp to the end. If you do that, you guarantee that users always see a current version of the banner and never see a cached version.

 

Like so:

 

Code:

<_php

$timestamp = time();

echo '<img src="./banner/banner.png_sid=1&t=' . $timestamp . '" />';

_>
This would cause the URL to always be a slightly different random "image" and never an image cached on the client's computer.

 

But of course, this trick only works if the timestamp is being generated at the same time the image is being called. Otherwise, you are calling a static timestamp and run into the same old problem.

 

In a previous post, I placed the image in bbCode into a post as "http://open-web-community.com/bf4stats/player-stats/banner/banner.png_sid=3&dummy" just to make sure that I was having you critique something which was "new" to your computer.

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

Should the map image and "Battlefield 4" on the left be swapped top to bottom to have similar text to image orientation as on the right of the image? In other words, as it is now, the map and the graph are on opposite diagonals of the image. Is it good to have them on opposite diagonals -- as it is currently -- or should the "Battlefield 4" text be above the map image?

 

swap.png

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Prophet731*:

 

How is this?

http://open-web-community.com/bf4stats/player-stats/banner/banner.png_sid=2&onomatopoeia=supercalifragilisticexpialidocious

http://open-web-community.com/bf4sta...expialidocious

 

 

 

You will probably need to urlencode the source into your image resizer page (if you haven't already):

 

http://www.nbfc.no/gtimg/gtimg.php_q=100&h=62&src=http://open-web-community.com/bf4sta...nner.png_sid=1

 

... because of the query string inside a query string

 

http://www.nbfc.no/gtimg/gtimg.php_q...ner/banner.png?sid%3D1

 

 

Another cool thing you can do is this:

 

If you are calling /banner/banner.png_sid=1 from within a php file on your site, you can append a junk query string containing the current timestamp to the end. If you do that, you guarantee that users always see a current version of the banner and never see a cached version.

 

Like so:

 

Code:

<_php

$timestamp = time();

echo '<img src="./banner/banner.png_sid=1&t=' . $timestamp . '" />';

_>
This would cause the URL to always be a slightly different random "image" and never an image cached on the client's computer.

 

But of course, this trick only works if the timestamp is being generated at the same time the image is being called. Otherwise, you are calling a static timestamp and run into the same old problem.

 

In a previous post, I placed the image in bbCode into a post as "http://open-web-community.com/bf4stats/player-stats/banner/banner.png_sid=3&dummy" just to make sure that I was having you critique something which was "new" to your computer.

You could also send a no-cache header and set the expiration date to something in the past. That way you wouldn't have to append a timestamp to the URL.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

You could also send a no-cache header and set the expiration date to something in the past. That way you wouldn't have to append a timestamp to the URL.

Can an image have such a header?

Code:

?PNG
... Cache-Control ...
... Expires ...

IHDR0_???? IDATx???y?%Iv????=????Zz?^??3=g?,??
^^ of course that isn't how it would really appear. ... only a representation

 

 

The banner output header is PNG not HTML.

 

Perhaps I am wrong? Can you specify the cache control from within a PNG header?

 

I guess I will do some testing.

 

EDIT:

 

Code:

// start outputting the image
header('Pragma: public');
header('Cache-Control: max-age=0');
header('Expires: 0');
header("Content-type: image/png");
Ah hah! Simple enough. It works! I had no idea that you could specify that sort of information inside an image header. I thought that was an HTML-only thing.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Prophet731*:

 

Can an image have such a header?

Code:

?PNG
... Cache-Control ...
... Expires ...

IHDR0_???? IDATx???y?%Iv????=????Zz?^??3=g?,??
^^ of course that isn't how it would really appear. ... only a representation

 

 

The banner output header is PNG not HTML.

 

Perhaps I am wrong? Can you specify the cache control from within a PNG header?

 

I guess I will do some testing.

 

EDIT:

 

Code:

// start outputting the image
header('Pragma: public');
header('Cache-Control: max-age=0');
header('Expires: 0');
header("Content-type: image/png");
Ah hah! Simple enough. It works! I had no idea that you could specify that sort of information inside an image header. I thought that was an HTML-only thing.
I was confused when I read the email notification. I was asking myself why couldn't you add the header. That doesn't make sense. Glad you figured it out. It's the simple things that make your job 10x easier. :smile: Now no more timestamp matching for a fresh image. :biggrin:
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

I was confused when I read the email notification. I was asking myself why couldn't you add the header. That doesn't make sense. Glad you figured it out. It's the simple things that make your job 10x easier. :smile: Now no more timestamp matching for a fresh image. :biggrin:

Email notification?
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

Update Released!

 

http://tyger07.github.io/BF4-Server-Stats

 

Changes:

- Added Final Stand maps and ranks

- Added GameTracker style server banner signature images to the Server Info page Banners tab

- Added Soldier Name search on Leaderboard

 

 

I don't know the codes for the Final Stand weapons and vehicles, so you may see those missing. Please feel free to point out the displayed weapon name if you find one of the missing ones.

 

Code:

// final stand
// 'Rorsch Mk-1'			=>	'',
// 'Phantom'				=>	'',
...
// Final Stand Vehicles
// 'Snowmobile'				=>	'',
// 'HT-95 Levkov'			=>	'',
// 'Shipunov 42'			=>	'',
// 'Pod Launcher'			=>	'',
// 'XD-1 Accipiter'			=>	''
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

Update released!

 

http://tyger07.github.io/BF4-Server-Stats

 

Changes:

- Made alignment changes to banner image and fixed graph going off the chart in some cases in banner image

- Added optional "&cc=.." URL query string variable to change the country flag displayed in the banner image

 

https://github.com/tyger07/BF4-Serve...e9059eab75cfd4

 

 

http://nbfc.no/bf4stats/banner/banner.png_sid=1&cc=no

Code:

http://nbfc.no/bf4stats/banner/banner.png_sid=1&cc=no
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

What must I change to get in German Battlelog out, when I press Join Server ?

 

Join.png

 

-----

 

Battlelog URL without DE

 

BL.png

 

 

Battlelog URL with DE

 

BL DE.png

In index.php, look for these lines:

Code:

$battlelog = 'http://battlelog.battlefield.com/bf4/servers/pc/_filtered=1&expand=0&useAdvanced=1&q=' . urlencode($ServerName);
There are two lines like that (line 95 and line 188). Change those lines to include bf4/de/servers.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Level*:

 

In index.php, look for these lines:

Code:

$battlelog = 'http://battlelog.battlefield.com/bf4/servers/pc/_filtered=1&expand=0&useAdvanced=1&q=' . urlencode($ServerName);
There are two lines like that (line 95 and line 188). Change those lines to include bf4/de/servers.
Thank you for your help @ty_ger07
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

I wonder why TonyGun's text in the banner image graph is so fuzzy. It must be his php gd extension version or something along those lines.

http://www.fws-gaming.com/bf4serverstats/banner/banner.png_sid=2

0, 50, and 100 all look like the same blobs. Apparently, I need to increase the text size for those in similar situations.

 

I am also rethinking my choice to calculate combined ranks on player stats pages. I had it disabled previously due to page load time, but enabled it in combined stats player pages after I made it asynchronous. It's no longer an issue with page load time, but it is a huge database load.

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Ruger*:

 

Hey ty_ger07,

 

Really like this stats page. Thanks for all your work on it. Just wanted to let you know that on the Server Info page, Banners tab the html iframe link is showing /banner/serverbanner.php_sid=1 but found it needed to be /common/serverbanner.php_sid=1. Just FYI.

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

Hey ty_ger07,

 

Really like this stats page. Thanks for all your work on it. Just wanted to let you know that on the Server Info page, Banners tab the html iframe link is showing /banner/serverbanner.php_sid=1 but found it needed to be /common/serverbanner.php_sid=1. Just FYI.

Thanks for the heads up!
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

It should be fine.

 

It has room for 100 characters. 20 servers times 2 characters per server id equals 40 characters; plus 18 more characters for commas equals 58 characters.

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

Update released!

 

Changes:

- Increased font size in banner graph for better visibility for those with wonky php GD extension

- Fixed serverbanner.php directory location in server info tab

- Removed combined rank calculation from combined player stats pages due to large database load for those with many combined players

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Ruger*:

 

Update released!

 

Changes:

- Increased font size in banner graph for better visibility for those with wonky php GD extension

- Fixed serverbanner.php directory location in server info tab

- Removed combined rank calculation from combined player stats pages due to large database load for those with many combined players

Hey ty_ger07, I noticed after this update that my server graph is no longer showing past 24 hours info.

 

http://stats.redriversyndicate.com/banner/banner.png_sid=1

 

Any ideas?

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

Hey ty_ger07, I noticed after this update that my server graph is no longer showing past 24 hours info.

 

http://stats.redriversyndicate.com/banner/banner.png_sid=1

 

Any ideas?

For some reason, GitHub removed the /banner/banner_cache folder in this latest git push.

 

https://github.com/tyger07/BF4-Serve.master/banner

 

If you create the missing folder on your server, the graph should start working again.

 

I guess I will need to put a dummy file in that folder in the next release so that github doesn't remove the folder.

* Restored post. It could be that the author is no longer active.
Link to comment

Archived

This topic is now archived and is closed to further replies.




×
×
  • Create New...

Important Information

Please review our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.