diff options
author | Frankie B <git@diskfloppy.me> | 2023-07-16 01:49:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-16 01:49:09 +0100 |
commit | 8482a98ca6a767062917747a0b016a9ab4d35f01 (patch) | |
tree | 0ab0e8d3baf5b421ab909bc731334e2deff82fe0 /resources/views | |
parent | 1b267f61029e7d4b824979709434ffb437c347b8 (diff) |
feat: add guestbook with rate limiting (#6)
* Re-add guestbook w/ rate limiting
* Add guestbook to navbar
Diffstat (limited to 'resources/views')
-rw-r--r-- | resources/views/errors/ratelimit-guestbook.blade.php | 16 | ||||
-rw-r--r-- | resources/views/includes/header.blade.php | 3 | ||||
-rw-r--r-- | resources/views/pages/guestbook.blade.php | 53 |
3 files changed, 71 insertions, 1 deletions
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 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html lang="en"> +<head> + <title>Error 429: Overclocking Detected!</title> + <link rel="stylesheet" href="{{ URL::asset ('css/minimal.css') }}"/> +</head> + +<body> + <h1>Error 429: Overclocking Detected!</h1> + <hr/> + <p>Whoa there! Your submissions are going at warp speed.</p> + <p>Remember you can only submit an entry <u>once every hour</u>!</p> + <br/> + Click <a href="/guestbook">here</a> to go back to the guestbook. +</body> +</html> 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 @@ <a href="/projects/">projects</a> | <a href="/calculators/">calculators</a> | <a href="/computers/">computers</a> | - <a href="/bookmarks/">bookmarks</a> + <a href="/bookmarks/">bookmarks</a> | + <a href="/guestbook/">guestbook</a> </div> </nav> 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') + <br/> + <form method="POST" action="/guestbook"> + @csrf + <x-honeypot /> + <table class="gb_entryform"> + <tr> + <td> + <label for="name">Name:</label> + </td> + <td> + <input name="name" type="text" id="name" placeholder="John Doe"> + </td> + <td> + <span class="text-danger">{{ $errors->first('name') }}</span> + </td> + </tr> + <tr> + <td> + <label for="message">Message:</label> + </td> + <td> + <textarea name="message" id="message" rows="3"></textarea> + </td> + <td> + <span class="text-danger">{{ $errors->first('message') }}</span> + </td> + </tr> + <tr> + <td colspan="2"> + <button type="submit">Submit</button> + </td> + </tr> + </table> + </form> + <p>You can submit an entry <u>once every hour</u>.</p> + <p>Your IP address <u>will</u> be logged but <u>will not</u> be publically displayed.</p> + <hr/> + @php + $entries = DB::select('SELECT name, timestamp, message FROM guestbook_entries ORDER BY id DESC'); + @endphp + <h1>Entries <small>({{ count($entries) }} total)</small></h1> + @foreach ($entries as $entry) + <table class="gb_entry"><tr><td> + Name: {{ $entry->name }}<br/> + Date: {{ gmdate("H:i:s - Y-m-d", $entry->timestamp) }}<br/><br/> + {{ htmlspecialchars($entry->message) }} + </td></tr></table> + @endforeach +@stop + |