Developer Support »

Referrer-logging error

This error: "You must enable referrer logging to use the form", will be seen in the following circumstances.

A user (visitor to your website) will get this error if they have disabled referrer logging in their browser. If you are testing the script and you are getting this error, then you will have this disabled in the browser you are using to test with. Simply enabling referrer logging in your browser will prevent this error. It should be noted that although you might be getting the error, visitors to your site might not. This is down to their individual browser settings. To change this setting you must consult the documentation for your browser. I believe that the popular browsers enable this by default, so it shouldn't be a problem for most visitors.

Checking for a referrer (referer) header is a security precaution. It means that the script will only accept input from your own website (or a source claiming to be from your site). It is just one of a number of checks that are made to prevent abuse.

You will also get the error if you simply call up the script in your browser without submitting a form to it. In this case this is expected behaviour.

You can disable this check in the script. In the pro version of the script (FormToEmail-Pro) it is part of the configuration options and can simply be toggled on or off. To change it, edit the script, following the instructions in the script, then save the script and upload it to your webspace.

To disable the check in the free version of the script (FormToEmail) you need to "comment out" a line in the script, as follows:

Open the script in a text editor and locate this line:

if(!(isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER']) && stristr($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST']))){$errors[] = "You must enable referrer logging to use the form";}

Precede the line with two forward slashes, thus:

//if(!(isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER']) && stristr($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST']))){$errors[] = "You must enable referrer logging to use the form";}

This changes the line into a comment and is ignored when the script is executed. Deleting the line has the same effect. Save the script and upload it to your webspace.

Please note. The line shown above is one line of code. Due to word wrap it might appear as more than one line but you should only need to add the two forward slashes at the start of the line.