Forums

IP Bann show message

bjems 19 Apr, 2020
Hello,

i puted a custom code on top of the load actions to redirect banned ip before the Display form event.

It's possible to not load the form and just show a Alert message (instead of redirect) to inform that the ip is banned from my website ?

Thanks
Best regards
Max_admin 19 Apr, 2020
return specific value from a PHP action and check it in an IF Conditions action and display your message!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
bjems 19 Apr, 2020
Hello,

thanks for your answer.

I writted this (finded on the forum) :
<?php
$banned_ips = array('192.3.244.45','45.61.169.200');
$ip_address = JRequest::getString( 'REMOTE_ADDR', '', 'server' );
if ( in_array($ip_address, $banned_ips) ) {
$app = JFactory::getApplication();
echo "<p>Votre adresse IP '{ip:}' est considérée comme SPAM, si ce n'est pas le cas merci de nous contacter via les infos à droite!</p>";
$app->redirect('index.php');
}
?>

But i want to show a message like the message after submitting the form.
How can i call the message in this code? Name of the message "message_spam"
Not making the redirect, juste not loading the form and showing this message.

Thanks
GreyHead 20 Apr, 2020
Hi bjems,

Banned IP addresses are usually submitted by bots - and they don't read messages.

If you do really need to display a message then you can use an Event Switcher to check the IP address and that add a Message action before the Load action (and remove the redirect from the PHP).

Bob
bjems 20 Apr, 2020
Hello,

Thanks.
I tried to remove the redirect, but seems not working (maybe not doing the right things).
The message action are not displaying and the form was loaded.

I puted the first swither like "spam" name and deleted the second, writted the php code in a custom php module, added the message module.

I tried with a stopper too, but it not helped.

Thanks
bjems 27 Apr, 2020
Hello,

nobody can help me?

BJems
Max_admin 28 Apr, 2020
In the PHP code you had before, comment this line:
//$app->redirect('index.php');
And change the message line:
echo "<p class="ui message red">Votre adresse IP '{ip:}' est considérée comme SPAM, si ce n'est pas le cas merci de nous contacter via les infos à droite!</p>";
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.