ImportBot Posted December 28, 2013 Share Posted December 28, 2013 Originally Posted by TheBoomplayer*: It is likely a DNS issue where you will need to wait. Usually domain name and subdomain creations/changes take 4-6 hours to be available to route to your computer's browser. Since the code is internally referring to various subdirectories of that subdomain, it would manifest itself as a multifaceted issue (even if you manually use the correct ip address in your browser). I think that it will work fine once the subdomain route is established by the DNS (domain name service host resolution). I think you will just have to wait a while and then try again. Does it work fine in a sub-directory of http://silver-revenge.de/? Yes it is a subdomain of my clan website http://silver-revenge.de * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted December 28, 2013 Share Posted December 28, 2013 Originally Posted by TheBoomplayer*: Does it work fine in a sub-directory of http://silver-revenge.de/?No, the same problem it don`t load the website www.silver-revenge.de/server * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted December 28, 2013 Share Posted December 28, 2013 Originally Posted by dingo_doo*: Has you he(it) somebody there who speaks French and who has to create this page? And who would know how to help me to make it one? Thank you in advance * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted December 28, 2013 Share Posted December 28, 2013 Originally Posted by ty_ger07*: No, the same problem it don`t load the website www.silver-revenge.de/server It is quite hard for me to troubleshoot further with no idea what you do or do not have. If you remove the database connection details from config.php, does it display the page with an error that it was unable to connect to the database? * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted December 29, 2013 Share Posted December 29, 2013 Originally Posted by ty_ger07*: As I already said, php code is in english. There is no such thing as french php. It will always be in english. Just translate any echoed text to french. For example, translate "echo 'home page';" to "echo 'in french';". * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted December 29, 2013 Share Posted December 29, 2013 Originally Posted by Kinsman*: If it is up to date, then it must be getting updated by some method or another. Usually PHP code is only executed when a user looks at it and therefore you have to look at the player's stats page in my code to update the user's signature image. Perhaps ezstats makes a task to update all user's signatures every time any single page is looked at.As always you nailed it, I totally forgot there is a cron job to update the sigs!!! http://www.junglewraiths.net/ezStats...signatures.php Could I do the same to update ours here? * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted December 29, 2013 Share Posted December 29, 2013 Originally Posted by TheBoomplayer*: It is quite hard for me to troubleshoot further with no idea what you do or do not have. If you remove the database connection details from config.php, does it display the page with an error that it was unable to connect to the database?It works now. I dont now why_! But Thank`s ;-) * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted December 29, 2013 Share Posted December 29, 2013 Originally Posted by Kinsman*: Ok, I think I'm done, well until Tyger adds more things that I need to roll in anyhow. various tweaks in no particular order, css, spacing of scoreboard (remove long country names), retain top 10 on index, retain server ranks (add gameid to both), extra columns for home, clan and potw pages. Add playtime to player page (replace suicide), sum up dogtags, replace metabans link with globalstats link, tweak sigs with more useful (to me) information, remove "" from sig url. http://jw.servegame.org/bf4stats/index.php * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted December 29, 2013 Share Posted December 29, 2013 Originally Posted by ty_ger07*: I think I am about done wasting my time with this. There are other things I should focus on. * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted December 29, 2013 Share Posted December 29, 2013 Originally Posted by Kinsman*: Haha, never a waste of time! You've done an awesome job. 1 last question, is it possible that we can use a cron job to update the sigs every few days? * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted December 29, 2013 Share Posted December 29, 2013 Originally Posted by ty_ger07*: Haha, never a waste of time! You've done an awesome job. 1 last question, is it possible that we can use a cron job to update the sigs every few days? As always, you can do whatever you want to do. * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted December 29, 2013 Share Posted December 29, 2013 Originally Posted by Kinsman*: Ah let me rephrase, is there a file that I could call every few days that would update all the sigs via a cron job? For instance would running player.php do the trick, or would it need to be functions.php? * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted December 29, 2013 Share Posted December 29, 2013 Originally Posted by ty_ger07*: Ah let me rephrase, is there a file that I could call every few days that would update all the sigs via a cron job? For instance would running player.php do the trick, or would it need to be functions.php? The function signature is the function which makes the signature images. It won't do anything unless you provide it with the necessary arguments. In the most basic terms, you would need a file with this info: Code: <_php // include config.php contents require_once('./config/config.php'); // include functions.php contents require_once('./common/functions.php'); // connect to the stats database $BF4stats = @mysqli_connect(HOST, USER, PASS, NAME, PORT); @mysqli_select_db($BF4stats, NAME); // this game ID // probably is 1 $GameID = 1; // open directory to read file contents if($handle = opendir('./signature/cache/')) { // loop through the directory while reading each file name while(false !== ($entry = readdir($handle))) { // only work on the file if the file contains '.png' if(!(stripos($entry, '.png') === false)) { // remove characters we don't want $filename = preg_replace('/PID/','',$entry); $filename = preg_replace('/FAV0.png/','',$filename); $PlayerID = preg_replace('/FAV1.png/','',$filename); // do the signature function with the player's rank signature($PlayerID, 0, $clan_name, $BF4stats, $GameID); // do the signature function with the player's favority weapon signature($PlayerID, 1, $clan_name, $BF4stats, $GameID); } } } _>That should work as long as you put that code in the root directory. When you do it all in one lump sum though, it might take a while and time out. In my test on my server, only 271 files update before the server times out. PID20FAV1.png updated PID20FAV0.png updated PID1540FAV0.png updated PID2FAV1.png updated PID2FAV0.png updated PID1FAV0.png updated PID1FAV1.png updated PID2303FAV0.png updated PID2000FAV0.png updated PID2000FAV1.png updated PID2303FAV1.png updated PID871FAV0.png updated PID871FAV1.png updated PID2604FAV0.png updated PID2251FAV0.png updated PID2251FAV1.png updated PID1869FAV0.png updated PID1869FAV1.png updated PID3880FAV0.png updated PID3880FAV1.png updated PID784FAV0.png updated PID784FAV1.png updated PID3401FAV0.png updated PID3401FAV1.png updated PID2308FAV0.png updated PID2308FAV1.png updated PID217FAV0.png updated PID217FAV1.png updated PID3586FAV0.png updated PID3586FAV1.png updated PID6595FAV0.png updated PID6595FAV1.png updated PID1540FAV1.png updated PID17612FAV0.png updated PID17612FAV1.png updated PID9009FAV0.png updated PID9009FAV1.png updated PID1207FAV0.png updated PID1207FAV1.png updated PID8969FAV0.png updated PID8969FAV1.png updated PID791FAV0.png updated PID791FAV1.png updated PID5290FAV0.png updated PID5290FAV1.png updated PID609FAV0.png updated PID609FAV1.png updated PID631FAV0.png updated PID631FAV1.png updated PID657FAV0.png updated PID657FAV1.png updated PID682FAV0.png updated PID682FAV1.png updated PID7224FAV0.png updated PID7224FAV1.png updated PID7235FAV0.png updated PID7235FAV1.png updated PID735FAV0.png updated PID735FAV1.png updated PID769FAV0.png updated PID769FAV1.png updated PID788FAV0.png updated PID788FAV1.png updated PID8870FAV0.png updated PID8870FAV1.png updated PID5668FAV0.png updated PID5668FAV1.png updated PID77FAV0.png updated PID77FAV1.png updated PID8164FAV0.png updated PID8164FAV1.png updated PID99FAV0.png updated PID99FAV1.png updated PID2232FAV0.png updated PID2232FAV1.png updated PID3319FAV0.png updated PID3319FAV1.png updated PID275FAV0.png updated PID275FAV1.png updated PID58FAV0.png updated PID58FAV1.png updated PID12585FAV0.png updated PID12585FAV1.png updated PID4402FAV0.png updated PID4402FAV1.png updated PID11276FAV0.png updated PID11276FAV1.png updated PID13561FAV0.png updated PID13561FAV1.png updated PID1456FAV0.png updated PID1456FAV1.png updated PID11884FAV0.png updated PID11884FAV1.png updated PID1194FAV0.png updated PID1194FAV1.png updated PID120FAV0.png updated PID120FAV1.png updated PID12038FAV0.png updated PID12038FAV1.png updated PID5460FAV0.png updated PID5460FAV1.png updated PID5406FAV0.png updated PID5406FAV1.png updated PID110FAV0.png updated PID110FAV1.png updated PID1534FAV0.png updated PID1534FAV1.png updated PID3388FAV0.png updated PID3388FAV1.png updated PID6740FAV0.png updated PID6740FAV1.png updated PID656FAV0.png updated PID656FAV1.png updated PID3014FAV0.png updated PID3014FAV1.png updated PID5386FAV0.png updated PID5386FAV1.png updated PID867FAV0.png updated PID867FAV1.png updated PID4358FAV0.png updated PID4358FAV1.png updated PID11754FAV0.png updated PID11754FAV1.png updated PID2865FAV0.png updated PID2865FAV1.png updated PID7652FAV0.png updated PID7652FAV1.png updated PID1710FAV0.png updated PID1710FAV1.png updated PID13110FAV0.png updated PID13110FAV1.png updated PID9949FAV0.png updated PID9949FAV1.png updated PID17622FAV0.png updated PID17622FAV1.png updated PID104FAV0.png updated PID104FAV1.png updated PID108FAV0.png updated PID108FAV1.png updated PID156FAV0.png updated PID156FAV1.png updated PID1660FAV0.png updated PID1660FAV1.png updated PID167FAV0.png updated PID167FAV1.png updated PID17FAV0.png updated PID17FAV1.png updated PID174FAV0.png updated PID174FAV1.png updated PID1776FAV0.png updated PID1776FAV1.png updated PID2103FAV0.png updated PID2103FAV1.png updated PID2107FAV0.png updated PID2107FAV1.png updated PID232FAV0.png updated PID232FAV1.png updated PID238FAV0.png updated PID238FAV1.png updated PID240FAV0.png updated PID240FAV1.png updated PID2599FAV0.png updated PID2599FAV1.png updated PID2723FAV0.png updated PID2723FAV1.png updated PID276FAV0.png updated PID276FAV1.png updated PID281FAV0.png updated PID281FAV1.png updated PID2866FAV0.png updated PID2866FAV1.png updated PID2893FAV0.png updated PID2893FAV1.png updated PID3473FAV0.png updated PID3473FAV1.png updated PID5383FAV0.png updated PID5383FAV1.png updated PID79FAV0.png updated PID79FAV1.png updated PID866FAV0.png updated PID866FAV1.png updated PID17326FAV0.png updated PID17326FAV1.png updated PID17473FAV0.png updated PID17473FAV1.png updated PID17645FAV0.png updated PID17645FAV1.png updated PID2147FAV0.png updated PID2147FAV1.png updated PID2476FAV0.png updated PID2476FAV1.png updated PID2553FAV0.png updated PID2553FAV1.png updated PID2584FAV0.png updated PID2584FAV1.png updated PID2769FAV0.png updated PID2769FAV1.png updated PID2774FAV0.png updated PID2774FAV1.png updated PID3173FAV0.png updated PID3173FAV1.png updated PID3493FAV0.png updated PID3493FAV1.png updated PID3588FAV0.png updated PID3588FAV1.png updated PID3841FAV0.png updated PID3841FAV1.png updated PID3848FAV0.png updated PID3848FAV1.png updated PID3969FAV0.png updated PID3969FAV1.png updated PID4197FAV0.png updated PID4197FAV1.png updated PID436FAV0.png updated PID436FAV1.png updated PID4429FAV0.png updated PID4429FAV1.png updated PID4847FAV0.png updated PID4847FAV1.png updated PID5274FAV0.png updated PID5274FAV1.png updated PID5293FAV0.png updated PID5293FAV1.png updated PID5311FAV0.png updated PID5311FAV1.png updated PID5403FAV0.png updated PID5403FAV1.png updated PID5587FAV0.png updated PID5587FAV1.png updated PID5788FAV0.png updated PID5788FAV1.png updated PID6195FAV0.png updated PID6195FAV1.png updated PID6340FAV0.png updated PID6340FAV1.png updated PID6791FAV0.png updated PID6791FAV1.png updated PID7514FAV0.png updated PID7514FAV1.png updated PID7881FAV0.png updated PID7881FAV1.png updated PID7945FAV0.png updated PID7945FAV1.png updated PID8137FAV0.png updated PID8137FAV1.png updated PID8231FAV0.png updated PID8231FAV1.png updated PID832FAV0.png updated PID832FAV1.png updated PID84FAV0.png updated PID84FAV1.png updated PID8546FAV0.png updated PID8546FAV1.png updated PID8611FAV0.png updated PID8611FAV1.png updated PID8679FAV0.png updated PID8679FAV1.png updated PID8803FAV0.png updated PID8803FAV1.png updated PID8853FAV0.png updated PID8853FAV1.png updated PID8997FAV0.png updated PID8997FAV1.png updated PID9020FAV0.png updated PID9020FAV1.png updated PID9256FAV0.png updated PID9256FAV1.png updated PID9476FAV0.png updated PID9476FAV1.png updated PID9776FAV0.png updated PID9776FAV1.png updated Fatal error: Maximum execution time of 30 seconds exceeded in /home/content/16/11192016/html/bf4stats/player-stats/common/functions.php on line 1141 It would probably be a lot more profitable to just use CptChaos's hack to update only the images necessary when necessary. * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted December 29, 2013 Share Posted December 29, 2013 Originally Posted by Kinsman*: No no, your almost there! In Ezstats you can set the number of sigs to be updated to whatever you like, I have it on 15 currently. The cron job runs hourly, and updates 15 sigs each time. Where I get totally lost is how it remembers where its up to_? * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted December 29, 2013 Share Posted December 29, 2013 Originally Posted by ty_ger07*: No no, your almost there! In Ezstats you can set the number of sigs to be updated to whatever you like, I have it on 15 currently. The cron job runs hourly, and updates 15 sigs each time. Where I get totally lost is how it remembers where its up to_? I suppose it reads the file modification time and updates X number of oldest files. http://php.net/filemtime Example: Code: <_php // include config.php contents require_once('./config/config.php'); // include functions.php contents require_once('./common/functions.php'); // connect to the stats database $BF4stats = @mysqli_connect(HOST, USER, PASS, NAME, PORT); @mysqli_select_db($BF4stats, NAME); // this game ID // probably is 1 $GameID = 1; // create empty array $times = array(); // open directory to read file contents if($handle = opendir('./signature/cache/')) { // loop through the directory while reading each file name while(false !== ($entry = readdir($handle))) { // only check the file if the file contains '.png' if(!(stripos($entry, '.png') === false)) { // what is the file path and name_ $file = './signature/cache/' . $entry; // when this file modified_ $modified = filemtime($file); // add this file time to the times array $times[] = $modified; } } } // remove duplicates from array $times = array_unique($times); // order the array in lowest (earliest) to highest sort($times); // chop off anything after the first 10 times array_slice($times, 0, 10); // open directory to read file contents (again) if($handle = opendir('./signature/cache/')) { // loop through the directory while reading each file name (again) while((false !== ($entry = readdir($handle)))) { // what is the file path and name_ $file = './signature/cache/' . $entry; // when was it modified_ $modified = filemtime($file); // if this file modified time is in the array of oldest files, update the image if(in_array($modified, $times)) { // only work on the file if the file contains '.png' if(!(stripos($file, '.png') === false)) { // remove characters we don't want $filename = preg_replace('/PID/','',$entry); $filename = preg_replace('/FAV0.png/','',$filename); $PlayerID = preg_replace('/FAV1.png/','',$filename); // do the signature function with the player's rank signature($PlayerID, 0, $clan_name, $BF4stats, $GameID); // do the signature function with the player's favority weapon signature($PlayerID, 1, $clan_name, $BF4stats, $GameID); } } } } _>^^ A problem with the above code though is that it will do all files which were modified within the oldest 10 groups of times. If you run the task too often, the times will bunch up and you will have a bunch of files modified at the same time and therefore still update a bunch of files at once. But like I said, CptChaos's solution is much more elegant because it would give you updated information every time it is needed and no images would need to be cached or updated at all. * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted December 29, 2013 Share Posted December 29, 2013 Originally Posted by Jaffaman*: Here's an example: http://open-web-community.com/test/i...lclanmembers=1 In this example, it is looking for stats for PlayerID 1, 2, 3, or 4. clanmembers.php has these queries: Starting on Line 42 (server pagination query): Starting on Line 57 (global pagination query): Starting on Line 148 (server stats query): Starting on Line 164 (global stats query): Note that in each of those queries are the lines Change those PlayerIDs in all four queries to the PlayerIDs of interest and add as many PlayerIDs as you want separated by 'OR'. You can download it here: http://open-web-community.com/test/B...sTestStats.zip Files changed: index.php common/index.php Files added: clanmembers.php Great work love it thanks just one last question when do the player of the week stats get reset/restart ? as i noticed our potw page has not players but TBH i have not been keeping an eye on the to see if players have been added. * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted December 29, 2013 Share Posted December 29, 2013 Originally Posted by ty_ger07*: Great work love it thanks just one last question when do the player of the week stats get reset/restart ? as i noticed our potw page has not players but TBH i have not been keeping an eye on the to see if players have been added.Players of the week could be different every time you look at it. It never "resets". It is always current from this second to the corresponding second 7 days ago. It looks at the sessions table and picks out all the sessions within the last week and organizes them from top to bottom. If you have had players in your server over the last week but no players of the week are showing up, you must have session stats disabled in your plugin. By the way, as Kinsman pointed out, if you use the clan members page, I didn't properly edit the column links so that if you click the columns to order them by a different order other than score, it redirects you to the wrong page. myrcon.net/...stats-webpage-for-xpkillers-stats-logger-plugin#entry47344 * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted December 29, 2013 Share Posted December 29, 2013 Originally Posted by dingo_doo*: http://lms-bf4-stats.olympe.in/ Where is the error? * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted December 29, 2013 Share Posted December 29, 2013 Originally Posted by ty_ger07*: http://lms-bf4-stats.olympe.in/ Where is the error? You edited the files incorrectly. I can't say what exactly is incorrect since I don't know what you have edited. Your page is echoing config.php out to the world instead of processing it. First delete config.php and edit a new default version of config.php. It looks like you might have accidentally deleted "<_php and>" from the beginning and end of the file. You really should learn HTML, PHP, and CSS if you are planning to edit my files. Otherwise, you take support in your own hands. It is really easy to translate the page to French, but if you don't know how to do it, you should find someone who does. By the way, now anyone who clicks that link will know your database host, username, and password. You should really remove that information quickly. * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted December 29, 2013 Share Posted December 29, 2013 Originally Posted by dingo_doo*: I do not have to change the attributes of the file and I have followed your instructions. * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted December 29, 2013 Share Posted December 29, 2013 Originally Posted by ty_ger07*: I do not have to change the attributes of the file and I have followed your instructions.PHP will not echo out like that unless you tell it to. Something has been changed. Delete everything and start over. It is bad for you to leave this information online: // DATABASE INFORMATION DEFINE('HOST', 'xxx.net'); // database host address DEFINE('PORT', '3306'); // database port - default is 3306 DEFINE('NAME', 'xxx'); // database name DEFINE('USER', 'xxx'); // database user name - sometimes the same as the database name DEFINE('PASS', 'xxx'); // database password // CLAN NAME $clan_name = 'xxx'; // your gaming clan or organization name // PAGE BANNER $banner_image = 'http://les-morales.com/ajout%20images/5ans.jpg'; // your desired page banner // BANNER LINK $banner_url = 'http://les-morales.com/'; // where clicking the banner will take youYou username and password is visible to everyone. * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted December 29, 2013 Share Posted December 29, 2013 Originally Posted by Jaffaman*: Players of the week could be different every time you look at it. It never "resets". It is always current from this second to the corresponding second 7 days ago. It looks at the sessions table and picks out all the sessions within the last week and organizes them from top to bottom. If you have had players in your server over the last week but no players of the week are showing up, you must have session stats disabled in your plugin. By the way, as Kinsman pointed out, if you use the clan members page, I didn't properly edit the column links so that if you click the columns to order them by a different order other than score, it redirects you to the wrong page. myrcon.net/...stats-webpage-for-xpkillers-stats-logger-plugin#entry47344 Thanks a lot i have fixed the clan members page links also it looks like we had session on Yes but save sessiondata to DB No so i have now put that to Yes so it should work Thanks again for all your hard work. * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted December 29, 2013 Share Posted December 29, 2013 Originally Posted by dingo_doo*: Stays in me that has to find a who(which) translated into French thing(trick); to delete(eliminate), to reinstall, nothing works * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted December 29, 2013 Share Posted December 29, 2013 Originally Posted by ty_ger07*: Stays in me that has to find a who(which) translated into French thing(trick); to delete(eliminate), to reinstall, nothing worksI don't understand. Good luck! * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted December 31, 2013 Share Posted December 31, 2013 Originally Posted by ty_ger07*: Code in first post updated! Change: - potw.php minor change: group players by player id instead of stats id so that duplicate players aren't shown and full stats go to just one player. * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted December 31, 2013 Share Posted December 31, 2013 Originally Posted by Kinsman*: Thanks, I was wondering about those! * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted December 31, 2013 Share Posted December 31, 2013 Originally Posted by CptChaos*: I've found a bug within the graphs players.php and joinleaves.php. They keep on giving the same statistics, because it doesn't select the latest rows. To fix this, some code should be added in the query:Code: ORDER BY `TimeRoundStarted` DESC LIMIT {$limit}, it has to come AFTER the FROM or WHERE clause, see examples below. Updated snippets to compare: players.php: Code: // check if a server was provided // if so, this is a server stats page if(isset($_GET['server']) AND !empty($_GET['server'])) { $id = mysqli_real_escape_string($BF4stats, $_GET['server']); $query = "SELECT `MinPlayers`, `MaxPlayers`, `AvgPlayers` FROM `tbl_mapstats` WHERE ServerID = ". $id ." ORDER BY `TimeRoundStarted` DESC LIMIT {$limit}"; $result = mysqli_query($BF4stats, $query); } // this must be a global stats page else { $query = "SELECT `MinPlayers`, `MaxPlayers`, `AvgPlayers` FROM `tbl_mapstats` ORDER BY `TimeRoundStarted` DESC LIMIT {$limit}"; $result = mysqli_query($BF4stats, $query); }joinsleaves.php:Code: // check if a server was provided // if so, this is a server stats page if(isset($_GET['server']) AND !empty($_GET['server'])) { $id = mysqli_real_escape_string($BF4stats, $_GET['server']); $query = "SELECT `PlayersJoinedServer`, `PlayersLeftServer` FROM `tbl_mapstats` WHERE ServerID = ". $id ." ORDER BY `TimeRoundStarted` DESC LIMIT {$limit}"; $result = mysqli_query($BF4stats, $query); } // this must be a global stats page else { $query = "SELECT `PlayersJoinedServer`, `PlayersLeftServer` FROM `tbl_mapstats` ORDER BY `TimeRoundStarted` DESC LIMIT {$limit}"; $result = mysqli_query($BF4stats, $query); }Also, where 1 as where-clause is quite useless. * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted December 31, 2013 Share Posted December 31, 2013 Originally Posted by 101st-chicago*: nice find, I was just about to post a bug about this I've found a bug within the graphs players.php and joinleaves.php. They keep on giving the same statistics, because it doesn't select the latest rows. To fix this, some code should be added in the query:Code: ORDER BY `TimeRoundStarted` DESC LIMIT {$limit}, it has to come AFTER the FROM or WHERE clause, see examples below. Updated snippets to compare: players.php: Code: // check if a server was provided // if so, this is a server stats page if(isset($_GET['server']) AND !empty($_GET['server'])) { $id = mysqli_real_escape_string($BF4stats, $_GET['server']); $query = "SELECT `MinPlayers`, `MaxPlayers`, `AvgPlayers` FROM `tbl_mapstats` WHERE ServerID = ". $id ." ORDER BY `TimeRoundStarted` DESC LIMIT {$limit}"; $result = mysqli_query($BF4stats, $query); } // this must be a global stats page else { $query = "SELECT `MinPlayers`, `MaxPlayers`, `AvgPlayers` FROM `tbl_mapstats` ORDER BY `TimeRoundStarted` DESC LIMIT {$limit}"; $result = mysqli_query($BF4stats, $query); }joinsleaves.php:Code: // check if a server was provided // if so, this is a server stats page if(isset($_GET['server']) AND !empty($_GET['server'])) { $id = mysqli_real_escape_string($BF4stats, $_GET['server']); $query = "SELECT `PlayersJoinedServer`, `PlayersLeftServer` FROM `tbl_mapstats` WHERE ServerID = ". $id ." ORDER BY `TimeRoundStarted` DESC LIMIT {$limit}"; $result = mysqli_query($BF4stats, $query); } // this must be a global stats page else { $query = "SELECT `PlayersJoinedServer`, `PlayersLeftServer` FROM `tbl_mapstats` ORDER BY `TimeRoundStarted` DESC LIMIT {$limit}"; $result = mysqli_query($BF4stats, $query); }Also, where 1 as where-clause is quite useless. * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted December 31, 2013 Share Posted December 31, 2013 Originally Posted by ty_ger07*: I've found a bug within the graphs players.php and joinleaves.php. They keep on giving the same statistics, because it doesn't select the latest rows. To fix this, some code should be added in the query:Code: ORDER BY `TimeRoundStarted` DESC LIMIT {$limit}, it has to come AFTER the FROM or WHERE clause, see examples below. Updated snippets to compare: players.php: Code: // check if a server was provided // if so, this is a server stats page if(isset($_GET['server']) AND !empty($_GET['server'])) { $id = mysqli_real_escape_string($BF4stats, $_GET['server']); $query = "SELECT `MinPlayers`, `MaxPlayers`, `AvgPlayers` FROM `tbl_mapstats` WHERE ServerID = ". $id ." ORDER BY `TimeRoundStarted` DESC LIMIT {$limit}"; $result = mysqli_query($BF4stats, $query); } // this must be a global stats page else { $query = "SELECT `MinPlayers`, `MaxPlayers`, `AvgPlayers` FROM `tbl_mapstats` ORDER BY `TimeRoundStarted` DESC LIMIT {$limit}"; $result = mysqli_query($BF4stats, $query); }joinsleaves.php:Code: // check if a server was provided // if so, this is a server stats page if(isset($_GET['server']) AND !empty($_GET['server'])) { $id = mysqli_real_escape_string($BF4stats, $_GET['server']); $query = "SELECT `PlayersJoinedServer`, `PlayersLeftServer` FROM `tbl_mapstats` WHERE ServerID = ". $id ." ORDER BY `TimeRoundStarted` DESC LIMIT {$limit}"; $result = mysqli_query($BF4stats, $query); } // this must be a global stats page else { $query = "SELECT `PlayersJoinedServer`, `PlayersLeftServer` FROM `tbl_mapstats` ORDER BY `TimeRoundStarted` DESC LIMIT {$limit}"; $result = mysqli_query($BF4stats, $query); }Also, where 1 as where-clause is quite useless.Copy. Another issue of course is that user's browsers will cache the image and will display the old one even if a newer one is produced. * Restored post. It could be that the author is no longer active. Link to comment
ImportBot Posted December 31, 2013 Share Posted December 31, 2013 Originally Posted by CptChaos*: You can give headers along with the image, before PHP sends output. You just have to set the Expires header to a past date, like this for example: Code: header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");Put this under <_php and you can be sure this header will set.> And a small addition to above; checking if a variable exists and checking if it's not empty seems logic, but checking wheter or not a variable is empty is enough. It returns false when a variable doesn't exist. So if a variable isn't empty, you know it also exists, because without it existence, it can't have (a) value. If you want a better check I suggest to use is_numeric($var) && !empty($var), rather then if($var && !empty($var)). * Restored post. It could be that the author is no longer active. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.