-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.php
35 lines (25 loc) · 1 KB
/
index.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
<?php
define('DIR_BASE', str_replace('\\', '/', realpath(dirname(__FILE__))) . '/');
require_once(DIR_BASE . 'library/utf8.php');
$lists = array();
$blacklists = array();
$output = '';
$files[] = 'openixlist';
$files[] = 'https://raw.githubusercontent.com/matomo-org/referrer-spam-blacklist/master/spammers.txt';
$files[] = 'https://raw.githubusercontent.com/Stevie-Ray/referrer-spam-blocker/master/src/domains.txt';
$files[] = 'https://raw.githubusercontent.com/desbma/referer-spam-domains-blacklist/master/spammers.txt';
foreach ($files as $file) {
$lists = file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
foreach ($lists as $list) {
$referral = replaceSpace(rtrim(utf8_strtolower($list), '/'));
$blacklists[$referral] = $referral;
}
}
ksort($blacklists);
foreach ($blacklists as $blacklist) {
$output .= $blacklist . "\n";
}
$file = fopen(DIR_BASE . 'blacklist', 'w') or die ('Could not open blacklist file!');
fwrite($file, $output);
fclose($file);
echo 'Spam referrer blacklist was created.';