Forum Moderators: coopster
I am struggling to implement Jack's Formmail script on a clients server. there is a shared IP which for security reasons will not respond to a ping request and even when entered into the script shows as invalid.
The scripting portions (default code) are shown below:
******************************************
// referers.. domains/ips that you will allow forms to
// reside on.
$referers = array ('example.com','www.example.com','121.0.0.111');
// function to check the referer for security reasons.
// contributed by some one who's name got lost.. Thanks
// goes out to him any way.
function check_referer($referers) {
if (count($referers)) {
$found = false;
$temp = explode("/",getenv("HTTP_REFERER"));
$referer = $temp[2];
if ($referer=="") {$referer = $_SERVER['HTTP_REFERER'];
list($remove,$stuff)=split('//',$referer,2);
list($home,$stuff)=split('/',$stuff,2);
$referer = $home;
}
for ($x=0; $x < count($referers); $x++) {
if (eregi ($referers[$x], $referer)) {
$found = true;
}
}
if ($referer =="")
$found = false;
if (!$found){
print_error("You are coming from an <b>unauthorized domain.</b>");
error_log("[FormMail.php] Illegal Referer. (".getenv("HTTP_REFERER").")", 0);
}
return $found;
} else {
return true; // not a good idea, if empty, it will allow it.
}
}
if ($referers)
check_referer($referers);
**************************
I have commented out the above code and tried deleting it but am still getting the Error message:
**************************
"The form was not submitted for the following reasons:
You are coming from an unauthorized domain.
Please use your browser's back button to return to the form and try again.
This form is powered by Jack's Formmail.php 5.0"
**************************
Any suggestions woud be greatly appreciated - hopefully I am doing something really dumb.
[edited by: dreamcatcher at 9:49 pm (utc) on Mar. 17, 2007]
[edit reason] Use example.com, thanks. [/edit]