コード例 #1
0
    $config_counter_enabled = true;
} elseif (isset($set_counter_enabled) && $set_counter_enabled === false) {
    $crazystat_add = "&set_counter_enabled=false";
    $config_counter_enabled = false;
} else {
    $crazystat_add = '';
}
if ($config_counter_enabled && ($config_counter_text || isset($set_counter_text) && $set_counter_text)) {
    $config_counter_enabled = false;
    $crazystat_add = '&set_counter_enabled=false';
    $config_counter_alternative = 'img/blind.gif';
    $crazystat_log = file(dirname(__FILE__) . '/../usr/' . $config_logfile_folder . '/' . $config_count_file);
    // Start reading counter value (Reload?)
    if ($config_counter_reload) {
        require_once dirname(__FILE__) . '/log_funcs.php';
        $crazystat_logfile_path = get_last_log(dirname(__FILE__) . '/');
        $crazystat_logfile_handle = fopen($crazystat_logfile_path, 'r');
        if ($crazystat_logfile_handle === false) {
            echo L_STAT_MSG_ERR_READ_ERROR . ' F1';
        } else {
            fseek($crazystat_logfile_handle, $crazystat_log[0]);
            // Do not start at beginning. Start where new hits began last time.
            $crazystat_block = time() - $config_ip_block_time * 60;
            // All hits after $crazystat_block are covered by IP blocking
            $crazystat_counter_reload = false;
            while (!feof($crazystat_logfile_handle)) {
                $crazystat_zeile = fgets($crazystat_logfile_handle);
                if (empty($crazystat_zeile)) {
                    continue;
                }
                $crazystat_daten = explode('#', $crazystat_zeile);
コード例 #2
0
ファイル: stat.php プロジェクト: ninux-fi/monitoring_scripts
                // warte 1 Sekunde, um dem andern Prozess Zeit zu geben
                $counterfile_data = file($counterfile_path);
                $versuche++;
            }
            if ((!isset($counterfile_data[$i]) || $counterfile_data[$i] == '') && $versuche >= 10) {
                show_error($config_count_file . ' ' . L_STAT_MSG_ERR_COUNTER_FILE);
            }
        } else {
            $counterfile_data[$i] = trim($counterfile_data[$i]);
        }
    }
} else {
    $counterfile_data = array(0, 0, 0);
}
$neue_datei = false;
$logfile_path = get_last_log();
if ($neue_datei) {
    $counterfile_data[0] = 0;
}
// Wenn eine neue Datei angelegt wurde muss am Anfang der Datei angefangen werden zu lesen.
$readpos = $counterfile_data[0];
// Ab diesem Byte wird angefangen die (letzte) Logdatei auszuwerten
$logfile_handle = fopen($logfile_path, 'r');
if ($logfile_handle === false) {
    show_error(L_STAT_MSG_ERR_READ_ERROR . ' F1');
}
fseek($logfile_handle, $readpos);
// Starte nicht am Anfang, sondern da, wo das letzte Mal die neuen Zugriffe begonnen haben
$block = time() - $config_ip_block_time * 60;
// Alle Zugriffe nach $block fallen unter die IP-Sperre
$counter_reload = false;