Update table names to new format

This commit is contained in:
floppydiskette 2023-07-19 01:58:32 +01:00
parent fb045348cf
commit fe0765795a
Signed by: fwoppydwisk
SSH key fingerprint: SHA256:yXxSuswzElTluzXjKgvZK0bDGhTaj/XbArybRDr+Mfs
5 changed files with 16 additions and 8 deletions

View file

@ -16,13 +16,13 @@ public function guestbookPost(Request $request) {
'message' => 'required' 'message' => 'required'
]); ]);
$matching_bans = DB::select('SELECT reason FROM guestbook_bans WHERE ip_address = ?', array($request->ip())); $matching_bans = DB::select('SELECT reason FROM guestbook__bans WHERE ip_address = ?', array($request->ip()));
if (count($matching_bans) > 0 ) { if (count($matching_bans) > 0 ) {
return view('errors.guestbook-ipban')->with('reason', $matching_bans[0]->reason); return view('errors.guestbook-ipban')->with('reason', $matching_bans[0]->reason);
} }
DB::insert('INSERT INTO guestbook_entries (name, timestamp, ip_address, agent, message) values (?, ?, ?, ?, ?)', array( DB::insert('INSERT INTO guestbook__entries (name, timestamp, ip_address, agent, message) values (?, ?, ?, ?, ?)', array(
htmlspecialchars($request->get('name')), htmlspecialchars($request->get('name')),
time(), time(),
$request->ip(), $request->ip(),

View file

@ -2,7 +2,11 @@
@section('title', 'guestbook') @section('title', 'guestbook')
@section('content') @section('content')
@php @php
$entries = DB::select('SELECT id, name, timestamp, message FROM guestbook_entries ORDER BY id DESC'); $entries = DB::select('
SELECT id, name, timestamp, message
FROM guestbook__entries
ORDER BY id DESC
');
@endphp @endphp
<h1>Entries <small>({{ count($entries) }} total)</small></h1> <h1>Entries <small>({{ count($entries) }} total)</small></h1>
@foreach ($entries as $entry) @foreach ($entries as $entry)

View file

@ -5,7 +5,7 @@
@php @php
$categories = DB::select(' $categories = DB::select('
SELECT id, name SELECT id, name
FROM bookmark_categories FROM bookmark__categories
ORDER BY priority ASC ORDER BY priority ASC
'); ');
@endphp @endphp
@ -15,7 +15,7 @@
@php @php
$sites = DB::select(' $sites = DB::select('
SELECT name, url, description SELECT name, url, description
FROM bookmark_sites FROM bookmark__sites
WHERE category_id = ? ORDER BY priority ASC WHERE category_id = ? ORDER BY priority ASC
', array($category->id)); ', array($category->id));
@endphp @endphp

View file

@ -43,7 +43,11 @@
</ul> </ul>
<hr/> <hr/>
@php @php
$entries = DB::select('SELECT name, timestamp, message FROM guestbook_entries ORDER BY id DESC'); $entries = DB::select('
SELECT name, timestamp, message
FROM guestbook__entries
ORDER BY id DES
');
@endphp @endphp
<h1>Entries <small>({{ count($entries) }} total)</small></h1> <h1>Entries <small>({{ count($entries) }} total)</small></h1>
@foreach ($entries as $entry) @foreach ($entries as $entry)

View file

@ -60,7 +60,7 @@
} }
$id = request()->input('id'); $id = request()->input('id');
$entry = DB::table('guestbook_entries')->find($id); $entry = DB::table('guestbook__entries')->find($id);
if ($entry) { if ($entry) {
// Render a confirmation view // Render a confirmation view
@ -78,7 +78,7 @@
} }
$id = request()->input('id'); $id = request()->input('id');
DB::table('guestbook_entries')->where('id', $id)->delete(); DB::table('guestbook__entries')->where('id', $id)->delete();
return back()->with('success', 'Entry deleted successfully!'); return back()->with('success', 'Entry deleted successfully!');
}); });