Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <style>
- table, th, td {
- border: 1px solid black;
- }
- </style>
- <script
- src="https://code.jquery.com/jquery-3.2.1.min.js"
- integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
- crossorigin="anonymous"></script>
- <link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.15/css/jquery.dataTables.css">
- <script type="text/javascript" charset="utf8" src="//cdn.datatables.net/1.10.15/js/jquery.dataTables.js"></script>
- </head>
- <body>
- <?php
- $json = file_get_contents('https://armaremoteadmin.com/api/extern/v1/IServergroup/GetPlayerData.ashx?key=***&id=295&guid=76a8c7dccd9af8dc324fe4fd91aaac3b');
- $data = json_decode($json);
- echo 'Obecny serwer: ';
- if ($data->Response->IsCurrentlyPlaying == '-1') {
- echo 'Ten gracz jest offline';
- } else {
- echo $data->Response->IsCurrentlyPlaying;
- }
- echo '<br>';
- echo '<b>Nicki użyte w grze:</b>';
- foreach ($data->Response->Aliases as $aliases) {
- echo $aliases . ', ';
- }
- $totalminutes = 0;
- ?>
- <table id="myTable">
- <caption>Sesje na Serwerze</caption>
- <thead>
- <tr>
- <th>Od</th>
- <th>Do</th>
- <th>Trwała</th>
- </tr>
- </thead>
- <tbody>
- <?php
- foreach ($data->Response->PlaySessions as $datas) {
- $start = str_replace('T',' ',$datas->FromUTC);
- $end = str_replace('T',' ',$datas->ToUTC);
- echo '<tr><td>' . $start . '</td><td>';
- if(!(empty($end))){
- echo $end . '</td><td>';
- } else {
- echo 'N/A</td><td>';
- }
- if(!(empty($end))){
- $seconds = strtotime("$end") - strtotime("$start");
- $minutes = floor($seconds / 60);
- echo $minutes . ' min';
- $totalminutes = $totalminutes + $minutes;
- } else {
- echo 'N/A';
- }
- echo '</td></tr>';
- }
- ?>
- </tbody>
- </table>
- <?php
- /*foreach ($data->Response->PlaySessions as $time) {
- $start = str_replace('T',' ',$time->FromUTC);
- $end = str_replace('T',' ',$time->ToUTC);
- $time1 = strtotime("$start");
- $time2 = strtotime("$end");
- echo date("d-m-Y",$time1) . '<br>';
- }*/
- ?>
- <h3> Łącznie w ciągu miesiąca: <?=$totalminutes?> min</h3><br><br><br>
- <script>
- $(document).eady(function(){
- $('#myTable').DataTable();
- });
- </script>
- <?php
- echo "<pre>";
- print_r($data);
- echo "</pre>";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement