This tutorial will use the same flood control of IP.Board when users post comments of IP.Downloads files.
Open sources/components_public/downloads/comments.php and find:
Open sources/components_public/downloads/comments.php and find:
/*-------------------------------------------------------------------------*/
// Add Comment
/*-------------------------------------------------------------------------*/
function add_comment()
{
$id = intval($this->ipsclass->input['id']);
if( !$id )
{
$this->ipsclass->boink_it( $this->ipsclass->base_url."autocom=downloads" );
}
Add below//------------------------------------------
// Flood control, by Adriano (SOS Invision)
//------------------------------------------
if ($this->ipsclass->member['g_avoid_flood'] != 1)
{
$ultimocomentario = $this->ipsclass->DB->build_and_exec_query( array( 'select' => 'comment_date', 'from' => 'downloads_comments', 'where' => 'comment_mid='.$this->ipsclass->member['id'], 'order' => 'comment_date DESC', 'limit' => array( 0,1 ) ) );
if ( time() - $ultimocomentario['comment_date'] < $this->ipsclass->vars['flood_control'] )
{
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'flood_control' , 'EXTRA' => $this->ipsclass->vars['flood_control'] ) );
}
}
When user tries to make another comment within the time configured to flood control on IP.Board, will shows the message:













