if (preg_match("/quickplay/", $value['label'])) { if (!isset($id)) { $id = $key; $methods[$id]['label'] = 'quickplay'; $methods[$id]['value'] = $value['value']; } else { $methods[$id]['label'] = 'quickplay'; $methods[$id]['value'] += $value['value']; } } else { $methods[$key]['label'] = $value['label']; $methods[$key]['value'] = $value['value']; } } foreach ($methods as $key => $value) { $methods[$key]['label'] = ConnMethod($value['label']); $methods[$key]['value'] = number_format($value['value'] / $m_total * 100, 2); } foreach ($premium as $key => $value) { if ($value['label'] == '1') { $value['label'] = 'Premium'; } else { $value['label'] = 'F2P'; } $premium[$key]['label'] = $value['label']; if (!$p_total == 0) { $premium[$key]['value'] = number_format($value['value'] / $p_total * 100, 2); } else { $premium[$key]['value'] = 0; } }
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ if (empty($_SERVER['HTTP_X_REQUESTED_WITH']) || !strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { header("Location: ../index.php?error=" . urlencode("Direct access not allowed.")); die; } include 'config.php'; $sql_details = array('user' => DB_USER, 'pass' => DB_PASS, 'db' => DB_NAME, 'host' => DB_HOST, 'port' => DB_PORT); if (isset($_GET['type']) && $_GET['type'] == 'getconnections') { $table = 'player_analytics'; $primaryKey = 'id'; $columns = array(array('db' => 'id', 'dt' => 'id'), array('db' => 'name', 'dt' => 'name', 'formatter' => function ($d, $row) { return htmlentities($d); }), array('db' => 'auth', 'dt' => 'auth'), array('db' => 'connect_time', 'dt' => 'connect_time', 'formatter' => function ($d, $row) { return date('h:i:s a m/d/Y', $d); }), array('db' => 'connect_method', 'dt' => 'connect_method', 'formatter' => function ($d, $row) { return ConnMethod($d); }), array('db' => 'duration', 'dt' => 'duration', 'formatter' => function ($d, $row) { return PlaytimeCon($d); }), array('db' => 'country', 'dt' => 'country'), array('db' => 'premium', 'dt' => 'premium'), array('db' => 'html_motd_disabled', 'dt' => 'html_motd_disabled'), array('db' => 'os', 'dt' => 'os')); $joinQuery = ''; require 'ssp.class.php'; echo json_encode(SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns, $joinQuery)); } if (isset($_GET['type']) && $_GET['type'] == 'getplayers') { $table = 'player_analytics'; $primaryKey = 'id'; $columns = array(array('db' => 'id', 'dt' => 'id'), array('db' => 'name', 'dt' => 'name', 'formatter' => function ($d, $row) { return htmlentities($d); }), array('db' => 'auth', 'dt' => 'auth'), array('db' => 'SUM(duration)', 'dt' => 'duration', 'formatter' => function ($d, $row) { return PlaytimeCon($d); }), array('db' => 'COUNT(auth)', 'dt' => 'total', 'as' => 'total', 'formatter' => function ($d, $row) {
?> </td> <td style="text-align:center;"><?php echo PlaytimeCon($info['duration']); ?> </td> <td style="text-align:center;"><?php echo $info['numplayers']; ?> </td> <td style="text-align:right;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"><?php echo $info['map']; ?> </td> <td style="text-align:right;"><?php echo ConnMethod($info['connect_method']); ?> </td> <td style="text-align:right;"><?php echo $info['ip']; ?> </td> </tr> <?php } ?> </tbody> </table> </div> </div><!-- /.panel-body --> </div><!-- /.panel -->