Jump to content

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


tyger07

Recommended Posts

  • Replies 1.7k
  • Created
  • Last Reply

Originally Posted by CptChaos*:

 

Both, actually, lol!

 

I managed to find the variables which are used multiple time. I've created a file for it, which sets these variables for all servers. :smile:

If anyone is interested, let me know! :smile: It makes configuration for the stats so much easier!

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

Originally Posted by TMiland*:

 

Both, actually, lol!

 

I managed to find the variables which are used multiple time. I've created a file for it, which sets these variables for all servers. :smile:

If anyone is interested, let me know! :smile: It makes configuration for the stats so much easier!

Just share them, and maybe it'll be added to the main package. :biggrin:
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

Another tip, use valid HTML-code. The -tag has been deprecated for years now.

Don't get me wrong, I may be picky and jerky, I like this stats page a lot and I really appreciate the time you've spend on it. I really would like to help out, even on coding and such. But the code could be much better and better readable, rewriting it would cost me too much time.

 

EDIT:

With how many tables did you build this? Damn, I hardly can't find a thing if I want to change a thing.

Building a webpage with tables is sooo 1995... :/ (Sorry to put it that way)

Font is still valid in xhtml and so are tables. I would invite you to write your own code instead of complaining about mine.

 

http://validator.w3.org/check_uri=ht...org%2Fservices

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

Originally Posted by CptChaos*:

 

Font is still valid in xhtml and so are tables. I would invite you to write your own code instead of complaining about mine.

 

http://validator.w3.org/check_uri=ht...org%2Fservices

Well, as said, I would love to write my own code from yours as base, but the code is hard to read, with no intending at all. I am not saying that tables are deprecated, I meant that building a webpage with tables in tables in tables in tables was done in 1995, when Internet Explorer ruled the browser market.

 

So yes, I am willing to help (I'll be glad to), but the code which I use as base (being your code) is making it very difficult. Font tag is deprecated as of HTML 4.01: http://www.w3schools.com/tags/tag_font.asp. :smile: That a browser still knows the tag is because of backwards compatibility. :smile: (

 

That's why I suggested to move the code to something like github.com, in that way more users can contribute in this awesome project.

 

EDIT:

I did collect some variables in one file, I named it config.php:

Code:

<_php
$db_host	= 'localhost'; // database host
$db_port	= 3306; // database port. default is 3306
$db_name	= ''; // database name
$db_uname	= ''; // database user name
$db_pass	= ''; // database password
$banner_url	= 'http://URL'; // Banner URL
$index_link	= 'http://URL'; // Index URL
$clan_name	= 'Clan Name'; // Clan name
$stats_link		= array('ServerStats1.php','ServerStats2.php'); // Enter each server stats link.
$database_connect = $db_host . ':' . $db_port;
Then, in all the files, I replacedCode:
// DATABASE INFORMATION
$db_host		= ''; // database host
$db_port		= 3306; // database port. default is 3306
$db_name		= ''; // database name
$db_uname		= ''; // database user name
$db_pass		= ''; // database password
_>
from the top with

Code:

require_once('config.php');
And removed the variable declarations from the all the files.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

Well, as said, I would love to write my own code from yours as base, but the code is hard to read, with no intending at all.

There is indentation already. :ohmy: To say that there isn't is a little insulting.

 

The indentation of the code currently is governed by php. It would either need to be indented by php or by html but can't be both. If you indent by html, the php would become unreadable. So you have to pick your preference. Since it is a PHP file, priority was placed on proper PHP indentation.

 

Of course splitting the html into its own separate template files parsed by the PHP file would be the solution, but the whole purpose of this project from the beginning was to make a simple and fast one-file stats page almost anyone could use. There are other stats pages made by others for you to use if you wish. You may like the appearance of the code in the other pages better, but I would argue that mine is the fastest and most error-free.

 

If you find my HTML completely intolerable, I would suggest that you could delete all text between echo ' and '; and then you would be left with only PHP. From there, you could insert your own HTML in any convention you wish.

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

Originally Posted by TMiland*:

 

Country flags on Scoreboard edit!

 

If you want to have country flags on the scoreboard like this:

 

Posted Image

 

Edit line 688 to 693 from:

Code:

echo '
						<tr>
						<td class="tablecontents" width="15%">          ' . $count . ':  </td>
						<td class="tablecontents" width="21%">     <a href="' . $_SERVER['PHP_SELF'] . '_player_name=' . $player . '&search_player=Search"><font size="2">' . $player . '</font></a></td>
						<td class="tablecontents" width="21%">     ' . $country_name . '</td>
						';
To:

Code:

$country_flag = $scoreboard_row['CountryCode'];
						$country_flag = "flags/" . $country_flag . ".png";
						echo '
						<tr>
						<td class="tablecontents" width="15%">          ' . $count . ':  </td>
						<td class="tablecontents" width="21%">     <a href="' . $_SERVER['PHP_SELF'] . '_player_name=' . $player . '&search_player=Search"><font size="2">' . $player . '</font></a></td>
						<td class="tablecontents" width="21%"><img src=' . $country_flag . '>   ' . $country_name . '</td>
						';
Add the flags in this attachement to your root folder: flags.zip

 

Enjoy! :biggrin:

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

Originally Posted by CptChaos*:

 

@TMiland: I had to alter some things at line 663? And did somewhat the same above it, to determine the needed filename in case Procon / the DB doesn't have the user's IP. I have used this code:Code:

if(empty($scoreboard_row['CountryCode']))
						{
							$country_img = 'none.png';
						}
						else
						{
							$country_img = strtolower($country) .'.png';	
						}
						
						
						echo '
						<td class="tablecontents" width="26%" style="text-align:left"><img src="flags/'. $country_img .'"> ' . $country_name . '</img></td>
@ty_ger07: I'll see what I'll do. For now I'll dive in the code as I just don't have the time (anymore) to code my own... That's why I think something like github could come in handy. That way a lot of people can contribute as well and you can merge it as a patch with a click.

 

I'll also try to create a 'pie' for the map stats. :smile:

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

Originally Posted by TMiland*:

 

I just changed line 663 to this:Code:

<td class="tablecontents" width="26%" style="text-align:left"><img src="flags/'. strtolower($country) .'.png"> ' . $country_name . '</img></td>
.

I still used your flags.zip though.

 

ty_ger07: I'll see what I'll do. For now I'll dive in the code as I just don't have the time (anymore) to code my own...

Yeah, that does the job too :biggrin:
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

Good. This is cool!

 

Map images where maps are referenced. Flags where countries are referenced. Weapons images where weapons are referrenced?

 

These were things I considered but never implemented because I was focusing on performance as a priority.

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

Originally Posted by CptChaos*:

 

Too bad Dice didn't release a webkit or something like that, lol!

 

I've also modded the country flags in the player stats from a server. :smile:

 

Code:

// search the country array for the country code of interest and assign the full name to a variable
			$country = array_search($CountryCode,$country_array);
			
			if(empty($CountryCode))
			{
				$country_img = 'none.png';
				$country = 'Undetermined';
			}
			else
			{
				$country_img = strtolower($CountryCode) .'.png';	
			}
and Code:
<td width="30%" style="text-align: left;"> <font class="information">Country: <img src="flags/'. strtolower($CountryCode) .'.png" /> </font>' . $country . '
is the code I used for it, around line 1330, somewhere there, not sure where exactly as I didn't track the exact line.

 

Posted Image

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

Originally Posted by ty_ger07*:

 

This is really bigger than me and my limited time. I plan to release an update tomorrow with some popular requests and improvements you have offered, but then after that, I will be very busy for two weeks.

 

How does one go about managing this better? I offered the code and of course encourage people to modify it and make it better, but other than offering your improvements here like you are doing, is there a better way? As it is, this is creating fragmentation.

 

As you can probably tell, I have no formal training and my profession is in an entirely different field. This is a hobby for me and sometimes turns into an unwanted distraction. I need someone with experience to offer their advice in how this project could move forward in a unified way. Or perhaps it may be determined that it should be killed off and other stats pages should be used instead. Fragmentation is my root concern and collective backing behind one project would be preferable.

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

Originally Posted by TMiland*:

 

This is really bigger than me and my limited time. I plan to release an update tomorrow with some popular requests and improvements you have offered, but then after that, I will be very busy for two weeks.

 

How does one go about managing this better? I offered the code and of course encourage people to modify it and make it better, but other than offering your improvements here like you are doing, is there a better way? As it is, this is creating fragmentation.

 

As you can probably tell, I have no formal training and my profession is in an entirely different field. This is a hobby for me and sometimes turns into an unwanted distraction. I need someone with experience to offer their advice in how this project could move forward in a unified way. Or perhaps it may be determined that it should be killed off and other stats pages should be used instead. Fragmentation is my root concern and collective backing behind one project would be preferable.

You should add your project to github, so others can fork the project, so the fragments can be easily merged if wanted. :smile:
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by CptChaos*:

 

Like there weren't enough countries, I had a player from Guernsey on our server... From where? Guernsey! Is that near the moon? No, not at all... It appears to be near France! Long message short: I added that country to the array of countries and made a flag picture for it.

 

Code:

// make an array of country names
$country_array = array('Null'=>'','Unknown'=>'--','Afghanistan'=>'AF','Albania'=>'AL','Algeria'=>'DZ','American Samoa'=>'AS','Andorra'=>'AD','Angola'=>'AO','Anguilla'=>'AI','Antarctica'=>'AQ','Antigua'=>'AG','Argentina'=>'AR','Armenia'=>'AM','Aruba'=>'AW','Australia'=>'AU','Austria'=>'AT','Azerbaijan'=>'AZ','Bahamas'=>'BS','Bahrain'=>'BH','Bangladesh'=>'BD','Barbados'=>'BB','Belarus'=>'BY','Belgium'=>'BE','Belize'=>'BZ','Benin'=>'BJ','Bermuda'=>'BM','Bhutan'=>'BT','Bolivia'=>'BO','Bosnia'=>'BA','Botswana'=>'BW','Bouvet Island'=>'BV','Brazil'=>'BR','Indian Ocean'=>'IO','Brunei Darussalum'=>'BN','Bulgaria'=>'BG','Burkina Faso'=>'BF','Burundi'=>'BI','Cambodia'=>'KH','Cameroon'=>'CM','Canada'=>'CA','Cape Verde'=>'CV','Cayman Islands'=>'KY','Central Africa'=>'CF','Chad'=>'TD','Chile'=>'CL','China'=>'CN','Christmas Island'=>'CX','Cocos Islands'=>'CC','Columbia'=>'CO','Comoros'=>'KM','Congo'=>'CG','Republic of Congo'=>'CD','Cook Islands'=>'CK','Costa Rica'=>'CR','Ivory Coast'=>'CI','Croatia'=>'HR','Cuba'=>'CU','Cyprus'=>'CY','Czech Repuplic'=>'CZ','Denmark'=>'DK','Djibouti'=>'DJ','Dominica'=>'DM','Dominican Republic'=>'DO','East Timor'=>'TP','Ecuador'=>'EC','Egypt'=>'EG','El Salvador'=>'SV','Equatorial Guinea'=>'GQ','Eritrea'=>'ER','Estonia'=>'EE','Ethiopia'=>'ET','Falkland Islands'=>'FK','Faroe Islands'=>'FO','Fiji'=>'FJ','Finland'=>'FI','France'=>'FR','Metropolitan France'=>'FX','French Guiana'=>'GF','French Polynesia'=>'PF','French Territories'=>'TF','Gabon'=>'GA','Gambia'=>'GM','Georgia'=>'GE','Germany'=>'DE','Ghana'=>'GH','Gibraltar'=>'GI','Greece'=>'GR','Greenland'=>'GL','Grenada'=>'GD','Guadeloupe'=>'GP','Guam'=>'GU','Guatemala'=>'GT','Guinea'=>'GN','Guinea-Bissau'=>'GW','Guyana'=>'GY','Haiti'=>'HT','McDonald Islands'=>'HM','Vatican City'=>'VA','Honduras'=>'HN','Hong Kong'=>'HK','Hungary'=>'HU','Iceland'=>'IS','India'=>'IN','Indonesia'=>'ID','Iran'=>'IR','Iraq'=>'IQ','Ireland'=>'IE','Israel'=>'IL','Italy'=>'IT','Jamaica'=>'JM','Japan'=>'JP','Jordan'=>'JO','Kazakstan'=>'KZ','Kenya'=>'KE','Kiribati'=>'KI','North Korea'=>'KP','South Korea'=>'KR','Kuwait'=>'KW','Kyrgyzstan'=>'KG','Lao'=>'LA','Latvia'=>'LV','Lebanon'=>'LB','Lesotho'=>'LS','Liberia'=>'LR','Libya'=>'LY','Liechtenstein'=>'LI','Lithuania'=>'LT','Luxembourg'=>'LU','Macau'=>'MO','Macedonia'=>'MK','Madagascar'=>'MG','Malawi'=>'MW','Malaysia'=>'MY','Maldives'=>'MV','Mali'=>'ML','Malta'=>'MT','Marshall Islands'=>'MH','Martinique'=>'MQ','Mauritania'=>'MR','Mauritius'=>'MU','Mayotte'=>'YT','Mexico'=>'MX','Micronesia'=>'FM','Moldova'=>'MD','Monaco'=>'MC','Mongolia'=>'MN','Montserrat'=>'MS','Morocco'=>'MA','Mozambique'=>'MZ','Myanmar'=>'MM','Namibia'=>'NA','Nauru'=>'NR','Nepal'=>'NP','Netherlands'=>'NL','Netherlands Antilles'=>'AN','New Caledonia'=>'NC','New Zealand'=>'NZ','Nicaragua'=>'NI','Niger'=>'NE','Nigeria'=>'NG','Niue'=>'NU','Norfolk Island'=>'NF','Mariana Islands'=>'MP','Norway'=>'NO','Oman'=>'OM','Pakistan'=>'PK','Palau'=>'PW','Palestine'=>'PS','Panama'=>'PA','Papua New Guinea'=>'PG','Paraguay'=>'PY','Peru'=>'PE','Philippines'=>'PH','Pitcairn'=>'PN','Poland'=>'PL','Portugal'=>'PT','Puerto Rico'=>'PR','Qatar'=>'QA','Reunion'=>'RE','Romania'=>'RO','Russia'=>'RU','Rwanda'=>'RW','Saint Helena'=>'SH','Saint Kitts'=>'KN','Saint Lucia'=>'LC','Saint Pierre'=>'PM','Saint Vincent'=>'VC','Samoa'=>'WS','San Marino'=>'SM','Sao Tome'=>'ST','Saudi Arabia'=>'SA','Senegal'=>'SN','Seychelles'=>'SC','Sierra Leone'=>'SL','Singapore'=>'SG','Slovakia'=>'SK','Slovenia'=>'SI','Solomon Islands'=>'SB','Somalia'=>'SO','South Africa'=>'ZA','Sandwich Islands'=>'GS','Spain'=>'ES','Sri Lanka'=>'LK','Sudan'=>'SD','Suriname'=>'SR','Svalbard'=>'SJ','Swaziland'=>'SZ','Sweden'=>'SE','Switzerland'=>'CH','Syria'=>'SY','Taiwan'=>'TW','Tajikistan'=>'TJ','Tanzania'=>'TZ','Thailand'=>'TH','Togo'=>'TG','Tokelau'=>'TK','Tonga'=>'TO','Trinidad'=>'TT','Tunisia'=>'TN','Turkey'=>'TR','Turkmenistan'=>'TM','Turks Islands'=>'TC','Tuvalu'=>'TV','Uganda'=>'UG','Ukraine'=>'UA','United Arab Emirates'=>'AE','United Kingdom'=>'GB','United States'=>'US','US Minor Outlying Islands'=>'UM','Uruguay'=>'UY','Uzbekistan'=>'UZ','Vanuatu'=>'VU','Venezuela'=>'VE','Vietnam'=>'VN','Virgin Islands (British)'=>'VG','Virgin Islands (US)'=>'VI','Wallis and Futuna'=>'WF','Western Sahara'=>'EH','Yemen'=>'YE','Yugoslavia'=>'YU','Zambia'=>'ZM','Zimbabwe'=>'ZW', "Guernsey" => "GG");
And I also uploaded the flag: Posted Image
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by CptChaos*:

 

I can't sign up because my email address contains invalid characters? Since when does a website only allow you to have certain email addresses?

I know a few (computer) communities which disallow certain domains, not characters. An e-mail addy is only a-z, 0-9 and - or _.

 

The detailed map rotation log I am building is finally getting some shape:

Posted Image

I still have a lot to tweak and have much ideas coming for it, but I have to tweak it a lot, even the columns which are most usefull and the like. :ohmy: So no release of the code as of yet, because it's far from done. :biggrin: For bigger, click: http://i.imgur.com/9Tw3x0d.jpg

 

As you can clearly see, the looks aren't the same as the stats do, but I will fix that... But I have to go to sleep at some point today, lol! :ohmy:

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

Originally Posted by ty_ger07*:

 

Github won't let me create an account because I have an underscore in my email address. Since when is an underscore in an email address disallowed? I might have to create a new email address to sign up to github because my other email address has a period in it which I assume they also disallow.

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

Originally Posted by ty_ger07*:

 

The detailed map rotation log I am building is finally getting some shape:

Posted Image

A detailed log of maps could get quite out of hand. There could be thousands of lines of information. And is it information people are really interested in? I would suggest that if such a thing were implemented, that pagination would be used to scroll through pages of of data.

 

This is where I am currently:

http://open-web-community.com/bf4sta...tats/index.php

 

No, I have not worked on the index page yet. :sad: Adding total server stats on the index page should be simple and I am not worried about whether or not I will have time to do so when I release my update tomorrow (err... later today).

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

Originally Posted by MorpheusX(AUT)*:

 

Github won't let me create an account because I have an underscore in my email address. Since when is an underscore in an email address disallowed? I might have to create a new email address to sign up to github because my other email address has a period in it which I assume they also disallow.

No problem with periods in the email addresses, at least I got my myrcon address registered there (which includes [email protected]).
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Kinsman*:

 

Ok I did some work on the index for you, added some server totals, and the nice map images from previous pages.

 

I can post a zip with the index and buttons etc if anybody wants it, also note i moved the maps into their own folder.

 

http://jw.servegame.org/bf4stats/index.php

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

Originally Posted by kcuestag*:

 

Working on a e107 plugin, with a sidebar menu:

 

Posted Image

 

And the index:

 

Posted Image

 

This is great! :biggrin:

Are you going to release this publicly? I'd love having it on our site since we also use e107.
* 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.