1. Go to this page and download the library: Download vincendev/laraflood library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
public function postLogin()
{
/**
* If thes user ip has >= 5 failed login attempts in last 5 minutes, redirect user
* back with error:
*/
if( Laraflood::check( 'ip' , 'login', 5, 5 ) === FALSE )
return redirect()->back()->withErrors(["AntiFlood Protection! Try again in ".Laraflood::timeLeft('ip','login')." ."]);
/**
* Your code here..
*/
}
public function incrementPostViews()
{
$action = "post-visit:" . $post->id; // Post unique ID
$visitsPerUser = 1;
$minutes = 1440; // 24Hours
if(Laraflood::checkOnly('ip', $action, $visitsPerUser)){
/**
* Increment post views
* Your code here..
*/
Laraflood::addAttempt('ip', $action, $minutes);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.