Block IPs from sending email

How to block specific IPs from sending email via a ChronoForms form.

Overview

The issue occurred when custom code to block IPs was placed incorrectly, preventing the form from sending mail.
Place the IP blocking custom code just before the Email Action in the form. Alternatively, use the built-in watchman behavior in CF v7 to manage an IP block list.

Answered
ChronoForms v6
va vanzini 03 Sep, 2020
Hi,
I need to block certains IPs from sending empty mail via Chronoforms V6 - I cannot block these IPs in firewall as they need to be allowed to crawl the domains for SEO tool tasks.
So looing around in the forums I found following custom scripts I have tried to adapt

1) added Custom Code in Submit Action area on top of all other functions with following code

<?php
$banned_ips = array(
'78.138.117.190',
'78.138.117.191'
);
$ip_address = JRequest::getString( 'REMOTE_ADDR', '', 'server' );
if ( in_array($ip_address, $banned_ips) ) {
$app = JFactory::getApplication();
$app->redirect('index.php');
}
?>

Result: the form no longer works in the sense mail is not being sent

2) added this following code in same place as of above

<?php
$banned_ips = array(
'78.138.117.190',
'78.138.117.191'
);
?>

Result: the instruction is being ignored. the form works, mail is being sent - I have tested this by added my own IP.


Please can anybody give my some instruction on this?
K Regards
Daniele
Max_admin Max_admin 03 Sep, 2020
Just add reCaptcha or honeypot check to block them.

But for that code, you may need to use "echo $ip_address" after you get it in order to check if you get it correctly!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
va vanzini 03 Sep, 2020
Answer
Thanks for coming back so quickly.
I am of course using Google reCaptcha -
now I have added the script just before the Email Action - and so far it seems to work.

Oh, I was not aware of version7 - I have now downloaded and will have a go as soon as possible and let you know.
Many thanks and have a nice evening.
Daniele
Max_admin Max_admin 04 Sep, 2020
great, I have also added an IP block list to the watchman behavior in v7
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
va vanzini 04 Sep, 2020
1 Likes
Sorry, forgot to mark yesterdays posta as answered
This topic is locked and no more replies can be posted.