Grateful if anyone can help - vee here (I forgot my own login)
We have transferred a dental site over to our hosting. Its a php site but the company that developped it assured us it would be a direct transfer and they sent us all the files etc.
when we changed the nameservers to our hosting I am seeing message
Intercept #4 - Bye Bye SpammerForbidden - You are not authorized to view this page
Which seems to be generated by the contact form script
the site can be seen here
http://www.hallgrenclinic.com/The code in contactForm.class.php that seems to generate this is here
<?php
abstract class contactForm{
protected $error = '';
protected $success = '';
protected $isPosted = false;
protected $adminEmail = "";
protected $spamblocked = false;
protected $spammessage = NULL;
protected static $spamReportEmail = "snip";
protected static $sitename = "hallgrenclinic";
protected static $additionalEmailTo = "snip";
public function __construct(){
}
public function setEmailTo($email){
$this->adminEmail = $email;
}
public function sendEmail($subject,$content){
$headers = 'Content-Type: text/plain; charset="iso-8859-1"' ."\r\n";
$headers .= 'Content-Transfer-Encoding: 7bit ' ."\r\n";
$headers .= 'From: '.$this->adminEmail.'';
if(!mail($this->adminEmail, $subject,$content,$headers)){
$this->appendError('<p>Error Sending Message</p>');
}else{
$this->appendSuccess('<p>Message Sent</p>');
}
if(!mail(contactForm::$additionalEmailTo, "Toucan CC: Hallgren Quick Contact Submission",$content,$headers)){
$this->appendError('<p>Error Sending Message</p>');
}
}
public function setPosted($bool){
$this->isPosted = $bool;
}
public function isPosted(){
return $this->isPosted;
}
public function getPostVars(){}
public function processSubmit(){}
public function getError(){
return $this->error;
}
public function getSuccess(){
return $this->success;
}
public function appendError($error){
if(isset($error) && $error != ""){
$this->error .= $error;
}
}
public static function fullSpamBlock($authHosts = array()){
contactForm::checkUserAgent();
contactForm::checkFormPosted();
contactForm::checkAuthorisedHosts($authHosts);
contactForm::checkBadStrings($authHosts);
}
public static function checkFormPosted(){
// Make sure the form was indeed POST'ed:
// (requires your html form to use: action="post")
if(isset($REQUEST_METHOD) && $REQUEST_METHOD == "POST"){
echo ("Intercept #1 - Bye Bye Spammer");
mail(contactForm::$spamReportEmail,contactForm::$sitename, "Intercept #1 activated");
die("Forbidden - You are not authorized to view this page");
exit;
}
}
public static function checkUserAgent(){
// First, make sure the form was posted from a browser.
// For basic web-forms, we don't care about anything
// other than requests from a browser:
global $HTTP_USER_AGENT;
if(!isset($HTTP_USER_AGENT)){
echo ("Intercept #4 - Bye Bye Spammer");
mail(contactForm::$spamReportEmail,contactForm::$sitename, "Intercept #4 activated");
die("Forbidden - You are not authorized to view this page");
exit;
}
}
public static function checkAuthorisedHosts($authHosts = array()){
global $HTTP_USER_AGENT, $HTTP_REFERER;
// Where have we been posted from?
if(isset($HTTP_POST_VARS)){
$fromArray = parse_url(strtolower($HTTP_REFERER));
// Test to see if the $fromArray used www to get here.
$wwwUsed = false;
if(isset($fromArray['host'])){
$wwwUsed = strpos($fromArray['host'], "www.");
}
//echo ("From:".$wwwUsed."<br>");
// Make sure the form was posted from an approved host name.
if(!in_array(($wwwUsed === false ? $fromArray['host'] : substr(stristr($fromArray['host'], '.'), 1)), $authHosts)){
// logBadRequest();
// header("HTTP/1.0 403 Forbidden");
echo ("Intercept #2 - Bye Bye Spammer");
mail(contactForm::$spamReportEmail,contactForm::$sitename, "Intercept #2 activated");
die("Forbidden - You are not authorized to view this page");
exit;
}
}
}
public static function checkBadStrings(){
if(isset($HTTP_POST_VARS)){
$badStrings = array("Content-Type:",
"MIME-Version:",
"Content-Transfer-Encoding:",
"bcc:",
"cc:");
// Loop through each POST'ed value and test if it contains
// one of the $badStrings:
//foreach($_POST as $k => $v){
foreach($HTTP_POST_VARS as $k => $v){
foreach($badStrings as $v2){
if(strpos($v, $v2) !== false){
echo ("Intercept #3 - Bye Bye Spammer");
mail(contactForm::$spamReportEmail,contactForm::$sitename, "Intercept #3 activated");
die("Forbidden - You are not authorized to view this page");
exit;
}
}
}
}
}
public function appendSuccess( $success){
if(isset($success) && $success != ""){
$this->success .= $success;
}
}
public function isError(){
if($this->error == ''){
return false;
}else{
return true;
}
}
public function isSuccess(){
if($this->success == ''){
return false;
}else{
return true;
}
}
public function isErrorOrSuccess(){
if($this->isSuccess() || $this->isError()){
return true;
}else{
return false;
}
}
/**
This gets a completely unstyled version of the form that can be embedded or used for reference
When creating a styled form;
**/
public function getForm(){
return '<p>The getForm() function needs to be overridden</p>';
}
}
?>
Sorry its so long. The company that developped the site are now not really helping at all - they said this
"Just follow the send routine and you’ll see the essential Spammer blocking routines.
This is rudimentary PHP programming so I’m sure your development team will update this to the new server environment."
Unfortunately I have absolutely no idea what to do next (and David is skiing in Austria)
If anyone could point me in the right diection I would be really really grateful
Many thanks
vee