How can I change stats

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • How can I change stats

      Hi,
      I want to be statistic top1-topMAX on one page.
      Not:
      1-100
      101-200
      201-300

      What file?
      I edit stat.php and nothing.

      PHP Source Code

      1. $SelectCount = doquery("SELECT COUNT(`id_owner`) AS `count` FROM {{table}} WHERE `stat_type` = {$who};", 'statpoints', true);
      2. $SelectCount = $SelectCount['count'];
      3. if($SelectCount > 100)
      4. {
      5. $LastPage = floor($SelectCount / 100);
      6. if($SelectCount / 100 == $LastPage)
      7. {
      8. $LastPage -= 1;
      9. }
      10. for($Page = 0; $Page <= $LastPage; $Page += 1)
      11. {
      12. $PageValue = ($Page * 100) + 1;
      13. if($Page == $LastPage)
      14. {
      15. $PageRange = $SelectCount;
      16. }
      17. else
      18. {
      19. $PageRange = $PageValue + 99;
      20. }
      21. $parse['range'] .= '<option value="'. $PageValue .'"'. (($range >= $PageValue AND $range <= $PageRange) ? ' selected' : '') .'>'. $PageValue .'-'. $PageRange .'</option>';
      22. }
      23. $parse['HideNoRangeSelector'] = 'display: none;';
      24. }
      25. else
      26. {
      27. $parse['HideRangeSelector'] = 'display: none;';
      28. $parse['MaxPlace'] = $SelectCount;
      29. }
      30. $range -= 1;
      31. $start = floor($range / 100) * 100;
      32. if($start == 0)
      33. {
      34. $start = '0';
      35. }
      Display All
    • Вы имеете ввиду админ в статистике ? - или вывод списка ?

      если нужен вывод админов то присвойте $range -= 1; на $range -= 5; новое значение, а админу ранг в базе как вариант


      пример для 1.9
      сколько на одном листе выводить пользователей
      case 1:
      $MaxUsers = $config->users_amount;
      $range = min($range, $MaxUsers);
      $LastPage = max(1, ceil($MaxUsers / 1000)); 1000 это число где выводим количество пользователей на страницу


      перевод был не корректен и не совсем понял то что просили , надеюсь помог

      Сделаю любой обычный. или динамический дизайн макет на любую версию в векторной графике (или подготовлю в css) могу сделать копию любого стиля

      The post was edited 3 times, last by sumrak ().

    • I want 1000 users on stats page, not 100 users x 10 page.
      I havn't 2moons engine, I think this is old xnova or somethings similar

      My stats.php

      PHP Source Code

      1. <?php
      2. define('INSIDE', true);
      3. $_AllowInVacationMode = true;
      4. $_EnginePath = './';
      5. include($_EnginePath.'common.php');
      6. loggedCheck();
      7. includeLang('stat');
      8. $Now = time();
      9. $parse = $_Lang;
      10. $parse['stat_values'] = '';
      11. $who = (isset($_POST['who']) ? $_POST['who'] : ((isset($_GET['who']) ? $_GET['who'] : null)));
      12. if($who != 1 AND $who != 2)
      13. {
      14. $who = 1;
      15. }
      16. $type = (isset($_POST['type']) ? $_POST['type'] : ((isset($_GET['type']) ? $_GET['type'] : null)));
      17. if(!isset($type))
      18. {
      19. $type= 1;
      20. }
      21. $range = (isset($_POST['range']) ? $_POST['range'] : ((isset($_GET['range']) ? $_GET['range'] : null)));
      22. if(!isset($range))
      23. {
      24. if(isset($_GET['start']))
      25. {
      26. $range = intval($_GET['start']);
      27. }
      28. else
      29. {
      30. $range = 1;
      31. }
      32. }
      33. if($range <= 0)
      34. {
      35. $range = 1;
      36. }
      37. $parse['who'] = '';
      38. $parse['who'] .= '<option value="1"'. (($who == 1) ? ' selected' : '') .'>'. $_Lang['stat_player'] .'</option>';
      39. $parse['who'] .= '<option value="2"'. (($who == 2) ? ' selected' : '') .'>'. $_Lang['stat_allys'].'</option>';
      40. $parse['LastWhoVal'] = $who;
      41. $parse['type'] = '<option value="1"'. (($type == 1) ? ' selected' : '') .'>'. $_Lang['stat_main'] .'</option>';
      42. $parse['type'] .= '<option value="2"'. (($type == 2) ? ' selected' : '') .'>'. $_Lang['stat_fleet'].'</option>';
      43. $parse['type'] .= '<option value="3"'. (($type == 3) ? ' selected' : '') .'>'. $_Lang['stat_research'] .'</option>';
      44. $parse['type'] .= '<option value="4"'. (($type == 4) ? ' selected' : '') .'>'. $_Lang['stat_building'] .'</option>';
      45. $parse['type'] .= '<option value="5"'. (($type == 5) ? ' selected' : '') .'>'. $_Lang['stat_defenses'] .'</option>';
      46. if($type == 2)
      47. {
      48. $Order = 'fleet_rank';
      49. $Points = 'fleet_points';
      50. $Rank = 'fleet_rank';
      51. $OldRank = 'fleet_old_rank';
      52. $YesterdayRank = 'fleet_yesterday_rank';
      53. }
      54. else if($type == 3)
      55. {
      56. $Order = 'tech_rank';
      57. $Points = 'tech_points';
      58. $Rank = 'tech_rank';
      59. $OldRank = 'tech_old_rank';
      60. $YesterdayRank = 'tech_yesterday_rank';
      61. }
      62. else if($type == 4)
      63. {
      64. $Order = 'build_rank';
      65. $Points = 'build_points';
      66. $Rank = 'build_rank';
      67. $OldRank = 'build_old_rank';
      68. $YesterdayRank = 'build_yesterday_rank';
      69. }
      70. else if($type == 5)
      71. {
      72. $Order = 'defs_rank';
      73. $Points = 'defs_points';
      74. $Rank = 'defs_rank';
      75. $OldRank = 'defs_old_rank';
      76. $YesterdayRank = 'defs_yesterday_rank';
      77. }
      78. else
      79. {
      80. $Order = 'total_rank';
      81. $Points = 'total_points';
      82. $Rank = 'total_rank';
      83. $OldRank = 'total_old_rank';
      84. $YesterdayRank = 'total_yesterday_rank';
      85. }
      86. $SelectCount = doquery("SELECT COUNT(`id_owner`) AS `count` FROM {{table}} WHERE `stat_type` = {$who};", 'statpoints', true);
      87. $SelectCount = $SelectCount['count'];
      88. if($SelectCount > 100)
      89. {
      90. $LastPage = floor($SelectCount / 100);
      91. if($SelectCount / 100 == $LastPage)
      92. {
      93. $LastPage -= 1;
      94. }
      95. for($Page = 0; $Page <= $LastPage; $Page += 1)
      96. {
      97. $PageValue = ($Page * 100) + 1;
      98. if($Page == $LastPage)
      99. {
      100. $PageRange = $SelectCount;
      101. }
      102. else
      103. {
      104. $PageRange = $PageValue + 99;
      105. }
      106. $parse['range'] .= '<option value="'. $PageValue .'"'. (($range >= $PageValue AND $range <= $PageRange) ? ' selected' : '') .'>'. $PageValue .'-'. $PageRange .'</option>';
      107. }
      108. $parse['HideNoRangeSelector'] = 'display: none;';
      109. }
      110. else
      111. {
      112. $parse['HideRangeSelector'] = 'display: none;';
      113. $parse['MaxPlace'] = $SelectCount;
      114. }
      115. $range -= 1;
      116. $start = floor($range / 100) * 100;
      117. if($start == 0)
      118. {
      119. $start = '0';
      120. }
      121. if($who == 1)
      122. {
      123. // UserStats
      124. $IsUser = true;
      125. $UseKey = 'player';
      126. $StatHeader = 'stat_playertable_header';
      127. $NeedenFields = "{{prefix}}users.id, {{prefix}}users.username, {{prefix}}users.old_username, {{prefix}}users.old_username_expire, `ally`.`ally_name`, {{prefix}}users.ally_id, {{prefix}}users.is_banned, {{prefix}}users.is_onvacation, {{prefix}}users.ban_endtime, `users_stats`.*";
      128. $GetQuery = "SELECT {{table}}.*, {$NeedenFields} FROM {{table}} LEFT JOIN {{prefix}}achievements_stats AS `users_stats` ON `users_stats`.`A_UserID` = {{table}}.id_owner LEFT JOIN {{prefix}}users ON {{prefix}}users.id = {{table}}.id_owner LEFT JOIN {{prefix}}alliance AS `ally` ON `ally`.`id` = {{prefix}}users.`ally_id` WHERE `stat_type` = '1' ORDER BY `{$Order}` ASC LIMIT {$start}, 100;";
      129. $RowTPL = gettemplate('stat_playertable');
      130. $ColSpan = 10;
      131. }
      132. else
      133. {
      134. // AllyStats
      135. $IsUser = false;
      136. $UseKey = 'ally';
      137. $StatHeader = 'stat_alliancetable_header';
      138. $GetQuery = "SELECT {{table}}.*, {{prefix}}alliance.id AS `ally_id`, {{prefix}}alliance.ally_name, {{prefix}}alliance.ally_tag, {{prefix}}alliance.ally_members FROM {{table}} LEFT JOIN {{prefix}}alliance ON {{prefix}}alliance.id = {{table}}.id_owner WHERE `stat_type` = '2' ORDER BY `{$Order}` ASC LIMIT {$start}, 100;";
      139. $RowTPL = gettemplate('stat_alliancetable');
      140. $ColSpan = 7;
      141. }
      142. $parse['stat_header'] = parsetemplate(gettemplate($StatHeader), $parse);
      143. $parse['stat_date'] = '<span class="lime">'.prettyDate('d m Y - H:i:s', $_GameConfig['last_update'], 1).'</span>';
      144. $SelectRows = doquery($GetQuery, 'statpoints');
      145. $start += 1;
      146. if(mysql_num_rows($SelectRows) > 0)
      147. {
      148. while($StatRow = mysql_fetch_assoc($SelectRows))
      149. {
      150. if($start % 2 == 1)
      151. {
      152. $parse['EvenOrOdd'] = 'odd';
      153. }
      154. else
      155. {
      156. $parse['EvenOrOdd'] = 'even';
      157. }
      158. $parse['Position'] = $start;
      159. // Quick Rank Change
      160. $rank_new = $StatRow[$Rank];
      161. $rank_old = $StatRow[$OldRank];
      162. $rank_yesterday = $StatRow[$YesterdayRank];
      163. if($rank_old == 0)
      164. {
      165. $ranking = 0;
      166. }
      167. else
      168. {
      169. $ranking = $rank_old - $rank_new;
      170. }
      171. if($ranking == 0)
      172. {
      173. $parse['quickchange'] = '*';
      174. $parse['QuickChange_Color'] = 'sky';
      175. }
      176. else if($ranking < 0)
      177. {
      178. $parse['quickchange'] = $ranking;
      179. $parse['QuickChange_Color'] = 'red';
      180. }
      181. else
      182. {
      183. $parse['quickchange'] = '+'.$ranking;
      184. $parse['QuickChange_Color'] = 'green';
      185. }
      186. // Daily Rank Change
      187. if($rank_yesterday == 0)
      188. {
      189. $ranking_daily = 0;
      190. }
      191. else
      192. {
      193. $ranking_daily = $rank_yesterday - $rank_new;
      194. }
      195. if($ranking_daily == 0)
      196. {
      197. $parse['daychange'] = '*';
      198. $parse['DayChange_Color'] = 'sky';
      199. }
      200. else if($ranking_daily < 0)
      201. {
      202. $parse['daychange'] = $ranking_daily;
      203. $parse['DayChange_Color'] = 'red';
      204. }
      205. else
      206. {
      207. $parse['daychange'] = '+'.$ranking_daily;
      208. $parse['DayChange_Color'] = 'green';
      209. }
      210. $parse['Points'] = prettyNumber($StatRow[$Points]);
      211. $parse['ally_id'] = $StatRow['ally_id'];
      212. if($IsUser)
      213. {
      214. // Parse UserRows
      215. $parse['player_id'] = $StatRow['id'];
      216. if($StatRow['id'] == $_User['id'])
      217. {
      218. $parse['Name'] = '<span class="lime">'.$StatRow['username'].'</span>';
      219. }
      220. else
      221. {
      222. $parse['Name'] = $StatRow['username'];
      223. }
      224. if($StatRow['old_username_expire'] > $Now)
      225. {
      226. $parse['Name'] .= ' <acronym class="point" title="'.$_Lang['Old_username_is'].': '.$StatRow['old_username'].'">(?)</acronym>';
      227. }
      228. if($StatRow['is_banned'] == 1)
      229. {
      230. $parse['Name'] = '<acronym title="'.$_Lang['User_is_banned'].'" class="red point">'.$parse['Name'].'</acronym>';
      231. }
      232. else if(isOnVacation ($StatRow))
      233. {
      234. $parse['Name'] = '<acronym title="'.$_Lang['User_is_on_vacations'].'" class="sky point">'.$parse['Name'].'</acronym>';
      235. }
      236. $parse['Fig_Won'] = prettyNumber($StatRow['ustat_raids_won']);
      237. $parse['Fig_Lost'] = prettyNumber($StatRow['ustat_raids_lost']);
      238. $parse['Fig_Draw'] = prettyNumber($StatRow['ustat_raids_draw']);
      239. $parse['player_mes'] = '<a href="messages.php?mode=write&uid='.$StatRow['id_owner'].'"><img src="'.$_SkinPath.'img/m.gif" border="0" alt="'.$_Lang['Ecrire'].'"/></a>';
      240. if($StatRow['ally_id'] == $_User['ally_id'] AND $_User['ally_id'] > 0)
      241. {
      242. $parse['player_alliance'] = '<span class="ally">'.$StatRow['ally_name'].'</span>';
      243. }
      244. else
      245. {
      246. $parse['player_alliance'] = $StatRow['ally_name'];
      247. }
      248. }
      249. else
      250. {
      251. // Parse AllyRows
      252. if($StatRow['ally_id'] == $_User['ally_id'])
      253. {
      254. $parse['Name'] = '<span class="lime">'.$StatRow['ally_name'].'</span>';
      255. }
      256. else
      257. {
      258. $parse['Name'] = $StatRow['ally_name'];
      259. }
      260. $parse['ally_tag'] = $StatRow['ally_tag'];
      261. $parse['ally_members'] = $StatRow['ally_members'];
      262. if($StatRow['ally_members'] > 0)
      263. {
      264. $parse['ally_members_points']= prettyNumber(floor($StatRow[$Points] / $StatRow['ally_members']));
      265. }
      266. else
      267. {
      268. $parse['ally_members_points']= '0';
      269. }
      270. }
      271. $parse['stat_values'] .= parsetemplate($RowTPL, $parse);
      272. $start += 1;
      273. }
      274. }
      275. else
      276. {
      277. $parse['stat_values'] = '<tr><th colspan="'.$ColSpan.'" class="red">'.$_Lang['No_Rows_Found'].'</th></tr>';
      278. }
      279. $page = parsetemplate(gettemplate('stat_body'), $parse);
      280. display($page, $_Lang['stat_title']);
      281. ?>
      Display All
    • hello according to your code try to change every 100 in 1000
      I remain at your disposal on the forum for any questions or help.

      A help is of course not a creation of a mod



      -------------------------------------------------------
      My personal game
      OUnivers - Close
      Xterium - Abandonned