Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <style>
- body {
- margin: 0;
- background:#ddd;
- }
- h2 {
- margin:5px;
- }
- table {
- border-collapse:collapse;
- background:#333;
- color:#BBB;
- }
- th {
- border-left:1px solid #000;
- border-right:1px solid #000;
- border-bottom:1px solid #000;
- color:#fe5;
- }
- #border {
- border-left:1px solid #000;
- border-right:1px solid #000;
- border-bottom:1px solid #000;
- }
- #border td {
- border-left:1px solid #000;
- border-right:1px solid #000;
- }
- </style>
- <?php
- $host = 'localhost';
- $user = 'root';
- $pass = '';
- $rdb = 'auth';
- $connect = mysql_connect($host,$user,$pass) or die('Нет подключения к базе данных');
- mysql_select_db ($rdb, $connect) or die(mysql_error());
- $sql_restarts = mysql_query("SET NAMES cp1251");
- $sql_restarts = mysql_query("SELECT * FROM `uptime` WHERE `realmid`= 1 ORDER BY `starttime` DESC LIMIT 10", $connect) or die(mysql_error());
- print "<h2 align=\"center\">Последние рестарты</h2>
- <table cellpadding=\"1\" cellspacing=\"1\" align=\"center\" width=\"500\"><tr>
- <th width=\"30\">№</th>
- <th width=\"180\">Время запуска</th>
- <th width=\"180\">Время работы</th>
- <th>Всего игроков</th>
- </tr></table>";
- $id = 1;
- while ($result_restarts = mysql_fetch_array($sql_restarts)){
- $starttime = date("H:i:s d.m.Y", $result_restarts['starttime']);
- $max_players = $result_restarts['maxplayers'];
- $uptime = $result_restarts['uptime'];
- $sec = $uptime%60;
- $uptime = intval ($uptime/60);
- $min = $uptime%60;
- $uptime = intval ($uptime/60);
- $hour = $uptime%24;
- $uptime = intval($uptime/24);
- $day = $uptime;
- if ($day != 0)
- $day = $day." д";
- else
- $day = "";
- if ($hour != 0)
- $hour = $hour." ч";
- else
- $hour = "";
- if ($min != 0)
- $min = $min." м";
- else
- $min = "";
- print "<table cellpadding=\"1\" cellspacing=\"1\" align=\"center\" width=\"500\" id=\"border\"><tr>
- <td align=\"center\" width=\"30\">$id</td>
- <td align=\"center\" width=\"180\">$starttime</td>
- <td align=\"center\" width=\"180\">$day $hour $min</td>
- <td align=\"center\">$max_players</td>
- </tr></table>";
- $id++;
- }
- $sql_max_player = mysql_query("SET NAMES cp1251");
- $sql_max_player = mysql_query("SELECT * FROM `uptime` WHERE `realmid`= 1 ORDER BY `maxplayers` DESC LIMIT 10", $connect) or die(mysql_error());
- print "<h2 align=\"center\">Топ максимального числа игроков</h2>
- <table cellpadding=\"1\" cellspacing=\"1\" align=\"center\" width=\"500\"><tr>
- <th width=\"30\">№</th>
- <th width=\"180\">Время запуска</th>
- <th width=\"180\">Время работы</th>
- <th>Максимум игроков</th>
- </tr></table>";
- $id = 1;
- while ($result = mysql_fetch_array($sql_max_player)){
- $starttime = date("H:i:s d.m.Y", $result['starttime']);
- $max_players = $result['maxplayers'];
- $uptime = $result['uptime'];
- $seconds = $uptime%60;
- $uptime = intval ($uptime/60);
- $minutes = $uptime%60;
- $uptime = intval ($uptime/60);
- $hours = $uptime%24;
- $uptime = intval($uptime/24);
- $days = $uptime;
- if ($days != 0)
- $days = $days." д";
- else
- $days = "";
- if ($hours != 0)
- $hours = $hours." ч";
- else
- $hours = "";
- if ($minutes != 0)
- $minutes = $minutes." м";
- else
- $minutes = "";
- print "<table cellpadding=\"1\" cellspacing=\"1\" align=\"center\" width=\"500\" id=\"border\"><tr>
- <td align=\"center\" width=\"30\">$id</td>
- <td align=\"center\" width=\"180\">$starttime</td>
- <td align=\"center\" width=\"180\">$days $hours $minutes</td>
- <td align=\"center\">$max_players</td>
- </tr></table>";
- $id++;
- }
- mysql_close($connect);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement