Jump to content

  •  

  • Tutorial info Visit support topic

    • Added on: Apr 15 2009 12:45 AM
    • Date Updated: Apr 15 2009 12:48 AM
    • Views: 872
     


    * * * * *
    0 Ratings

    Flood control when post comments

    Posted by Adriano Faria on Apr 15 2009 12:45 AM
    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:

    	   /*-------------------------------------------------------------------------*/
    	   // 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:

    Posted Image


    Powered by Tutorials 1.4.1 © 2012, by Michael McCune