-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsecurity-plugin.php
74 lines (41 loc) · 1.37 KB
/
security-plugin.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
74
<?php
// Simple Security Plugins By R&D ICWR
// How to use ? include this script to your php config or php file
// Copyright (c)2020 - R&D ICWR
class security {
function block() {
header("HTTP/1.1 403 Forbidden");
$html = "<title>Your Request Blocked</title>Your Request Blocked, Security by <a href=\"https://github.com/ICWR-TECH/PHP-Security-Plugin\">https://github.com/ICWR-TECH/PHP-Security-Plugin</a>";
return $html;
}
function headers() {
header("X-Frame-Options: SAMEORIGIN");
}
function filter_user_agent() {
$str = "google|facebook|opera|mozilla|safari|whatsapp|telegram|twitter|yahoo|bing";
if (!preg_match("/$str/", strtolower($_SERVER['HTTP_USER_AGENT']))) {
echo security::block();
exit();
}
}
function parameters_filter() {
if (!empty($_GET)){
$block_chars = "\"|'|<|>|\.|\(|\)|=|%";
foreach($_GET as $key => $value) {
if (preg_match("/$block_chars/", strtolower($_GET[$key]))) {
echo security::block();
exit();
}
}
}
}
function all_use() {
security::parameters_filter();
}
}
// security::headers(); // Custom Header
security::filter_user_agent();
if (!empty($_GET)) {
security::all_use();
}
?>