Skip to content

Instantly share code, notes, and snippets.

@kikiriko200 kikiriko200/eudeny.php
Last active Mar 29, 2019

Embed
What would you like to do?
これにcronで自動更新付の.htaccess作れる筈
<?php
$filename = '.htaccess';
// a+じゃなくてwだったらわざわざ消さなくていいらしい
$fp = fopen($filename,'w');
// EU Deny 配布元
$ip_lists = file_get_contents("https://ipv4.fetus.jp/krfilter.4.apache.txt");
// Headerとかとか。
$ip_set .= "<ifModule mod_headers.c>"."\n";
$ip_set .= "Header always set X-XSS-Protection '1; mode=block'"."\n";
$ip_set .= "</ifModule>"."\n";
// アクセス制限
$ip_set .= "order Allow,Deny"."\n";
$ip_set .= "Allow from all"."\n\n";
$ip_set .= "\n";
$ip_set .= $ip_lists;
$ip_set = mb_convert_encoding($ip_set,'Shift-JIS"');
fwrite($fp,$ip_set);
fclose($fp);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.