How to Block other domain name to access my PHP formmail script?
I want to block somebody’s domain name from accessing my php formmail script? Is there a simple way to do it? Can it be done through .htaccess simply? If so, how? thanks
What I meant was how to block somebody’s website from using my PHP formmail script?
August 21, 2010 | Filed Under Scripts FAQs
Comments
2 Responses to “How to Block other domain name to access my PHP formmail script?”
Powered by Yahoo! Answers
If you have a paid hosting site, then log into your Control Panel and look for the Domain Blocking utility. Just enter the IP address and it will write to the .htaccess file for you. Couldn’t be easier.
Ron
If I understand you correctly, people are creating a html form on their website that submits to your processing script to send the email.
If so, add a check such as
if($_SERVER['HTTP_HOST'] == "yourdomain.com")
// execute script
else
// print error saying they can’t submit from another domain
You can also try dynamic html field name variables.. ie. when the html form loads, generate.. say… a 10 character name for the field, save it to a session, and when it submits load the session variables for the appropriate fields. This will prevent them from being able to submit from any form other then the one you have on your website (this is usefully as well in preventing certain type of form hijacking used to send spam email).