aboutsummaryrefslogtreecommitdiff
path: root/resources/views/pages/guestbook.blade.php
blob: f6b758ab87fa999609a8a63c14a4eccba1dc9caa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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:&nbsp;{{ $entry->name }}<br/>
            Date:&nbsp;{{ gmdate("H:i:s - Y-m-d", $entry->timestamp) }}<br/><br/>
            {{ htmlspecialchars($entry->message) }}
        </td></tr></table>
    @endforeach
@stop