示例#1
0
<?php

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
include "includes/func/func.php";
$logged_in = isLoggedIn();
$service_list = getServiceListSession();
if (isset($_POST["newservice"])) {
    $service_list = addToServiceList($_POST["newservice"]);
}
if (isset($_POST["dropservice"])) {
    $service_list = removeFromServiceList($_POST["dropservice"]);
}
$google_ping_time = getGooglePing();
$online_badge = "<span class='pull-right badge bg-green'>Online</span>";
$offline_badge = "<span class='pull-right badge bg-red'>Offline</span>";
if ($google_ping_time < 20) {
    $google_ping_badge = "<span class='pull-right badge bg-green'>Excellent! (<20ms)</span>";
    $google_ping_class = "progress-bar-success";
} else {
    if ($google_ping_time >= 20 && $google_ping_time < 50) {
        $google_ping_badge = "<span class='pull-right badge bg-blue'>Good (20-50ms)</span>";
        $google_ping_class = "progress-bar-info";
    } else {
        if ($google_ping_time >= 50 && $google_ping_time < 75) {
            $google_ping_badge = "<span class='pull-right badge bg-yellow'>Moderate (50-75ms)</span>";
            $google_ping_class = "progress-bar-warning";
        } else {
            if ($google_ping_time >= 75 && $google_ping_time < 149) {
                $google_ping_badge = "<span class='pull-right badge bg-red'>Slow (75-150ms)</span>";
示例#2
0
function removeFromServiceList($service)
{
    $serviceList = getServiceListSession();
    foreach ($serviceList as $key => $value) {
        if (trim(strtolower($value)) == trim(strtolower($_POST["dropservice"]))) {
            $removeKey = $key;
        }
    }
    unset($serviceList[$removeKey]);
    $myfile = fopen("includes/config/serviceList.txt", "w") or die("Unable to open file!");
    fwrite($myfile, json_encode($serviceList));
    fclose($myfile);
    return reloadServiceList($serviceList);
}