aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorFrankie B <git@diskfloppy.me>2023-07-16 15:27:48 +0100
committerFrankie B <git@diskfloppy.me>2023-07-16 15:27:48 +0100
commit65b02f3b8df505b60230af0647d7187f4dc7cfd7 (patch)
tree9e6430d8c733066b87bcdd755fe1cc42b48607a3 /app
parente1da5085426d1759c31c2a0f4a06aad3e39fe555 (diff)
Add ability to ban users from guestbook (by IP)
Diffstat (limited to 'app')
-rw-r--r--app/Http/Controllers/GuestbookController.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/Http/Controllers/GuestbookController.php b/app/Http/Controllers/GuestbookController.php
index aff30ed..da5391d 100644
--- a/app/Http/Controllers/GuestbookController.php
+++ b/app/Http/Controllers/GuestbookController.php
@@ -16,6 +16,12 @@ class GuestbookController extends Controller {
'message' => 'required'
]);
+ $matching_bans = DB::select('SELECT reason FROM guestbook_bans WHERE ip_address = ?', array($request->ip()));
+
+ if (count($matching_bans) > 0 ) {
+ return view('errors.guestbook-ban')->with('reason', $matching_bans[0]->reason);
+ }
+
DB::insert('INSERT INTO guestbook_entries (name, timestamp, ip_address, agent, message) values (?, ?, ?, ?, ?)', array(
htmlspecialchars($request->get('name')),
time(),