File: /var/www/vhosts/pgkdistribution.com.au/citisolar.com.au/new/scripts/contact.php
<?php
$referrer_domains = array('localhost','127.0.0.1','statewidehydraulics.com.au');
if ($_SERVER['REQUEST_METHOD']!='POST')
{
//die('GET Method not allowed in script.');
//exit;
header ("Location: ../contact-us.html");
}
if(empty($_POST) AND empty($_GET)){
die('Unable to obtain HTTP variables - Form processing failed.');
exit;
}else{
$hpv =& $_POST;
$hgv =& $_GET;
$hvv =& $_SERVER;
$hpf =& $_FILES;
}
require("class.phpmailer.php");
$mail = new phpmailer();
$mail->From = "form@statewidehydraulics.com.au";
$mail->FromName = "Website Contact Form";
//$mail->Host = "210.50.196.39";
$mail->Host = "localhost";
$mail->Mailer = "smtp";
$mail->AddAddress("sales@statewidehydraulics.com.au");
$mail->AddbCc("ben@marketingandbranding.com.au"); //will be removed on completion of sucessful test
$mail->Subject = "New Contact";
$message = "A visitor has submitted the following through the Statewide Hydraulics contact form:\n\n";
foreach($_POST as $key=>$value)
{
if(is_array($value))
{
$array_value=$_POST[$key];
$count=1;
extract($array_value);
foreach($array_value as $part_value)
{
if($count > 1){$value.=", ";}
$value.=$part_value;
$count=$count+1;
}
}
$value=stripslashes($value);
$value=nl2br($value);
if ($key != "Submit")
{
$message .= $key.": ".$value."\n";
}
}
$mail->Body = $message;
if(!$mail->Send())
{
//echo "There was an error sending the message";
header ("Location: ../error.html");
exit;
}
//echo "Message was sent successfully";
header("Location: ../thankyou.html");
exit;
?>