Help me stop DDoS

Печать RSS
432


Чатланин
0
Please write to function fully, I will correct it
Q
Автор
Пришелец
0
includes/function.php
    function server_busy($numer){
    if (PHP_OS == 'Linux' AND @file_exists('/proc/loadavg') AND $filestuff =@file_get_contents('/proc/loadavg')){
    $loadavg = explode(' ', $filestuff);
    if (trim($loadavg[0]) > $numer) {
    print 'server busy, Please wait….';
    exit(0);
    }
    }
    } 

    $srv = server_busy('5.00');
?>
Thanks
Изменил: QuyCuong (08.05.2013 / 09:17)

Чатланин
0
12. QuyCuong, Checked out your function, it works.
Maybe file /proc/loadavg is not readable?
Изменил: shilo (08.05.2013 / 09:44)

Чатланин
0
<?php
function server_busy($numer){
    if (PHP_OS == 'Linux' AND @file_exists('/proc/loadavg') AND $filestuff =@file_get_contents('/proc/loadavg')){
        $loadavg = explode(' ', $filestuff);
        if (trim($loadavg[0]) > $numer) {
                echo 'server busy, Please wait.';
                exit(0);
        }
        # :D EBUG
        # else {
        #       echo "OK";
        #}
        return trim($loadavg[0];
    }
}

$srv = server_busy('1.00');
?>
Q
Автор
Пришелец
0
shilo (8 Мая 2013 / 10:00)
<?php
function server_busy($numer){
    if (PHP_OS == 'Linux' AND @file_exists('/proc/loadavg') AND $filestuff =@file_get_contents('/proc/loadavg')){
        $loadavg = explode(' ', $filestuff);
        if (trim($loadavg[0]) > $numer) {
                echo 'server busy, Please wait.';
                exit(0);
        }
        # :D EBUG
        # else {
        #       echo "OK";
        #}
        return trim($loadavg[0];
    }
}

$srv = server_busy('1.00');
?>
It does not work, 501 hits without notice : Server busy , Please wait...

Чатланин
0
You probably do not quite understand what the script does ...
His script displays an error if the server is overloaded. it does not function as antiddos.
Q
Автор
Пришелец
0
for example, I rather $ s r v = s e r v e r _ b u s y ( ' 1 . 0 0 ' ) ; In order to check, why? I
want test some hits in 10 people
Ю

deleted
0
To eliminate such problems should the administration of your server.
P.S. I do not speak English. But I think what you understand me.
Стикеры / Теги / Правила / Топ тем / Топ постов / Поиск