Example #1
0
                unset($ver);
                if ($RUN == "no") {
                    #Set to yes
                    $pause_type = "started";
                    $pause_run = "yes";
                }
                if ($RUN == "yes") {
                    #set to no
                    $pause_type = "paused";
                    $pause_run = "no";
                }
                $doit = $conn->prepare("UPDATE hiveconfig SET version=?,RUN=? WHERE id=1");
                $doit->execute(array($version, $pause_run));
                unset($doit);
                sleep(2);
                loglocal($now, "MAIN", "INFO", "Successfully {$pause_type} Data Collection by Admin from source IP {$user_ip}");
                header('Refresh: 1; url=/admin/system.php');
                break;
        }
    }
} else {
    $command = "none";
}
?>
<!DOCTYPE html>
<html lang="en">


    <!-- Header and Navigation -->
         <?php 
include $_SERVER["DOCUMENT_ROOT"] . "/include/navigation.php";
Example #2
0
function mmc_array_all_cache($name)
{
    $list = mmc_array_all($name);
    //清理异常记录
    foreach ($list as $key => &$value) {
        if (@$value['name'] === '') {
            mmc_array_del($name, $key);
            loglocal('del ' . $key);
            loglocal($value);
            unset($list[$key]);
        }
        if (array_key_exists('finish_time', $value)) {
            $finish_time = trans_time($value['finish_time']);
            if (time() >= $finish_time) {
                $value['status'] = 'timeout';
                mmc_array_set($name, $key, $value);
            }
        }
    }
    $file_name = get_cached_filename($name);
    if (count($list) === 0) {
        if (file_exists($file_name)) {
            $list = unserialize(file_get_contents($file_name));
            if (empty($list)) {
                return array();
            }
        } else {
            return array();
        }
        mmc_array_clear($name);
        foreach ($list as $key => $value) {
            $res = mmc_array_set($name, $key, $value);
        }
    } else {
        file_put_contents($file_name, serialize($list));
    }
    return $list;
}
Example #3
0
        $command = test_input($_GET["command"]);
    }
} else {
    $command = "";
}
switch ($command) {
    case "clearlogs":
        $sth = $conn->prepare("DELETE from logs");
        $sth->execute();
        #Get system time
        $shortName = exec('date +%Z');
        $longName = timezone_name_from_abbr($shortName);
        date_default_timezone_set($longName);
        $now = date('Y-m-d H:i:s');
        $user_ip = getUserIP();
        loglocal($now, "WEBADMIN", "INFO", "Logs cleared by Admin from source IP {$user_ip}");
        break;
}
function loglocal($date, $program, $type, $message)
{
    #Stores log entries locally
    # This script takes 4 inputs and puts them into the DB
    # 1 - Date -
    # 2 - Program
    # 3 - Type (Error, Success, Warning)
    # 4 - Message (Optional)
    include $_SERVER["DOCUMENT_ROOT"] . "/include/db-connect.php";
    $sth = $conn->prepare("insert into logs (date,program,type,message) values (\"{$date}\",\"{$program}\",\"{$type}\",\"{$message}\")");
    $sth->execute();
}
function getUserIP()