• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: block IP addresses from using the form

block IP addresses from using the form 16 years 1 day ago #7689

  • Coldice
  • Coldice's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 8
I can confirm this working.
Use this: www.rsjoomla.com/customer-support/forum.html#7692
Last Edit: 16 years 1 day ago by Coldice.
The administrator has disabled public write access.

Re:block IP addresses from using the form 16 years 1 day ago #7692

  • bogdan
  • bogdan's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 122
  • Thank you received: 4
Hello ,

You can use this code for email restriction , placed in the Script called on form process :
global $mainframe;
if(isset($_POST['form']['email']))
{
$bad = array('email1@domain.com','email2@domain.com');
if(in_array($_POST['form']['email'],$bad)) $mainframe->redirect('index.php?option=com_rsform&formId=YOURID','error message');
}

Also you can do the ip restriction without altering the source code with a script placed in the Script called on form display :
global $mainframe;
$bad = array('127.0.0.1','12.12.12.12');
if(in_array($_SERVER['REMOTE_ADDR'],$bad))
$mainframe->redirect('index.php','you cannot view this form');
Please note: my help is not official customer support. To receive your support, submit a ticket by clicking here

RSJoomla! Development Team
The administrator has disabled public write access.

Re:block IP addresses from using the form 16 years 1 day ago #7693

  • Coldice
  • Coldice's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 8
Thx!
By why is not the error message working? It's just redirect me to index.php
The administrator has disabled public write access.

Re:block IP addresses from using the form 16 years 21 hours ago #7701

  • bogdanc
  • bogdanc's Avatar
  • OFFLINE
  • Moderator
  • Posts: 669
  • Thank you received: 11
Hello,

I have tested the script on my computer and it redirects you to the Main Page (index.php). You can change "index.php" to any page you want.

Regards!
The administrator has disabled public write access.

Re:block IP addresses from using the form 16 years 18 hours ago #7710

  • Coldice
  • Coldice's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 8
$mainframe->redirect('index.php','you cannot view this form');
It's just redirects me to index.php but I want an error message for the blocked IP's.

How? I don't have a login box for normal users. Just you know.
The administrator has disabled public write access.

Re:block IP addresses from using the form 12 years 11 months ago #18119

  • miriamh
  • miriamh's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
hallo bogdan

Where exactly can I find the script "on form display"? How is the RSForm Pro file called and where is it located?
I have to block only 1 IP which has been spamming my forms.
Joomla 1.6 / RSForm Pro 1.4
The administrator has disabled public write access.

Re:block IP addresses from using the form 12 years 11 months ago #18121

  • miriamh
  • miriamh's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
Now I found it: Form properties >PHP Scripts, top field ... Thanks anyway!
The administrator has disabled public write access.

Re:block IP addresses from using the form 12 years 2 months ago #22286

  • info9023
  • info9023's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
bogdan wrote:
Hello ,

Also you can do the ip restriction without altering the source code with a script placed in the Script called on form display :
global $mainframe;
$bad = array('127.0.0.1','12.12.12.12');
if(in_array($_SERVER['REMOTE_ADDR'],$bad))
$mainframe->redirect('index.php','you cannot view this form');

This doesn't work on my forms. I have Joomla 2.5.9 and RSform pro 1.4.0 Rev 46. It says:

[code}Fatal error: Call to a member function triggerEvent() on a non-object in /www/.../administrator/components/com_rsform/helpers/rsform.php on line 1848[/code]
The administrator has disabled public write access.

Re:block IP addresses from using the form 12 years 2 months ago #22287

  • octavian
  • octavian's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 783
  • Thank you received: 110
That's because you should be using:
$mainframe = JFactory::getApplication();

instead of:
global $mainframe;

The Joomla! framework has changed since 3 years ago.
Please note: my help is not official customer support. To receive your support, submit a ticket by clicking here
Regards,
RSJoomla! Development Team
Last Edit: 12 years 2 months ago by octavian.
The administrator has disabled public write access.
The following user(s) said Thank You: info9023
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!