Мастер валидации на PHP

Пользователь

от abelardo_kris , в категории: PHP , 3 года назад

Мастер валидации на PHP 😁

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
if(!isset($ip) || !isset($port) || !isset($time) || !isset($method) || !isset($key) || !isset($customer))
{
    die('ERROR: Please fill in all fields');

}
elseif(!filter_var($ip, FILTER_VALIDATE_IP) && $methodData['classification'] == 4)
{
    die('ERROR: This is not a valid IP');

}
elseif(!filter_var($ip, FILTER_VALIDATE_URL) && $methodData['classification'] == 7)
{
    die('ERROR: This is not a valid layer 7 URL');
}
elseif(!is_numeric($port) || !is_numeric($time))
{
    die('ERROR: Numeric Port / Time values only');
}
elseif(!$server->allowedMethod($method))
{
    die('ERROR: This is not a valid method');
}
elseif($time > $data['max_time'])
{
    die('ERROR: You are exceeding your max boottime!');
}
elseif($key != $data['accesskey'])
{
    die(Config::Read('DENYMSG'));
}
elseif(!$user->freeSlot($admin))
{
    die('ERROR: You have the maximum amount of concurrent attacks running');
}
else
{
    print 'Attack has been sent on ' . htmlspecialchars($ip) . ':' . htmlspecialchars($port) . ' for ' . $time . ' seconds using ' . $method;
    $logs->insertLog($customer, $ip, $port, $time, $method);
    $server->sendAttack($ip, $port, $time, $method);
}


Facebook Vk Ok Twitter LinkedIn Telegram Whatsapp Pocket

Нет ответов