-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontrol.php
executable file
·74 lines (56 loc) · 1.86 KB
/
control.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?
$downloads=false;
$currentUserIP = $_SERVER['REMOTE_ADDR'];
$blocklist = 'block.lst';
$blocked_ips = file($blocklist, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$blocked_all=false;//true;//false;//true;//false;
$lang=substr($_SERVER['HTTP_ACCEPT_LANGUAGE'],0,2);
if (strpos($_SERVER['REQUEST_URI'],"log")) { exit;}
if ($_GET['path']) {
$path=$_GET['path'];
$_GET['path']="";
}
if (strpos(" ".$_SERVER['HTTP_USER_AGENT'],"TelegramBot")||strpos(" ".$_SERVER['HTTP_USER_AGENT'],"facebook")) $blocked_all=true;
if (substr(" ".$_SERVER['HTTP_USER_AGENT'],"facebookexternalhit")) {
$blocked=true;
$fp = fopen("block.lst", "a");
fwrite($fp,$_SERVER['REMOTE_ADDR']);
fclose($fp);
}
if ($blocked_all) $blocked=true;
foreach ($blocked_ips as $blocked_ip) {
if (strpos($currentUserIP, $blocked_ip) !== false) {
$blocked=true;
}
}
if (in_array($currentUserIP, $blocked_ips)||$blocked_all) {
$blocked=true;
if (strpos($_SERVER['REQUEST_URI'],"privat")) header('location:'.$base_path.'/');
}
$data = array(
'UNIQUE_ID' => $_SERVER['UNIQUE_ID'],
'REMOTE_ADDR' => $_SERVER['REMOTE_ADDR'],
'HTTP_USER_AGENT' => $_SERVER['HTTP_USER_AGENT'],
'HTTP_ACCEPT_LANGUAGE' => $_SERVER['HTTP_ACCEPT_LANGUAGE'],
'HTTP_REFERER' => $_SERVER['HTTP_REFERER'],
'REQUEST_URI' => $_SERVER['REQUEST_URI'],
'DATE' => date('d-m-Y H:i:s')
);
if ($_GET['resourcekey']) {
$_GET['resourcekey']=str_replace("/","",$_GET['resourcekey']);
$add_params="?resourcekey=".$_GET['resourcekey'];
//get the code and user id
$user=validatekey($_GET['resourcekey']);
$data['USER']=$user;
//validate only resoucekey links
if ($user!="") {
$blocked_all=false;
$blocked=false;
}
else { $blocked_opengea=true; }
}
if ($_GET['resourcekey']=="") $blocked_opengea=true;
$visible=true;
$fp = fopen("log/visits.log", "a");
if (!$blocked) fwrite($fp, print_r($data,true));
fclose($fp);