Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html lang="en"> </html>
- <head>
- <style>
- body { font-family:courier,serif }
- </style>
- </head>
- <?php
- function seconds_to_string($seconds) {
- $hours = floor($seconds / 3600);
- $mins = floor($seconds / 60 % 60);
- $secs = floor($seconds % 60);
- return sprintf('%02d:%02d:%02d', $hours, $mins, $secs);
- }
- $conn = new mysqli('localhost', 'root', '', 'smelter');
- if ($conn->connect_error) {
- die('DB ERROR');
- }
- $ips = $_GET['ip'];
- $where = '';
- if ($ips != 'master') {
- foreach (explode(',', $ips) as $ip) {
- $where .= " or ip = '" . $ip . "'";
- }
- $where = ' where ' . trim($where, ' or');
- }
- $sql = 'SELECT * FROM reports ' . $where;
- $query = $conn->query($sql);
- if (($query) && ($query->num_rows > 0)) {
- $total_arr = array();
- $xp_arr = array();
- while($row = $query->fetch_assoc()) {
- $item = $row['ITEM_NAME'];
- $count = round($row['TOTAL_XP'] / $row['ITEM_XP']);
- $xp = $row['TOTAL_XP'];
- if ($item == 'CANNONBALL') {
- $count *= 4;
- }
- if (array_key_exists($item, $total_arr)) {
- $total_arr[$item] += $count;
- } else {
- $total_arr[$item] = $count;
- }
- if (array_key_exists($item, $xp_arr)) {
- $xp_arr[$item] += $xp;
- } else {
- $xp_arr[$item] = $xp;
- }
- }
- echo '<h1>Total</h1>';
- echo '<hr>';
- echo '<table>';
- echo '<style>';
- echo 'td {';
- echo ' padding: 8px;';
- echo ' text-align: left;';
- echo ' border-bottom: 1px solid #ddd;';
- echo '}';
- echo '</style>';
- echo '<tr>';
- echo ' <th>Item</th>';
- echo ' <th>Amount</th>';
- echo ' <th>XP</th>';
- echo '</tr>';
- while ($item= current($total_arr)) {
- echo '<tr>';
- echo '<td>' . key($total_arr) . '</td>';
- echo '<td>' . number_format(current($total_arr)) . ' </td>';
- echo '<td>' . number_format(current($xp_arr)) . ' </td>';
- echo '</tr>';
- next($total_arr);
- next($xp_arr);
- }
- echo '</table>';
- }
- $sql = 'SELECT * FROM sessions ' . $where;
- $query = $conn->query($sql);
- if (($query) && ($query->num_rows > 0)) {
- echo '<h1>Scripts Running</h1>';
- echo '<hr>';
- echo '<table>';
- echo '<style>';
- echo 'td {';
- echo ' padding: 8px;';
- echo ' text-align: left;';
- echo ' border-bottom: 1px solid #ddd;';
- echo '}';
- echo '</style>';
- echo '<tr>';
- echo ' <th>Tag</th>';
- echo ' <th>IP</th>';
- echo ' <th>Time</th>';
- echo ' <th>Item</th>';
- echo '</tr>';
- while($row = $query->fetch_assoc()) {
- $runtime = $row['PING'] - $row['START_TIME'];
- echo '<tr>';
- echo '<td>' . $row['TAG'] . '</td>';
- echo '<td>' . $row['IP'] . '</td>';
- echo '<td>' . seconds_to_string($runtime) . ' </td>';
- echo '<td>' . $row['ITEM_NAME'] . ' </td>';
- echo '</tr>';
- }
- echo '</table>';
- } else {
- echo '<h1>No Scripts Running</h1>';
- echo '<hr>';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement