PageRenderTime 48ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/web/admin/module/analysis/faction_online_log.php

https://gitlab.com/xusasuke6/Slg_php
PHP | 97 lines | 85 code | 12 blank | 0 comment | 12 complexity | 478ec856d7ceeef60c6558a3eeda0cc7 MD5 | raw file
  1. <?php
  2. define('IN_DATANG_SYSTEM', true);
  3. include "../../../config/config.php";
  4. include SYSDIR_ROOT_CLIENT.'config/config.key.php';
  5. include "../../../admin/class/log_gold_class.php";
  6. include SYSDIR_ADMIN.'/include/global.php';
  7. global $smarty;
  8. if(!isset($_REQUEST['dateStart'])){
  9. $dateStart = strftime ("%Y-%m-%d", time()-2*86400);
  10. }else{
  11. $dateStart = $_REQUEST['dateStart'];
  12. }
  13. if(!isset($_REQUEST['dateEnd'])){
  14. $dateEnd = strftime("%Y-%m-%d");
  15. }else{
  16. $dateEnd = $_REQUEST['dateEnd'];
  17. }
  18. $u_start_time = strtotime($dateStart.' 00:00');
  19. $u_end_time = strtotime($dateEnd.' 23:59');
  20. $sql_count = "SELECT * FROM `t_log_faction_online` WHERE mtime>=" .
  21. $u_start_time .
  22. " and mtime <=" .
  23. $u_end_time ;
  24. $count_result = count(GFetchRowSet($sql_count));
  25. $whichpage = isset($_REQUEST['whichpage']) ? $_REQUEST['whichpage'] : 1;
  26. if(!$whichpage) {
  27. $notepage=1;
  28. }
  29. else {
  30. $notepage=$whichpage;
  31. }
  32. $pagesize=10;
  33. $noterecs=($notepage-1)*$pagesize;
  34. $pagecount=ceil($count_result/$pagesize);
  35. $sql = "SELECT * FROM `t_log_faction_online` WHERE mtime>=" .
  36. $u_start_time .
  37. " and mtime <=" .
  38. $u_end_time
  39. . " order by mtime desc LIMIT ".$noterecs." , ".$pagesize;
  40. $result_buf = GFetchRowSet($sql);
  41. $result =array();
  42. foreach($result_buf as $k => $v)
  43. {
  44. $result[$k] = $v;
  45. if($v['tonline'] != 0 && $v['sonline'] != 0)
  46. {
  47. $result[$k]['t_online_rate'] = round($v['tonline']/($v['tonline'] + $v['sonline']),3) *100;
  48. $result[$k]['s_online_rate'] = round($v['sonline']/($v['tonline'] + $v['sonline']),3) *100;
  49. }
  50. else
  51. {
  52. $result[$k]['t_online_rate'] = 0;
  53. $result[$k]['s_online_rate'] = 0;
  54. }
  55. }
  56. $noterecs=$noterecs+1;
  57. $fisrt=1;
  58. $prev=$whichpage-1;
  59. $next=$whichpage+1;
  60. $last=$pagecount;
  61. if($count_result > 0)
  62. {
  63. $page = "<a href='faction_online_log.php?whichpage=".$fisrt."&dateStart=".$dateStart."&dateEnd=".$dateEnd."'>".$buf_lang['conmon']['home_page']."
  64. </a></font>&nbsp;&nbsp";
  65. if($whichpage>1) {
  66. $page.= "<a href='faction_online_log.php?whichpage=".$prev."&dateStart=".$dateStart."&dateEnd=".$dateEnd."'>".$buf_lang['conmon']['previous_page']."</a> ";
  67. }
  68. for($counter=1;$counter<=$pagecount;$counter++) {
  69. $page.= ("<font size=+1 color=red><a href='faction_online_log.php?
  70. whichpage=".$counter."&dateStart=".$dateStart."&dateEnd=".$dateEnd."'>".$pad.$counter."</a></font>&nbsp;&nbsp;");
  71. }
  72. if($whichpage < $pagecount) {
  73. $page.= "<a href='faction_online_log.php?whichpage=".$next."&dateStart=".$dateStart."&dateEnd=".$dateEnd."'>".$buf_lang['conmon']['next_page']."</a> ";
  74. }
  75. $page.= "<a href='faction_online_log.php?whichpage=".$pagecount."&dateStart=".$dateStart."&dateEnd=".$dateEnd."'>".$buf_lang['conmon']['last_page']."</a> ";
  76. $page.= "".$buf_lang['conmon']['all_page']."(".$pagecount.")";
  77. $page.= "".$buf_lang['conmon']['total'].$rsnum.$buf_lang['conmon']['records']."";
  78. }
  79. $smarty->assign("page",$page);
  80. $smarty->assign('whichpage',$whichpage);
  81. $smarty->assign("dateStart", $dateStart);
  82. $smarty->assign("dateEnd", $dateEnd);
  83. $smarty->assign("result", $result);
  84. $smarty->display("module/analysis/faction_online_log.html");