Add ability to ban users from guestbook (by IP)
This commit is contained in:
		
					parent
					
						
							
								e1da508542
							
						
					
				
			
			
				commit
				
					
						65b02f3b8d
					
				
			
		
					 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(), | ||||
|  |  | |||
							
								
								
									
										12
									
								
								resources/views/errors/guestbook-ban.blade.php
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								resources/views/errors/guestbook-ban.blade.php
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,12 @@ | |||
| @extends('layouts.minimal') | ||||
| @section('title', 'Error 403: IP Blocked!') | ||||
| @section('content') | ||||
|     <h1>Error 403: IP Blocked!</h1> | ||||
|     <hr/> | ||||
|     <p>Your IP has been banned from submitting to the guestbook.</p> | ||||
|     @if (isset($reason)) | ||||
|         <p><b>Reason:</b> {{ $reason }}</p> | ||||
|     @endif | ||||
|     <br/> | ||||
|     Click <a href="/guestbook">here</a> to go back to the guestbook. | ||||
| @stop | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Frankie B
				Frankie B