This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 2

Ban IP Address(es)


  1. tdcl
    Member

    Hi, sorry if this has been answered before. However, I have a simple form which has Captcha, yet there are a few people who dont mind wasting their time filling in 'spam' and then sending it on. I dont want to limit it to one submission per person as there could be people who use the same IP address, or within a group.

    My 'coding' skills are limited, yet is there anywhere in the code that I can put individual IP adresses so they dont reach me, or are blocked?

    Thanks for your help.

    Posted 13 years ago #
  2. yuniar

    Yes, this is possible.

    All you need to do is to modify your "includes/post-functions.php" file.
    Around line 10, you'll see this line of code:

    function process_form($input){

    exactly below that code, add this:

    $banned_ip_address = array('192.168.0.1','192.168.0.2','192.168.0.3');
    
    if(in_array($_SERVER['REMOTE_ADDR'],$banned_ip_address)){
    	$process_result['status'] = true;
    	return $process_result;
    }

    the above code will block 3 ip address as listed there.

    This method uses "silent ip blocking", which means the person will still be able to submit the form, but their entries won't be saved into the database and won't be sent to email.

    This way, they won't even notice that they are currently being blocked. Thus preventing them from changing their ip address


    MachForm Founder

    Posted 13 years ago #
  3. tdcl
    Member

    This is brilliant, exactly what I need.

    Thank you very much.

    Posted 13 years ago #
  4. webcat
    Member

    Wow, you guys should implement this in the form settings so we dont have to code each form we want to block ips on? I really could use that feature and think it would go a long way towards the benefit of our forms. Would you think about it? Til then, I will use this work around, but I have a LOT of forms I will have to edit the "includes/post-functions.php" file on....:o(

    Posted 10 years ago #
  5. webcat
    Member

    Just tested this, and there "Is" a slight distinction, when using the block code, the form is submitted and no success message is displayed. This may alert spammers who have already been submitting spam, and "seeing" the success message, to the fact something is being used, because now they "dont see" the success message.

    Posted 10 years ago #
  6. yuniar

    We haven't received many requests regarding this functionality but we'll keep an eye on this.


    MachForm Founder

    Posted 10 years ago #

RSS feed for this topic

Reply