aboutsummaryrefslogtreecommitdiff
path: root/app/Http/Controllers
diff options
context:
space:
mode:
authorFrankie B <git@diskfloppy.me>2023-07-29 18:03:13 +0100
committerFrankie B <frankieraybrown@gmail.com>2023-07-29 18:10:50 +0100
commit8e36d3dcbaf72d4de2b73ed004eb1dfd4c1d6ef2 (patch)
treeab7483cda3af501fc0dfec175dda4983a7b99aad /app/Http/Controllers
parent4f50fa52c34eaf6e3a8148a5ccc4d1c9819425f3 (diff)
Merge fixes into v5.5 branch (#12)
--------- Co-authored-by: codacy-production[bot] <61871480+codacy-production[bot]@users.noreply.github.com>
Diffstat (limited to 'app/Http/Controllers')
-rw-r--r--app/Http/Controllers/GuestbookController.php19
1 files changed, 11 insertions, 8 deletions
diff --git a/app/Http/Controllers/GuestbookController.php b/app/Http/Controllers/GuestbookController.php
index c7aa88e..70707d7 100644
--- a/app/Http/Controllers/GuestbookController.php
+++ b/app/Http/Controllers/GuestbookController.php
@@ -18,17 +18,20 @@ class GuestbookController extends Controller {
$matching_bans = DB::select('SELECT reason FROM guestbook__bans WHERE ip_address = ?', array($request->ip()));
- if (count($matching_bans) > 0 ) {
+ if (!empty($matching_bans)) {
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(
- htmlspecialchars($request->get('name')),
- time(),
- $request->ip(),
- $request->userAgent(),
- htmlspecialchars($request->get('message'))
- ));
+ DB::insert(
+ 'INSERT INTO guestbook__entries (name, timestamp, ip_address, agent, message) values (?, ?, ?, ?, ?)',
+ [
+ htmlspecialchars($request->get('name')),
+ time(),
+ $request->ip(),
+ $request->userAgent(),
+ htmlspecialchars($request->get('message'))
+ ]
+ );
return back()->with('success', 'Entry submitted successfully!');
}