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
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
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!
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!
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
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
great, I have also added an IP block list to the watchman behavior in v7
This topic is locked and no more replies can be posted.