Advertisement
Guest User

restart

a guest
Sep 12th, 2013
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.59 KB | None | 0 0
  1. <style>
  2. body {
  3.     margin: 0;
  4.     background:#ddd;
  5. }
  6. h2 {
  7.     margin:5px;
  8. }
  9. table {
  10.     border-collapse:collapse;
  11.     background:#333;
  12.     color:#BBB;
  13. }
  14. th {
  15.     border-left:1px solid #000;
  16.     border-right:1px solid #000;
  17.     border-bottom:1px solid #000;
  18.     color:#fe5;
  19. }
  20. #border {
  21.     border-left:1px solid #000;
  22.     border-right:1px solid #000;
  23.     border-bottom:1px solid #000;
  24. }
  25. #border td {
  26.     border-left:1px solid #000;
  27.     border-right:1px solid #000;   
  28. }
  29. </style>
  30. <?php
  31. $host = 'localhost';
  32. $user = 'root';
  33. $pass = '';
  34. $rdb = 'auth';
  35.  
  36. $connect = mysql_connect($host,$user,$pass) or die('Нет подключения к базе данных');
  37. mysql_select_db ($rdb, $connect) or die(mysql_error());
  38. $sql_restarts = mysql_query("SET NAMES cp1251");
  39. $sql_restarts = mysql_query("SELECT * FROM `uptime` WHERE `realmid`= 1 ORDER BY `starttime` DESC LIMIT 10", $connect) or die(mysql_error());
  40. print "<h2 align=\"center\">Последние рестарты</h2>
  41. <table cellpadding=\"1\" cellspacing=\"1\" align=\"center\" width=\"500\"><tr>
  42. <th width=\"30\">№</th>
  43. <th width=\"180\">Время запуска</th>
  44. <th width=\"180\">Время работы</th>
  45. <th>Всего игроков</th>
  46. </tr></table>";
  47. $id = 1;
  48. while ($result_restarts = mysql_fetch_array($sql_restarts)){
  49.     $starttime = date("H:i:s d.m.Y", $result_restarts['starttime']);
  50.     $max_players = $result_restarts['maxplayers'];
  51.     $uptime = $result_restarts['uptime'];
  52.     $sec = $uptime%60;
  53.     $uptime = intval ($uptime/60);
  54.     $min = $uptime%60;
  55.     $uptime = intval ($uptime/60);
  56.     $hour = $uptime%24;
  57.     $uptime = intval($uptime/24);
  58.     $day = $uptime;
  59.    
  60.     if ($day != 0)
  61.         $day = $day." д";
  62.     else
  63.         $day = "";
  64.     if ($hour != 0)
  65.         $hour = $hour." ч";
  66.     else
  67.         $hour = "";
  68.     if ($min != 0)
  69.         $min = $min." м";
  70.     else
  71.         $min = "";
  72.  
  73.    
  74.     print "<table cellpadding=\"1\" cellspacing=\"1\" align=\"center\" width=\"500\" id=\"border\"><tr>
  75.     <td align=\"center\" width=\"30\">$id</td>
  76.     <td align=\"center\" width=\"180\">$starttime</td>
  77.     <td align=\"center\" width=\"180\">$day $hour $min</td>
  78.     <td align=\"center\">$max_players</td>
  79.     </tr></table>";
  80. $id++;
  81. }
  82. $sql_max_player = mysql_query("SET NAMES cp1251");
  83. $sql_max_player = mysql_query("SELECT * FROM `uptime` WHERE `realmid`= 1 ORDER BY `maxplayers` DESC LIMIT 10", $connect) or die(mysql_error());
  84. print "<h2 align=\"center\">Топ максимального числа игроков</h2>
  85. <table cellpadding=\"1\" cellspacing=\"1\" align=\"center\" width=\"500\"><tr>
  86. <th width=\"30\">№</th>
  87. <th width=\"180\">Время запуска</th>
  88. <th width=\"180\">Время работы</th>
  89. <th>Максимум игроков</th>
  90. </tr></table>";
  91. $id = 1;
  92. while ($result = mysql_fetch_array($sql_max_player)){
  93.     $starttime = date("H:i:s d.m.Y", $result['starttime']);
  94.     $max_players = $result['maxplayers'];
  95.     $uptime = $result['uptime'];
  96.     $seconds = $uptime%60;
  97.     $uptime = intval ($uptime/60);
  98.     $minutes = $uptime%60;
  99.     $uptime = intval ($uptime/60);
  100.     $hours = $uptime%24;
  101.     $uptime = intval($uptime/24);
  102.     $days = $uptime;
  103.    
  104.     if ($days != 0)
  105.         $days = $days." д";
  106.     else
  107.         $days = "";
  108.     if ($hours != 0)
  109.         $hours = $hours." ч";
  110.     else
  111.         $hours = "";
  112.     if ($minutes != 0)
  113.         $minutes = $minutes." м";
  114.     else
  115.         $minutes = "";
  116.    
  117.     print "<table cellpadding=\"1\" cellspacing=\"1\" align=\"center\" width=\"500\" id=\"border\"><tr>
  118.     <td align=\"center\" width=\"30\">$id</td>
  119.     <td align=\"center\" width=\"180\">$starttime</td>
  120.     <td align=\"center\" width=\"180\">$days $hours $minutes</td>
  121.     <td align=\"center\">$max_players</td>
  122.     </tr></table>";
  123. $id++;
  124. }
  125. mysql_close($connect);
  126. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement