Add ability to ban users from guestbook (by IP)
This commit is contained in:
parent
805e9f9dca
commit
22b74d1764
2 changed files with 18 additions and 0 deletions
|
@ -16,6 +16,12 @@ public function guestbookPost(Request $request) {
|
|||
'message' => 'required'
|
||||
]);
|
||||
|
||||
$matching_bans = DB::select('SELECT reason FROM guestbook_bans WHERE ip_address = ?', array($request->ip()));
|
||||
|
||||
if (count($matching_bans) > 0 ) {
|
||||
return view('errors.guestbook-ban')->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(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue