Hide forms for certain IP addresses
Previous article Next articleHide website forms for certain IP addresses (partial banning)
Create a new User Defined Tag, named "form_ip_filter"
"123.123.000.000",
"127.0.0.1"
);
$smarty->assign('ipbanned', '');
if(in_array($_SERVER['REMOTE_ADDR'], $banned_IPs)) $smarty->assign('ipbanned', 'true');
Fill the UDT with the IP addresses of the people you don't want to show the forms.
How to use
Hide contact form
{if empty($ipbanned)}
{FormBuilder form='contact'}
{/if}
Hide guestbook form, but show recieved messages
{if empty($ipbanned)}
{Gbook action='form'}
{/if}
{Gbook}
Working example
You wonder if it works? Add your own IP address in the list of addresses: 3.14.246.101!
Comment Form
ReviewManager
ReviewManager
8 Comments
@GJ
No, it does not...
Does a range of IP-addresses work too in this UDT?
F.i.: 31.130.22.138 --> 31.130.0.0/16
Fixed notice
{if empty($ipbanned) || $ipbanned != 'true'}
...
{/if}
This functionality is included in the "new" module Admin IP Lock. It's a fork of the IPLock module. You will find it here:
http://dev.cmsmadesimple.org/projects/adminiplock
We will not add the IP lock feature to CustomGS, but probably in a separate CMSMS module.
Extended IP block or allow field is added to the CustomGS module and will be shipped is next release
Not with the method described in this blog.
I'm planning to add an IP field in the CustomGS module. If the IP of the visitor is in the list or within a range in the list it will output TRUE else FALSE (or something...)
Banning IPs from a certain country is not that easy, I am afraid...
Hi Rolf,
Is it possible to blacklist IP ranges, for example ban all traffic from a particular country?
Brock