From 8482a98ca6a767062917747a0b016a9ab4d35f01 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 --- .../views/errors/ratelimit-guestbook.blade.php | 16 +++++++ resources/views/includes/header.blade.php | 3 +- resources/views/pages/guestbook.blade.php | 53 ++++++++++++++++++++++ 3 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 resources/views/errors/ratelimit-guestbook.blade.php create mode 100644 resources/views/pages/guestbook.blade.php (limited to 'resources/views') diff --git a/resources/views/errors/ratelimit-guestbook.blade.php b/resources/views/errors/ratelimit-guestbook.blade.php new file mode 100644 index 0000000..fa29855 --- /dev/null +++ b/resources/views/errors/ratelimit-guestbook.blade.php @@ -0,0 +1,16 @@ + + + + Error 429: Overclocking Detected! + + + + +

Error 429: Overclocking Detected!

+
+

Whoa there! Your submissions are going at warp speed.

+

Remember you can only submit an entry once every hour!

+
+ Click here to go back to the guestbook. + + diff --git a/resources/views/includes/header.blade.php b/resources/views/includes/header.blade.php index 2951003..53d44e2 100644 --- a/resources/views/includes/header.blade.php +++ b/resources/views/includes/header.blade.php @@ -6,6 +6,7 @@ projects | calculators | computers | - bookmarks + bookmarks | + guestbook diff --git a/resources/views/pages/guestbook.blade.php b/resources/views/pages/guestbook.blade.php new file mode 100644 index 0000000..f6b758a --- /dev/null +++ b/resources/views/pages/guestbook.blade.php @@ -0,0 +1,53 @@ +@extends('layouts.default') +@section('title', 'guestbook') +@section('content') +
+
+ @csrf + + + + + + + + + + + + + + + +
+ + + + + {{ $errors->first('name') }} +
+ + + + + {{ $errors->first('message') }} +
+ +
+ +

You can submit an entry once every hour.

+

Your IP address will be logged but will not be publically displayed.

+
+ @php + $entries = DB::select('SELECT name, timestamp, message FROM guestbook_entries ORDER BY id DESC'); + @endphp +

Entries ({{ count($entries) }} total)

+ @foreach ($entries as $entry) +
+ Name: {{ $entry->name }}
+ Date: {{ gmdate("H:i:s - Y-m-d", $entry->timestamp) }}

+ {{ htmlspecialchars($entry->message) }} +
+ @endforeach +@stop + -- cgit v1.2.3-54-g00ecf