function serverStatus($dbh) { $q = $dbh->prepare("SELECT id,hostname,distro,uptime,seen,host_status FROM sysinfo"); $q->execute(); $sysStat = array(); while ($r = $q->fetch()) { $uptimeString = secondsToTime($r['uptime']); $lastSeen = timestring($r['seen']); $sysStat[$r['hostname']] = array('serverid' => $r['id'], 'os' => $r['distro'], 'uptime' => $uptimeString, 'lastSeen' => $lastSeen, 'status' => $r['host_status']); } return $sysStat; }
public function summary() { $from = $this->from; $to = $this->to; /* @var $collection Collection */ $collection = Collection::first(); $decks = Input::get('decks'); if ($decks) { $decks = explode(',', $decks); } else { $decks = $this->myDecks(); } $query = DB::table('revlog')->select(DB::raw('count() as cards'), DB::raw('sum(time)/1000 as the_time'), DB::raw('sum(case when ease = 1 then 1 else 0 end) as failed'), DB::raw('sum(case when type = 0 then 1 else 0 end) as learning'), DB::raw('sum(case when type = 1 then 1 else 0 end) as review'), DB::raw('sum(case when type = 2 then 1 else 0 end) as relearn'), DB::raw('sum(case when type = 3 then 1 else 0 end) as filter')); $this->whereFromTo($query, $from, $to); $result = $query->first(); $cards = $result->cards ?: 0; $the_time = $result->the_time ?: 0; $failed = $result->failed ?: 0; $learning = $result->learning ?: 0; $review = $result->review ?: 0; $relearn = $result->relearn ?: 0; $filter = $result->filter ?: 0; echo '<pre>'; var_dump($result); echo '</pre>'; echo '<br/>'; echo 'Studied ' . $cards . ' card(s) in ' . secondsToTime($the_time) . '<br/>'; echo 'Again count: ' . $failed; if ($cards) { echo ' (' . sprintf('%0.1f', (1 - $failed / $cards) * 100) . '% correct)'; } echo '<br/>'; echo 'Learn: ' . $learning . ', Review: ' . $review . ', Relearn: ' . $relearn . ', Filtered: ' . $filter . '<br/>'; $query = DB::table('revlog')->select(DB::raw('count() as mature_count'), DB::raw('sum(case when ease = 1 then 0 else 1 end) as mature_sum')); $this->whereFromTo($query, $from, $to); $this->whereDecks($query, $decks); $matureInterval = 21; $result = $query->where('lastIvl', '>=', $matureInterval)->first(); if ($result->mature_count) { echo 'Correct answers on mature cards ' . $result->mature_sum . '/' . $result->mature_count . ' (' . sprintf('%0.1f', $result->mature_sum / $result->mature_count * 100) . '%)'; } else { echo 'No mature cards were studied today.'; } }
$playerName = "System"; } if (isset($colors[$playerID])) { $playerColor = $colors[$playerID]; } else { $playerColor = ""; } $text = convEnt2($content['text']); $ply = "<span class='GameSystem'><i>(System)</i></span>"; if ($mode == 'All' || getTeam($playerColor) == 1) { $ply = "<a href='" . $website . "?u={$playerName}'><span class='{$playerColor}'>{$playerName}</span></a>"; } if ($mode == 'All' || getTeam($playerColor) == 2) { $ply = "<a href='" . $website . "?u={$playerName}'><span class='{$playerColor}'>{$playerName}</span></a>"; } $timeSec = secondsToTime($time / 1000); $drawTable = "replay_left"; include "" . OS_CURRENT_THEME_PATH . "/game_log.php"; if ($mode == 'All') { echo "<td class='all'>[All] {$text}</td>"; $str .= "<td class='all'>[All] {$text}</td>"; } else { if ($mode == 'System') { if ($content['type'] == 'Start') { $drawTable = "replay_text"; include "" . OS_CURRENT_THEME_PATH . "/game_log.php"; } else { if ($content['type'] == 'Hero') { $victim = trim($content['victim']); $killer = $content['killer']; if ($firstBlood) {
<h3 class="m0"><?php echo secondsToTime($rowts['total_support'], $tl['general']['g230']); ?> </h3> </div> <div class="col-xs-1 text-center"> <em class="fa fa-clock-o fa-2x"> </em> </div> </div> </div> <div class="panel-body"> <!-- Bar chart--> <div class="text-center"> <?php echo secondsToTime($rowts['total_support'], $tl['general']['g230']); ?> </div> </div> </div> </div> <div class="col-md-6"> <!-- START widget--> <div data-toggle="play-animation" data-play="fadeInDown" data-offset="0" data-delay="500" class="panel widget"> <div class="panel-body bg-warning"> <div class="row row-table row-flush"> <div class="col-xs-11"> <p class="mb0"><?php echo $tl["stat"]["s19"]; ?> </p>
} sleep(60); } } if ($_SERVER['argv'][1] == "-cHidden" || $_SERVER['argv'][1] == "-cRemote1") { echo "\n[-] Tracker mode (ON): Waiting the user to get online...\n"; $wa->SendPresenceSubscription($dst); $wa->pollMessage(); if ($presence == "available") { echo "- The user is now online\n\n"; } else { echo "- The user is offline\n\n"; } while (true) { $wa->pollMessage(); if ($lastpresence == "available" && $presence == "unavailable") { $timeOffline = date("Y-m-d H:i:s"); while ($presence == "unavailable") { $timeDiff = round(strtotime(date("Y-m-d H:i:s")) - strtotime($timeOffline)); echo secondsToTime($timeDiff) . "\n"; if ($_SERVER['argv'][1] == "-cRemote1") { $wa->sendMessage($dst, "(" . $_SERVER['argv'][3] . ") " . secondsToTime($timeDiff)); } $wa->pollMessage(); sleep(5); } } $lastpresence = $presence; sleep(5); } }
function Get_w3mmdplayers($gameid) { global $db; global $lang; $Data = array(); $ScourgeRow = 0; $SentinelRow = 0; $SetWinner = 0; $Data[0]["winner"] = 0; $c = 0; $sth = $db->prepare("SELECT g.creatorname, g.duration, g.datetime, g.gamename, g.stats, g.views, g.map\n FROM " . OSDB_GAMES . " AS g\n WHERE g.id='" . (int) $gameid . "'"); $result = $sth->execute(); $row = $sth->fetch(PDO::FETCH_ASSOC); $Data[$c]["creatorname"] = $row["creatorname"]; $Data[$c]["duration"] = secondsToTime($row["duration"]); $Data[$c]["datetime"] = date(OS_DATE_FORMAT, strtotime($row["datetime"])); $Data[$c]["gamename"] = $row["gamename"]; $Data[$c]["stats"] = $row["stats"]; $Data[$c]["views"] = $row["views"]; $Map = $row["map"]; $sth = $db->prepare("SELECT w.id, w.category, w.botid, w.gameid, w.pid, w.name, w.flag, w.leaver, w.practicing, gp.ip, gp.loadingtime, gp.left, gp.leftreason\n FROM " . OSDB_GP . " as gp\n LEFT JOIN " . OSDB_W3PL . " as w ON w.gameid = gp.gameid AND gp.name = w.name\n WHERE w.gameid ='" . (int) $gameid . "' \n ORDER BY w.pid ASC"); $result = $sth->execute(); if ($sth->rowCount() >= 1) { if (file_exists("inc/geoip/geoip.inc")) { include "inc/geoip/geoip.inc"; $GeoIPDatabase = geoip_open("inc/geoip/GeoIP.dat", GEOIP_STANDARD); $GeoIP = 1; } while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { $Data[$c]["botid"] = $row["botid"]; $Data[$c]["category"] = $row["category"]; $Data[$c]["id"] = $row["id"]; $Data[$c]["gameid"] = $row["gameid"]; $Data[$c]["pid"] = $row["pid"]; $Data[$c]["name"] = $row["name"]; $Data[$c]["full_name"] = $row["name"]; $Data[$c]["userid"] = $row["name"]; $Data[$c]["flag"] = $row["flag"]; $Data[$c]["leaver"] = $row["leaver"]; $Data[$c]["practicing"] = $row["practicing"]; $Data[$c]["leftreason"] = $row["leftreason"]; $Data[$c]["left"] = secondsToTime($row["left"]); $Data[$c]["loadingtime"] = $row["loadingtime"]; $Data[$c]["ip"] = $row["ip"]; $Data[$c]["hideElement"] = ' hideElement'; $Data[$c]["totalvotes"] = 0; $Data[$c]["totalrate"] = 0; $Data[$c]["player_rate"] = 0; $Data[$c]["voted"] = 1; $Data[$c]["counter"] = '' . ($row["pid"] + 1); if ($GeoIP == 1) { $Data[$c]["letter"] = geoip_country_code_by_addr($GeoIPDatabase, $row["ip"]); $Data[$c]["country"] = geoip_country_name_by_addr($GeoIPDatabase, $row["ip"]); } $Data[$c]["item1"] = ""; $Data[$c]["itemname1"] = ""; $Data[$c]["itemicon1"] = "empty.gif"; $Data[$c]["item2"] = ""; $Data[$c]["itemname2"] = ""; $Data[$c]["itemicon2"] = "empty.gif"; $Data[$c]["item3"] = ""; $Data[$c]["itemname3"] = ""; $Data[$c]["itemicon3"] = "empty.gif"; $Data[$c]["item4"] = ""; $Data[$c]["itemname4"] = ""; $Data[$c]["itemicon4"] = "empty.gif"; $Data[$c]["item5"] = ""; $Data[$c]["itemname5"] = ""; $Data[$c]["itemicon5"] = "empty.gif"; $Data[$c]["item6"] = ""; $Data[$c]["itemname6"] = ""; $Data[$c]["itemicon6"] = "empty.gif"; $Data[$c]["heroid"] = "blank"; $Data[$c]["hero"] = "blank"; $Data[$c]["description"] = ""; $vars = Get_w3mmdvarsString($gameid, $row["pid"], "race"); $Hero = Get_TDRace($vars); $Data[$c]["hero_link"] = 0; if (!empty($Hero) and file_exists("img/heroes/" . $Hero)) { $Data[$c]["heroid"] = $Hero; $Data[$c]["hero"] = $Hero; $Data[$c]["description"] = ""; } $Data[$c]["level"] = ""; $Data[$c]["class"] = ""; $Data[$c]["banned"] = ""; $Data[$c]["admin"] = ""; $Data[$c]["score_points"] = ""; $Data[$c]["kills"] = ""; $Data[$c]["deaths"] = ""; $Data[$c]["assists"] = ""; $Data[$c]["creepkills"] = ""; $Data[$c]["creepdenies"] = ""; $Data[$c]["towerkills"] = ""; $Data[$c]["raxkills"] = ""; $Data[$c]["courierkills"] = ""; $Data[$c]["neutralkills"] = ""; $Data[$c]["gold"] = ""; $Data[$c]["side"] = ""; $LimitTeam = W3mmdLimitTeams($Map); if ($row["pid"] <= $LimitTeam and $SentinelRow == 0) { $Data[$c]["side"] = "sentinel"; $SentinelRow = 1; } if ($row["pid"] > $LimitTeam and $ScourgeRow == 0) { $Data[$c]["side"] = "scourge"; $ScourgeRow = 1; } if ($row["pid"] <= $LimitTeam and $row["flag"] == "winner" and $SetWinner == 0) { $Data[0]["winner"] = '1'; $SetWinner = 1; } if ($row["pid"] > $LimitTeam and $row["flag"] == "winner" and $SetWinner == 0) { $Data[0]["winner"] = '2'; $SetWinner = 1; } if (!isset($winner)) { if ($row["pid"] <= $LimitTeam and $row["flag"] == "winner") { $winner = 1; } else { if ($row["pid"] <= $LimitTeam and $row["flag"] == "loser") { $winner = 2; } else { $winner = 0; } } } if ($winner == 1 and $row["pid"] <= $LimitTeam) { $Data[$c]["hideslot"] = "winner_background"; } else { $Data[$c]["hideslot"] = "loser_background"; } if ($Data[0]["winner"] == '2' and $row["pid"] > $LimitTeam) { $Data[$c]["hideslot"] = "winner_background"; } //Get custom game "template" // hard-coded stuff here //LEGION TD if (strstr($Map, "Legion TD")) { $lang["sent_winner"] = "West Legion <b>Winner</b>"; $lang["scou_winner"] = "East Legion <b>Winner</b>"; $lang["sent_loser"] = "West Legion <b>Loser</b>"; $lang["scou_loser"] = "East Legion <b>Loser</b>"; } //WARLOCK if (substr($Map, 0, 7) == "Warlock") { $SentinelRow = 0; $ScourgeRow = 0; $lang["sent_winner"] = "Warlock winner"; $lang["scou_winner"] = "Warlock winner"; $lang["sent_loser"] = "Warlock loser"; $lang["scou_loser"] = "Warlock loser"; } //HEROLINE if (strstr($Map, "HeroLineWars")) { $lang["sent_winner"] = "Hero's Line 1 <b>Winner</b>"; $lang["scou_winner"] = "Hero's Line 2 <b>Winner</b>"; $lang["sent_loser"] = "Hero's Line 1 <b>Loser</b>"; $lang["scou_loser"] = "Hero's Line 2 <b>Loser</b>"; } //TREE TAG if (strstr($Map, "TreeTag")) { $lang["sent_winner"] = "Ents <b>Winner</b>"; $lang["scou_winner"] = "Infernal <b>Winner</b>"; $lang["sent_loser"] = "Ents <b>Loser</b>"; $lang["scou_loser"] = "Infernal <b>Loser</b>"; if ($row["pid"] <= $LimitTeam) { $Data[$c]["heroid"] = "custom/ent.png"; $Data[$c]["hero"] = "custom/ent.png"; $Data[$c]["description"] = ""; } if ($row["pid"] > $LimitTeam) { $Data[$c]["heroid"] = "custom/infernal.png"; $Data[$c]["hero"] = "custom/infernal.png"; $Data[$c]["description"] = ""; } } //Battleships Battleships if (strstr($Map, "Battleships Cross")) { $Data[$c]["heroid"] = "custom/ship.gif"; $Data[$c]["hero"] = "custom/ship.gif"; $Data[$c]["description"] = ""; if ($row["pid"] >= 10 and $ScourgeRow == 1) { $Data[$c]["side"] = "sentinel"; $ScourgeRow = 2; } if ($row["flag"] != "winner" and $row["flag"] != "loser") { $winner = 0; $Data[0]["winner"] = 0; $Data[$c]["hideslot"] = "loser_background"; } $lang["sent_winner"] = "South Aliance <b>Winner</b>"; $lang["scou_winner"] = "North Aliance <b>Winner</b>"; $lang["draw_game"] = "South Aliance <b>Draw</b>"; if ($row["pid"] > $LimitTeam) { $lang["draw_game"] = "North Aliance <b>Draw</b>"; } $lang["sent_loser"] = "South Aliance <b>Loser</b>"; $lang["scou_loser"] = "North Aliance <b>Loser</b>"; if ($row["pid"] >= 9) { $lang["sent_winner"] = "Goblin/Greenpeace <b>Winner</b>"; $lang["scou_winner"] = "Goblin/Greenpeace <b>Winner</b>"; $lang["draw_game"] = "Goblin/Greenpeace <b>Draw</b>"; $lang["sent_loser"] = "Goblin/Greenpeace <b>Loser</b>"; $lang["scou_loser"] = "Goblin/Greenpeace <b>Loser</b>"; } } if ($winner == 1) { $Data[$c]["display_winner"] = '<span class="winner2">' . $lang["sent_winner"] . "</span>"; $Data[$c]["display_loser"] = '<span class="winner1">' . $lang["scou_loser"] . "</span>"; } else { if ($winner == 2) { $Data[$c]["display_winner"] = '<span class="winner1">' . $lang["sent_loser"] . "</span>"; $Data[$c]["display_loser"] = '<span class="winner2">' . $lang["scou_winner"] . "</span>"; } else { if ($winner == 0) { $Data[$c]["display_winner"] = $lang["draw_game"]; $Data[$c]["display_loser"] = $lang["draw_game"]; } } } $c++; } if (isset($GeoIP) and $GeoIP == 1) { geoip_close($GeoIPDatabase); } return $Data; } }
$allHostStatus = serverStatus($dbh); $spine->assign('allHostStatus', $allHostStatus); // tworzymy jsona z opcjami konfiguracyjnymi apacza vhostOptionFile($dbh); if (isset($_GET['serverid'])) { // komplet informacji na temat systemu i zuzycia zasobow $q = $dbh->prepare("SELECT ip, ext_ip, hostname, distro, uptime, hdd_total, hdd_free, ram_total, ram_free, host_status, cpu_usage FROM sysinfo WHERE id = " . $_GET['serverid']); $q->execute(); $r = $q->fetch(); $hdd_used = $r['hdd_total'] - $r['hdd_free']; $hdd_percentage_used = $hdd_used / $r['hdd_total'] * 100; $hdd_percentage_free = $r['hdd_free'] / $r['hdd_total'] * 100; $ram_used = $r['ram_total'] - $r['ram_free']; $ram_percentage_used = $ram_used / $r['ram_total'] * 100; $ram_percentage_free = $r['ram_free'] / $r['ram_total'] * 100; $uptime = secondsToTime($r['uptime']); $basicInfo = array('os' => $r['distro'], 'hostname' => $r['hostname'], 'status' => $r['host_status']); $spine->assign('basicInfo', $basicInfo); $sysinfo = array('ip' => $r['ip'], 'ext_ip' => $r['ext_ip'], 'hostname' => $r['hostname'], 'system' => $r['distro'], 'uptime' => $uptime, 'hdd_percentage_used' => round($hdd_percentage_used, 0), 'hdd_percentage_free' => round($hdd_percentage_free, 0), 'ram_percentage_free' => round($ram_percentage_free, 0), 'hdd_free' => round($r['hdd_free'] / 1073741824, 2), 'hdd_used' => round($hdd_used / 1073741824, 2), 'ram_free' => round($r['ram_free'] / 1073741824, 2), 'ram_total' => round($r['ram_total'] / 1073741824, 2), 'cpu_usage' => $r['cpu_usage'], 'status' => $r['host_status']); $spine->assign('sysinfo', $sysinfo); // lista uslug i ich status na serwerze $q = $dbh->prepare("SELECT service,status FROM service_checks WHERE host_id = " . $_GET['serverid']); $q->execute(); while ($r = $q->fetch()) { $services[$r['service']] = $r['status']; } $spine->assign('hostsrv', $services); // Lista kont uzytkownikow w systemie $q = $dbh->prepare("SELECT id, login, fullname, email FROM sysusers WHERE system_id = " . $_GET['serverid']); $q->execute(); while ($r = $q->fetch()) {
} $running = false; $memory = 0; $memoryu = 0; $instances = 0; foreach ($app['branches'][$_SESSION['DATA'][$app['id']]['branch']]['instances'] as $i) { if ($i['status'] == 'run') { $running = true; } $memory = $memory + $i['memory']['quota']; $memoryu = $memoryu + $i['memory']['usage']; $instances++; } $expl = explode('-', $app['name']); $language = $expl[0]; $content = "\n\t\t\t<table>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>{$lang['id']}</th>\n\t\t\t\t\t<th>{$lang['host']}</th>\n\t\t\t\t\t<th>{$lang['port']}</th>\n\t\t\t\t\t<th>{$lang['cpu']}</th>\n\t\t\t\t\t<th>{$lang['memory']}</th>\n\t\t\t\t\t<th>{$lang['uptime']}</th>\n\t\t\t\t\t<th>{$lang['status']}</th>\n\t\t\t\t\t<th style=\"width: 30px; text-align: center;\">{$lang['logs']}</th>\n\t\t\t\t</tr>\n\t"; $j = 0; foreach ($app['branches'][$_SESSION['DATA'][$app['id']]['branch']]['instances'] as $i) { if ($i['status'] == 'run') { $running = true; } else { $running = false; } $info = secondsToTime($i['uptime']); $content .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><span class=\"large\">{$app['name']}-" . security::encode($_SESSION['DATA'][$app['id']]['branch']) . "-{$j}</span></td>\n\t\t\t\t\t\t<td>{$i['host']}</td>\n\t\t\t\t\t\t<td>{$i['port']}</td>\n\t\t\t\t\t\t<td>" . round($i['cpu']['usage'] / 10, 1) . "% / {$i['cpu']['quota']} core</td>\n\t\t\t\t\t\t<td>{$i['memory']['usage']}Mo / {$i['memory']['quota']}Mo</td>\n\t\t\t\t\t\t<td>{$info['d']} {$lang['days']} {$info['h']} {$lang['hours']} {$info['m']} {$lang['minutes']} {$info['s']} {$lang['seconds']}</td>\n\t\t\t\t\t\t<td>" . ($running ? "<div class=\"state running\"><div class=\"state-content\">{$lang['running']}</div></div>" : "<div class=\"state stopped\"><div class=\"state-content\">{$lang['stopped']}") . "</div></div></td>\n\t\t\t\t\t\t<td style=\"width: 30px; text-align: center;\"><a href=\"/panel/apps/log?id={$app['id']}&instance={$i['id']}\" title=\"\"><img class=\"link\" src=\"/{$GLOBALS['CONFIG']['SITE']}/images/icons/small/notebook.png\" alt=\"\" /></a></td>\n\t\t\t\t\t</tr>\n\t\t"; $j++; } $content .= "\n\t\t\t\t</table>\n\t"; } catch (Exception $e) { } echo $content;
$data['hosts'][$host->hostid] = ['id' => $host->hostid, 'name' => $host->host]; $data['totals']['hosts']++; } foreach ($data['hosts'] as $host) { // OPERATING SYSTEM $osystem = $api->itemGet(array("output" => "extend", "hostids" => $host['id'], "search" => array("key_" => "system.uname"))); $osystem = explode(" ", $osystem[0]->lastvalue); $data['hosts'][$host['id']]['os'] = $osystem[0]; // IP ADDRESS $hostIPs = $api->hostGet(array("output" => "extend", "hostids" => $host['id'], "selectInterfaces" => ["ip"])); foreach ($hostIPs as $hostIP) { $data['hosts'][$host['id']]['address'] = $hostIP->interfaces[0]->ip; } // UPTIME $uptime = $api->itemGet(array("output" => "extend", "hostids" => $host['id'], "search" => array("key_" => "system.uptime"))); $data['hosts'][$host['id']]['uptime'] = secondsToTime($uptime[0]->lastvalue); // ONLINE STATUS $status = $api->itemGet(array("output" => "extend", "hostids" => $host['id'], "search" => array("key_" => "agent.ping"))); if ($status[0]->lastvalue == 1) { $data['hosts'][$host['id']]['status'] = true; $data['totals']['online']++; } else { $data['hosts'][$host['id']]['status'] = false; } // CPU LOAD $cpuLoad = $api->itemGet(array("output" => "extend", "hostids" => $host['id'], "search" => array("key_" => "system.cpu.load[percpu,avg1]"))); $data['hosts'][$host['id']]['cpuLoad'] = $cpuLoad[0]->lastvalue * 100; // DISK USED $data['hosts'][$host['id']]['diskUsage'] = 0; $disks = $api->itemGet(array("output" => "extend", "hostids" => $host['id'], "searchWildcardsEnabled" => true, "search" => array("key_" => "vfs.fs.size[*,used]"))); foreach ($disks as $disk) {
if (strtotime($val['od']) <= $ted && strtotime($val['do']) >= $ted) { $otevreno = true; } } $otevrenoKdy = ""; $json['otevreno'] = $otevreno; /** * Kdy bude zase otevřeno? */ if (!$otevreno) { foreach ($otevrenoDalsi as $key => $val) { if (strtotime($val['od']) > $ted && $otevrenoKdy == "") { $otevrenoKdy = $val['od']; } } $otevrenoTime = secondsToTime(strtotime($otevrenoKdy) - $ted); $json['otevreno_kdy'] = $otevrenoTime; } // } // $json['otevreno_dalsi'] = $otevrenoDalsi; // $json['ted'] = $tedStr; // $json['kontrola'] = strtotime($val['od'])." - ".$ted; $status_text = ""; $status["otevreno"] = isset($_POST['otevreno']) ? $_POST['otevreno'] : "Právě máme otevřeno"; $status["zitra"] = isset($_POST['otevreno']) ? $_POST['otevreno'] : "Stavte se zítra"; $status["cas"] = isset($_POST['otevreno']) ? $_POST['otevreno'] : "Již za %%CAS%% otevíráme"; if ($otevreno) { $status_text = $status['otevreno']; } else { if ($otevrenoTime['d'] == 1) { $status_text = $status['zitra'];
function secondsToTime($seconds) { $dtF = new DateTime("@0"); $dtT = new DateTime("@{$seconds}"); return $dtF->diff($dtT)->format('%a days, %h hours, %i minutes and %s seconds'); } if ($_SESSION['status'] == 0) { $date = new DateTime(); $initial = $date->getTimestamp(); $final = $_SESSION['startTime']; $secsLeft = $final - $initial; if ($secsLeft <= 0) { echo "-1"; die; } echo secondsToTime($secsLeft) . " to quiz"; } else { if ($_SESSION['status'] == 1) { $date = new DateTime(); $initial = $date->getTimestamp(); $final = $_SESSION['finalTime']; $secsLeftSave = $final - $initial; $secsLeft = $secsLeftSave; $seconds = $secsLeft % 60; $secsLeft = floor($secsLeft / 60); $mins = $secsLeft % 60; $secsLeft = floor($secsLeft / 60); $hours = $secsLeft; if (floor($seconds / 10) == 0) { $seconds = '0' . $seconds; }
<?php // page version: 1.1 require "../../../inc/general_conf.inc.php"; if (empty($_SESSION['user'])) { header("Location: " . $DOCUMENT_ROOT . "/index.php"); die("Redirecting to " . $DOCUMENT_ROOT . "/index.php"); } // Create connection $connect = mysqli_connect($dbHost, $dbUserName, $dbUserPasswd, $dbName); // Check connection if (!$connect) { die("Connection failed: " . mysqli_connect_error()); } $output = mysqli_query($connect, "SELECT vhost_timerunning FROM wow_vhost_status"); while ($row = mysqli_fetch_array($output)) { $VhostTime = $row['vhost_timerunning']; } //convert string to number (get part of the string befor the dot) $str = $VhostTime; $Seconds = substr($str, 0, strrpos($str, '.')); //convert number to days, hours, minutes function secondsToTime($seconds) { $dtF = new DateTime("@0"); $dtT = new DateTime("@{$seconds}"); return $dtF->diff($dtT)->format('%a days, %hh %imin'); } echo secondsToTime($Seconds);
<h1>Your Stats!</h1> <br /> <p>In game name: <?php echo $row['name']; ?> </p> <p>Cash: $<?php echo number_format($row['cash']); ?> </p> <p>Bank: $<?php echo number_format($row['bankacc']); ?> </p> <p>Player time: <?php echo secondsToTime($row['playtime']); ?> </p> <p>Bounty: $<?php echo number_format(max(0, $row3['wantedBounty'])); ?> <p> <p>Rebel: <?php if (strpos($row['civ_licenses'], 'license_civ_rebel') !== false) { echo "You dirty rebel!"; } else { echo "Good boy, not a rebel!"; } ?> </p>
require_once 'header.php'; $getmapdetails = query("SELECT SUM(played) as played,SUM(tags) as k, SUM(hold) as a, SUM(prevent) as d, SUM(roam) as r, SUM(powerups) as pup, COUNT(*) as c FROM games WHERE map='" . mysql_real_escape_string($_GET['map']) . "'"); $m = mysql_fetch_assoc($getmapdetails); $getgames = query("SELECT COUNT(DISTINCT gameno) FROM games WHERE map='" . mysql_real_escape_string($_GET['map']) . "'"); $g = mysql_result($getgames, 0); function secondsToTime($seconds) { $dtF = new DateTime("@0"); $dtT = new DateTime("@{$seconds}"); return $dtF->diff($dtT)->format('%a days, %h hours, %i minutes and %s seconds'); } ?> <div style="width:100%; margin:0 auto; padding-top:10px" align="center"> <?php echo "<span style='font-size: larger'>" . mysql_real_escape_string($_GET['map']); echo "</span><br />"; echo secondsToTime($m['played']) . " logged total over " . $g . " games."; echo "<br />"; echo "Of that time, "; $a = round($m['a'] / $m['played'], 2) * 100; echo $a . "% was spent carrying the flag and "; $d = round($m['d'] / $m['played'], 2) * 100; echo $d . "% was spent in prevent.<br />"; echo "Current death toll: " . $m['k'] . "<br />"; echo "Average kills per game: "; echo round($m['k'] / $g, 2) . "<br />"; echo $m['pup'] . " powerups grabbed.<br />"; ?> </div> <?php require_once 'footer.php';
<th>Project</th> <th>Recorded Time</th> </tr> <?php function secondsToTime($seconds) { $dtF = new DateTime("@0"); $dtT = new DateTime("@{$seconds}"); return $dtF->diff($dtT)->format('%h:%i:%s'); } $apikey = "a5e2dca9-b9b7-41b5-80b4-32774b2ca724"; $contents = file_get_contents('https://wakatime.com/api/v1/users/current/stats/last_7_days?api_key=' . $apikey); $wakatime_api = json_decode($contents); $projects = $wakatime_api->data->projects; if (count($projects)) { // Cycle through the array foreach ($projects as $idx => $project) { $time = secondsToTime($project->total_seconds); // Output a row echo "<tr>"; echo "<td>{$project->name}</td>"; echo "<td>{$time}</td>"; echo "</tr>"; } } ?> </table> </body> </html>
<div style="padding:0px 4px 0px 17px; "height="20px"> <h2>Welcome to the Prophecy Gaming overview!</h2> </div> <div style="padding:0px 4px 0px 17px; "height="20px"> <h1>Top ten players!</h1> <h3>Time!</h3> <ol> <?php foreach ($row1 as $ccar) { echo "<li>" . $ccar['name'] . "<br><ul><li>" . secondsToTime($ccar['playtime']) . "</li></ul></li><br>"; } ?> </ol> </div> <img src="images/top_22.png" alt="" height="16" width="671"> <div style="padding:0px 4px 0px 17px; "height="20px"> <h3>The top wanted criminals!</h3> <table border="1" style="border-color: #0D0D0D;border-collapse: collapse;"> <tr><th> </th><th>Name</th><th>Charges</th><th>Bounty</th></tr> <tbody> <?php foreach ($row2 as $i => $ccar) { ?> <tr><td> <?php
$time = $time[1] + $time[0]; $start = $time; require_once '../class/diablo3.api.class.php'; require_once '../config/settings.php'; require_once '../include/functions.php'; set_time_limit(0); ini_set('memory_limit', '256M'); $Diablo3 = new Diablo3(BATTLENET_ACCOUNT, DEFAULT_SERVER, DEFAULT_LOCALE); $connection = new Mongo(); $db = $connection->selectDB(PROD_DB); $all_items = $db->command(array("distinct" => ITEM_COLLECTION, "key" => "icon")); $count = 0; // Download Small Images // foreach ($all_items['values'] as $item) { $count++; $Diablo3->getItemImage($item, 'small'); } // Download Large Images // foreach ($all_items['values'] as $item) { $count++; $Diablo3->getItemImage($item, 'large'); } $time = microtime(); $time = explode(' ', $time); $time = $time[1] + $time[0]; $finish = $time; $total_time = round($finish - $start, 4); $total_time = secondsToTime($total_time); echo '<br>Proccess finished in ' . $total_time . ' seconds. ' . $count . " Images Saved<br>";
echo '<td style="' . $style . '">' . secondsToTime($server['Uptime']) . '</td>'; echo '</tr>'; $total['connected'] += $server['Threads_connected']; $total['select'] += $server['Com_select'] / $server['Uptime']; $total['insert'] += $server['Com_insert'] / $server['Uptime']; $total['update'] += $server['Com_update'] / $server['Uptime']; $total['delete'] += $server['Com_delete'] / $server['Uptime']; $total['replace'] += $server['Com_replace'] / $server['Uptime']; $total['begin'] += $server['Com_begin'] / $server['Uptime']; $total['commit'] += $server['Com_commit'] / $server['Uptime']; $total['rollback'] += $server['Com_rollback'] / $server['Uptime']; $total['uptime'] += $server['Uptime']; } if ($i > 0) { echo '<tr>'; echo '<td style="' . $style . '" colspan="5">' . __('Total') . '</td>'; echo '<td style="' . $style . '">' . round($total['connected'], 2) . '</td>'; echo '<td style="' . $style . '">' . round($total['select'], 2) . '</td>'; echo '<td style="' . $style . '">' . round($total['insert'], 2) . '</td>'; echo '<td style="' . $style . '">' . round($total['update'], 2) . '</td>'; echo '<td style="' . $style . '">' . round($total['replace'], 2) . '</td>'; echo '<td style="' . $style . '">' . round($total['delete'], 2) . '</td>'; echo '<td style="' . $style . '">' . round($total['begin'], 2) . '</td>'; echo '<td style="' . $style . '">' . round($total['commit'], 2) . '</td>'; echo '<td style="' . $style . '">' . round($total['rollback'], 2) . '</td>'; echo '<td style="' . $style . '"></td>'; echo '<td style="' . $style . '">' . round($total['select'] / ($total['delete'] + $total['select'] + $total['insert'] + $total['update']) * 100, 2) . ' %</td>'; echo '<td style="' . $style . '">' . secondsToTime($total['uptime']) . '</td>'; echo '</tr>'; } echo '</table>';
?> </td> <td><?php echo $dados->CodTomada; ?> </td> <td><?php echo $dados->CodEquip . " - " . $dados->desc; ?> </td> <td><?php echo $dados->eficaz; ?> </td> <td><?php list($days, $hours, $minutes, $seconds) = secondsToTime($dados->TempoUso); echo "{$days}d {$hours}h {$minutes}m {$seconds}s"; ?> </td> <td><?php echo date('d/m/Y H:m:s', strtotime($dados->dataAtual)); ?> </td> <td><input type="checkbox" name="comp" class="<?php echo $dados->CodEquip; ?> " id="<?php echo $dados->codCaptura; ?> " /></td> </tr>
echo "Bad authentication: Bad password or blocked account"; } $events = new MyEvents($wa); $wa->eventManager()->bind("onPresenceAvailable", "onPresenceAvailable"); $wa->eventManager()->bind("onPresenceUnavailable", "onPresenceUnavailable"); echo "\n[-] Tracker mode (ON): Waiting the user to get online...\n"; $wa->SendPresenceSubscription($target); $wa->pollMessage(); if ($presence == "available") { echo "- The user is now online\n\n"; } else { echo "- The user is offline\n\n"; } $lastpresence = ""; while (true) { $wa->pollMessage(); if ($lastpresence == "available" && $presence == "unavailable") { $timeOffline = date("Y-m-d H:i:s"); while ($presence == "unavailable") { $timeDiff = round(strtotime(date("Y-m-d H:i:s")) - strtotime($timeOffline)); echo secondsToTime($timeDiff) . "\n"; if ($notify != "") { $wa->sendMessage($notify, "({$target}) " . secondsToTime($timeDiff)); } $wa->pollMessage(); sleep($time); } } $lastpresence = $presence; sleep($time); }
function get_Uptime() { #------------------------------alive------------------------------------------- $execStr = "(</proc/uptime awk '{print \$1}')"; exec($execStr, $secs); $intsecs = explode(".", $secs[0]); if ($debug) { header('Debug-value1: ' . $execStr); } #------------------------------loadAverage------------------------------------- $execStr = "uptime"; exec($execStr, $system); // get the uptime stats if ($debug) { header('Debug-value2: ' . $execStr); } # no hours example: #" 18:14:43 up 2 days, 24 min, load average: 0.17, 0.18, 0.18" #" 22:31:20 up 2 days, 4:41, load average: 0.12, 0.17, 0.14" $string = $system[0]; // this might not be necessary $uptime = explode(" up ", $string); // break up the stats into an array $uptimeDetails = explode("load average: ", $uptime[1]); // grab the days from the array $uptimeDetails[0] = trim($uptimeDetails[0]); $uptimeDetails[0] = trim($uptimeDetails[0], ","); $loadAverage = explode(",", $uptimeDetails[1]); #------------------------------ date time ------------------------------------- $execStr = 'date +"%Y-%m-%d %H:%M:%S"'; exec($execStr, $devicetime); if ($debug) { header('Debug-value3: ' . $execStr); } $arr = array('alive' => array('secAlive' => $intsecs[0], 'aliveFor' => secondsToTime($intsecs[0]), 'uptime' => $uptimeDetails[0]), 'loadAverage' => array('min1' => trim($loadAverage[0]), 'min5' => trim($loadAverage[1]), 'min15' => trim($loadAverage[2]), 'Description' => '0 is idle, 1 is fully utilized, 1.05 means 5% of processes waited for their turn.'), 'deviceTime' => array('dateTime' => trim($devicetime[0]))); return json_encode($arr); }
$totalalldistance += $totaldistance; $tbl_km["conso"] = $tbl_km["consotheorique"] * (int) $tbl_km["km"] / 100; $totalallconso += $tbl_km["conso"]; $tbl_km["vitesse"] = vitessekmh($vitessemaxvehicule); $tbl_km["mintime"] = $trajet[0]["debut"]; //print $trajet[0]["debut"]; $tbl_km["maxtime"] = $trajet[count($trajet) - 1]["fin"]; $tbl_km["amplitude"] = dateDifference($tbl_km["mintime"], $tbl_km["maxtime"], '%d Jours %h H %i Min'); /* print strtotime($tbl_km["maxtime"])."<br>"; print strtotime($tbl_km["mintime"])."<br>"; */ $tbl_km["maxtime"] = $tbl_km["maxtime"] == "" ? $tbl_km["mintime"] : $tbl_km["maxtime"]; $totalallarret += strtotime($tbl_km["maxtime"]) - strtotime($tbl_km["mintime"]) - $totalconduite * 60; //print $totalarret."<br>"; $tbl_km["arret"] = secondsToTime(strtotime($tbl_km["maxtime"]) - strtotime($tbl_km["mintime"]) - $totalconduite * 60); $totalallconduite += $totalconduite * 60; //$totalarret+=(strtotime($tbl_km["maxtime"])-($totalconduite*60))-strtotime($tbl_km["mintime"]); //print (strtotime($tbl_km["maxtime"])-($totalconduite*60))-strtotime($tbl_km["mintime"])."<br>"; //$tbl_km["arret"]=dateDifference($tbl_km["mintime"] , date("Y-m-j h:i:s",strtotime($tbl_km["maxtime"])-$totalconduite*60) , '%d Jours %h H %i Min' ); //$totalkm+=($tbl["kminit"]+$totaldistance+$tbl["correctifkm"]); /* $tbl["datediff"]=dateDifference($tbl["mintime"] , $tbl["maxtime"] , '%y Année %m Mois %d Jours %h H %i Min' ); $totalkm+=($tbl["kminit"]+$tbl["km"]+$tbl["correctifkm"]); $totaldistance+=($tbl["km"]); $totalconso+=$tbl["consotheorique"]*((int)$tbl["km"])/100; $tbl["conso"]=$tbl["consotheorique"]*((int)$tbl["km"])/100; $tbl["theorique"]=$tbl["kminit"]+$tbl["km"]+$tbl["correctifkm"]; */ $tbl_list_vehicule[] = $tbl_km;
<?php } ?> <?php if (isset($Games["replay"]) and !empty($Games["replay"])) { ?> <img class="float_right padRight" src="<?php echo OS_HOME; ?> img/replay.gif" alt="replay" width="16" height="16" /> <?php } ?> </td> <td style="width: 80px"><?php echo secondsToTime($Games["duration"]); ?> </td> <td style="width: 50px"><?php echo $Games["type"]; ?> </td> <td style="width: 140px"><?php echo date($DateFormat, strtotime($Games["datetime"])); ?> </td> <td style="width: 160px"><?php echo $Games["map"]; ?> </td> <td style="width: 160px"><?php
foreach($mn_arr as $key => $value){ //echo $key." => ".strtotime($key)." => ".round($value[0]/$value[1])."<br/>"; $mn_count = "$mn_count [".strtotime($key)."000, ".round($value[0]/$value[1])."],"; echo "$key => ".strtotime($key)." => $value[0] / $value[1] => ".round($value[0]/$value[1])." <br/>"; */ } //echo $mn_count; $query = $db->prepare("SELECT * FROM `node`"); $query->execute(); while($row=$query->fetch()){ $table = $table."<tr><td><a href='http://{$row['ip']}:7903' target='_blank'>{$row['ip']}:7903</a></td><td><img src=\"https://dash.org.ru/img/16/".mb_strtolower(geoip_country_code_by_name($row['ip'])).".png\"> {$row['country']}</td><td>{$row['users']}</td><td>".ghash($row['hash'])."</td><td>{$row['fee']}</td><td>".secondsToTime($row['uptime'])."</td></tr>"; } //$query = $db->prepare("SELECT avg(hash), avg(ghash), time FROM `global` group by day(from_unixtime(`time`)) order by `time` asc"); // order by `time` asc $query = $db->prepare("select avg(hash), avg(ghash), date(from_unixtime(`time`)) as dateNum from `global` group by dateNum"); $query->execute(); while($row=$query->fetch()){ //$hash_rate = "$hash_rate [{$row['time']}000, {$row['avg(hash)']}],"; $hash_rate = "$hash_rate [".strtotime($row['dateNum'])."000, {$row['avg(hash)']}],"; //if($row['time'] < 1430193602) continue; if($row['avg(ghash)'] != 0){ //$ghash_rate = "$ghash_rate [{$row['time']}000, {$row['avg(ghash)']}],"; if (strtotime($row['dateNum']) < 1429909201) continue; $ghash_rate = "$ghash_rate [".strtotime($row['dateNum'])."000, {$row['avg(ghash)']}],"; } }
$result = $sth->execute(); $CommonGames = array(); $c = 0; while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { $CommonGames[$c]["gamename"] = $row["gamename"]; $CommonGames[$c]["id"] = $row["id"]; $CommonGames[$c]["map"] = $row["map"]; $CommonGames[$c]["datetime"] = $row["datetime"]; $CommonGames[$c]["duration"] = $row["duration"]; $CommonGames[$c]["gamestate"] = $row["gamestate"]; $CommonGames[$c]["player1"] = $User1; $CommonGames[$c]["player2"] = $User2; $CommonGames[$c]["type"] = OS_GetGameState($row["gamestate"], $lang["gamestate_pub"], $lang["gamestate_priv"]); $CommonGames[$c]["winner"] = $row["winner"]; //REPLAY $duration = secondsToTime($row["duration"]); $replayDate = strtotime($row["datetime"]); //3*3600 = +3 HOURS, +0 minutes. $replayDate = date("Y-m-d H:i", $replayDate); $gametimenew = substr(str_ireplace(":", "-", date("Y-m-d H:i", strtotime($replayDate))), 0, 16); $gid = (int) $row["id"]; $gamename = $CommonGames[$c]["gamename"]; include 'inc/get_replay.php'; if (file_exists($replayloc)) { $CommonGames[$c]["replay"] = $replayloc; } else { $CommonGames[$c]["replay"] = ""; } //END REPLAY $c++; }
<?php require './functions.php'; //Obtain seconds $farol = lerSegundos($arquivo, 2); if ($farol == 0) { $segFaltantes = lerSegundos($arquivo, 1); $segundos = time() + $segFaltantes; } else { if ($farol == 1) { $segundos = lerSegundos($arquivo); } } escreveHeader("continue"); $timeWatch = secondsToTime($segundos); ?> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Battlehack Time Counter - Stopwatch</title> <script> </script> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="bhtimecounter.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="spacer"></div> <div id="container"> <div id="stopwatch">
<tbody> <?php foreach ($info as $found) { ?> <tr> <td style="padding-right:7px;"><?php echo $found['name']; ?> </td> <td style="padding-right:7px;">$<?php echo number_format($found['bankacc']); ?> </td> <td style="padding-right:7px;"><?php echo secondsToTime($found['playtime']); ?> </td> <td style="padding-right:7px;"><a href="editplayer.php?id=<?php echo $found['playerid']; ?> ">Edit player</a> </td> </tr> <?php } ?> <?php } } ?>
echo $_POST["date_jour"]; ?> "> </p> </div> <div class="content_filt_submit"> <input class="submit_butt" type="submit" value="Valider"> </div> </form> <span class="info_rapportkm"> <p>Conduite : <span> <?php echo secondsToTime($totalallconduite); ?> </span></p> <p>Arrêt : <span> <?php echo secondsToTime($totalallarret); ?> </span></p> <!-- <p>Attente : <span> 00 </span> min </p> --> <p>Distance : <span> <?php echo $totalalldistance; ?> </span>Km</p> <a href="javascript:window.print()"><img src="<?php echo __racineweb__; ?> /tpl/img/imprimer_ico.png"></a> <?php echo showexport("flotte03", array("Nom", "Activité", "Conduite", "Arrêt", "Distance", "Vit.max.", "Conso."), array("nomvehicule", "amplitude", "datediff", "arret", "km", "vitesse", "conso")); ?> </span>
echo TXT_AVG_INITIAL_RESPONSE_TIME; ?> </td> <td> <?php $responseTimeQry = "SELECT TCK.`dPostDate` , REP.dDate, TCK.`nTicketId` , REP.nStaffId, TIMEDIFF( REP.dDate, TCK.`dPostDate` ) response_time\r\n FROM `sptbl_tickets` TCK, (\r\n SELECT *\r\n FROM sptbl_replies REP \r\n WHERE REP.dDate >= '{$var_msdate}' AND REP.dDate <= '{$var_medate}' AND REP.nStaffId ='" . $userRes['nStaffId'] . "'\r\n ORDER BY nTicketId, `dDate`\r\n ) REP\r\n WHERE TCK.`nTicketId` = REP.`nTicketId`\r\n GROUP BY REP.`nTicketId` "; $responseTime = mysql_query($responseTimeQry); $responseTimeVal = 0; $responseTimeCount = 0; if ($responseTime) { while ($responseTimeRes = mysql_fetch_array($responseTime)) { $time = explode(':', $responseTimeRes['response_time']); $responseTimeVal = $time[0] * 3600 + $time[1] * 60 + $time[2]; $responseTimeCount++; } $time_taken = secondsToTime($responseTimeVal / $responseTimeCount); echo $time_taken['h'] . 'hrs : ' . $time_taken['m'] . 'mins : ' . $time_taken['s'] . 'secs'; } ?> </td> </tr> <tr> <td width="40%"> <?php echo TXT_AVG_INITIAL_RESPONSE_PER_TICKET; ?> </td> <td> <?php $replyCountQry = "SELECT COUNT( REP.`nTicketId` ) as reply_count\r\n FROM `sptbl_replies` REP\r\n WHERE REP.`nStaffId` = " . $userRes['nStaffId'] . " AND REP.dDate >= '{$var_msdate}' AND REP.dDate <= '{$var_medate}'\r\n GROUP BY REP.`nTicketId`"; $replyCount = mysql_query($replyCountQry);
if (!empty($row["itemicon4"])) { $GameData[$c]["itemicon4"] = $row["itemicon4"]; } else { $GameData[$c]["itemicon4"] = "empty.gif"; } if (!empty($row["itemicon5"])) { $GameData[$c]["itemicon5"] = $row["itemicon5"]; } else { $GameData[$c]["itemicon5"] = "empty.gif"; } if (!empty($row["itemicon6"])) { $GameData[$c]["itemicon6"] = $row["itemicon6"]; } else { $GameData[$c]["itemicon6"] = "empty.gif"; } $GameData[$c]["left"] = secondsToTime($row["left"]); $GameData[$c]["leftreason"] = $row["leftreason"]; $ScoreGain = ""; $GameData[$c]["class"] = ''; if ($row["newcolour"] <= 5 and $row["winner"] == 1) { $ScoreGain = 1; } else { if ($row["newcolour"] > 5 and $row["winner"] == 2) { $ScoreGain = 1; } else { if ($row["newcolour"] <= 5 and $row["winner"] == 2) { $ScoreGain = 2; } else { if ($row["newcolour"] > 5 and $row["winner"] == 1) { $ScoreGain = 2; } else {