From 94133ec0f7fdac3367eac19a40082c4d18de96f5 Mon Sep 17 00:00:00 2001 From: Frankie B Date: Sun, 16 Jul 2023 01:49:09 +0100 Subject: feat: add guestbook with rate limiting (#6) * Re-add guestbook w/ rate limiting * Add guestbook to navbar --- app/Http/Controllers/GuestbookController.php | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 app/Http/Controllers/GuestbookController.php (limited to 'app/Http/Controllers/GuestbookController.php') diff --git a/app/Http/Controllers/GuestbookController.php b/app/Http/Controllers/GuestbookController.php new file mode 100644 index 0000000..aff30ed --- /dev/null +++ b/app/Http/Controllers/GuestbookController.php @@ -0,0 +1,29 @@ +validate($request, [ + 'name' => 'required', + 'message' => 'required' + ]); + + DB::insert('INSERT INTO guestbook_entries (name, timestamp, ip_address, agent, message) values (?, ?, ?, ?, ?)', array( + htmlspecialchars($request->get('name')), + time(), + $request->ip(), + $request->userAgent(), + htmlspecialchars($request->get('message')) + )); + + return back()->with('success', 'Entry submitted successfully!'); + } +} -- cgit v1.2.3-54-g00ecf