wah.moe/resources/views/pages/guestbook.blade.php

92 lines
3.1 KiB
PHP
Raw Normal View History

@extends('layouts.default')
2023-07-25 23:08:58 +00:00
@section('title', 'Guestbook')
@section('content')
@php
$db_alive = true;
try {
DB::connection()->getPdo();
} catch (Exception $e) {
$db_alive = false;
}
@endphp
@if (!$db_alive)
@include('components.errors.db-error')
@else
2023-07-25 23:08:58 +00:00
<br>
2023-10-15 19:52:32 +00:00
<table class="gb-entry-form-container" role="presentation">
2023-07-25 23:08:58 +00:00
<tr>
<td>
<form method="POST" action="/guestbook">
@csrf
<x-honeypot/>
2023-10-15 19:52:32 +00:00
<table class="gb-entry-form" role="presentation">
2023-07-25 23:08:58 +00:00
<tr>
<td>
<label for="name"><strong>Name:</strong></label>
</td>
<td>
<input name="name" type="text" id="name">
2023-07-25 23:08:58 +00:00
</td>
<td>
<span class="text-danger">{{ $errors->first('name') }}</span>
</td>
</tr>
<tr>
<td>
<label for="message"><strong>Message:</strong></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></td>
<td>
<button type="submit">Submit</button>
</td>
</tr>
</table>
</form>
</td>
<td>
2024-01-22 00:09:05 +00:00
<p><i>A few things to note:</i></p>
2023-07-25 23:08:58 +00:00
<ul>
<li>You can submit an entry <u>once every hour</u>.</li>
<li>Your IP address is logged but <u>not</u> publicly displayed.</li>
2023-07-25 23:08:58 +00:00
<li>Any entries that appear to be spam <u>will</u> be removed.</li>
2024-01-22 00:09:05 +00:00
<li></li>
2023-07-25 23:08:58 +00:00
</ul>
</td>
</tr>
</table>
<hr>
@php
2023-07-19 00:58:32 +00:00
$entries = DB::select('
SELECT name, timestamp, message
FROM guestbook__entries
2023-07-19 00:59:22 +00:00
ORDER BY id DESC
2023-07-19 00:58:32 +00:00
');
@endphp
2023-10-15 19:52:32 +00:00
<h2>Entries <small>({{ count($entries) }} total)</small></h2>
@foreach ($entries as $entry)
2023-10-15 19:52:32 +00:00
<table class="gb-entry" role="presentation">
2023-07-25 23:08:58 +00:00
<tr>
<td>
Submitted by <strong>{{ $entry->name }}</strong>
on <strong>{{ gmdate('Y-m-d', $entry->timestamp) }}</strong>
at <strong>{{ gmdate('h:i:s A (e)', $entry->timestamp) }}</strong>
2023-07-25 23:08:58 +00:00
<hr>
{{ $entry->message }}
</td>
</tr>
</table>
<br>
@endforeach
@endif
@stop