Appnitro Software Forums » MachForm

Ban IP Address(es)

(3 posts)

  1. 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 2 months ago #
  2. 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

    Posted 2 months ago #
  3. This is brilliant, exactly what I need.

    Thank you very much.

    Posted 2 months ago #

RSS feed for this topic

Reply

You must log in to post.