ワイルドカードでBOTをBAN出来るように
このコミットが含まれているのは:
コミット
03c75dbf3b
|
@ -9,6 +9,16 @@ class Comment {
|
|||
public function add (Request $r) {
|
||||
if (!isset($r->submit)) return '';
|
||||
if ($r->isvideo == 'f') $id = DB::table('blg_content')->select('id')->where('slug', $r->slug)->first()->id;
|
||||
$banned = DB::table('blg_blacklist')->get();
|
||||
foreach ($banned as $b) {
|
||||
$ip = explode('.', getIp());
|
||||
$ban = explode('.', $b->ipaddress);
|
||||
if (
|
||||
($ban[0] == $ip[0] && $ban[1] == $ip[1] && $ban[2] == $ip[2] && $ban[3] == $ip[3]) ||
|
||||
($ban[0] == $ip[0] && $ban[1] == $ip[1] && $ban[2] == $ip[2] && $ban[3] == '*') ||
|
||||
($ban[0] == $ip[0] && $ban[1] == $ip[1] && $ban[2] == '*' && $ban[3] == '*')
|
||||
) return redirect('/bot-trap/');
|
||||
}
|
||||
$shadow = DB::table('blg_blacklist')->where('ipaddress', getIp())->first();
|
||||
if ($shadow && !$shadow->isShadow) return array('status' => '0101FF', 'message' => '失礼しますが、あなたはBANされていましたので、コメントを保存できません。');
|
||||
|
||||
|
|
新しいイシューから参照