また反スパム…

このコミットが含まれているのは:
テクニカル諏訪子 2021-07-22 21:08:43 +09:00
コミット c6b63e0e5d
3個のファイルの変更8行の追加7行の削除

ファイルの表示

@ -9,7 +9,7 @@ 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();
$banned = DB::table('blg_blacklist')->where('isShadow', 0)->get();
foreach ($banned as $b) {
$ip = explode('.', getIp());
$ban = explode('.', $b->ipaddress);
@ -19,8 +19,9 @@ class Comment {
($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されていましたので、コメントを保存できません。');
if ($r->user_id == 0 && (str_contains($r->newmessage, 'http://') || str_contains($r->newmessage, 'https://'))) return redirect('/');
$shadow = DB::table('blg_blacklist')->where('isShadow', 1)->where('ipaddress', getIp())->first();
$add = DB::table('blg_comments')->insertGetId([
'user_id' => ($r->user_id != 0 ?: null),