Glen_S Posted April 24, 2008 Share Posted April 24, 2008 I am not a coder, so please bear with me. I have used this program called web form designer to create a few forms now, all of them using their sample php script that I modified for my own use (as per their tutorial). Here is the problem, and I have just noticed it when someone pointed out that they are getting errors trying to use the email form and I could not figure out why as it worked fine for me. What happened is, when I registered my domain I did not bother to reigister it with the www prefix, just mydomain.com. The trouble is, when someone types a www.mydomain.com it takes them to my page ok, then if they go to the contact me page and fill out the email form, the referring url does not match the current www url, and I get this error: ERROR: You do not have permission to use this script from another URL. Referer: www.mydomain.com This URL: mydomain.com I have this form on a few sites now, so I am eager to know how I can fix this and still make sure the email is coming from my page. I was thinking I could delete the code that checks for the referring url, but I'd sooner not just do this. This is the code in the script that runs when someone presses submit: // Get the URL of this page $this_url = strtolower($_SERVER['HTTP_HOST']); // If the referring URL and the URL of this page don't match then // display a message and don't do download or send the email. if ($referer != $this_url) { echo "ERROR: You do not have permission to use this script from another URL. \n"; echo "Referer: " .$referer . "\n"; echo "This URL: " .$this_url. "\n"; exit; } Like I said, I do not know php well enough to do this, is there a way to modify this so I can still ensure my emails are coming from my page, but avoid the error when someone uses the www prefix? thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/102653-urgent-help-needed-with-php-form-to-email-script/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.