Hide forms for certain IP addresses

  Previous article Next article  

Hide website forms for certain IP addresses (partial banning)

Create a new User Defined Tag, named "form_ip_filter"

$banned_IPs = array(

$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'}
Hide guestbook form, but show recieved messages

{if empty($ipbanned)}
  {Gbook action='form'}


  Working example

You wonder if it works? Add your own IP address in the list of addresses:!

Buy Me A Coffee

  Comment Form

Click here to open the form


Buy Me A Coffee

CMS Made Simple - Tutorials, Tips and Tricks - CMSMS

Hide forms for certain IP addresses

  Article optimized for CMSMS 2.x

  Last tested in: CMSMS 2.2.15
  Last updated: 07-06-2018
  Comments: 8

Buy Me A Coffee


Ads help me to help you! Buy products from these advertisers!