_err;
MyFormCheck::check_email($email);
$err .= $MyFormCheck->_err;
if($err == ''){
include "lphp.php";
$mylphp=new lphp;
# constants
$myorder["host"] = "secure.linkpt.net";
$myorder["port"] = "1129";
$myorder["keyfile"] = realpath("1215520.pem"); # Change this to the name and location of your certificate file
$myorder["configfile"] = "1215520"; # Change this to your store number
# transaction details
$myorder["ordertype"] = "SALE";
$myorder["result"] = "LIVE";
//$myorder["cbin"] = "true";
//$myorder["xml_output"] = "true";
$myorder["cpath"] = "/usr/bin/curl";
$myorder["chargetotal"] = $_POST["chargetotal"];
# card info
$myorder["cardnumber"] = $_POST["cardnumber"];
$myorder["cardexpmonth"] = $_POST["cardexpmonth"];
$myorder["cardexpyear"] = $_POST["cardexpyear"];
$myorder["cvmindicator"] = "provided";
$myorder["cvmvalue"] = $_POST["cvmvalue"];
# BILLING INFO
$myorder["name"] = htmlspecialchars($_POST["name"]);
$myorder["company"] = htmlspecialchars($_POST["company"]);
$myorder["address1"] = htmlspecialchars($_POST["address1"]);
$myorder["address2"] = htmlspecialchars($_POST["address2"]);
$myorder["city"] = htmlspecialchars($_POST["city"]);
$myorder["state"] = htmlspecialchars($_POST["state"]);
$myorder["country"] = "US";
$myorder["phone"] = htmlspecialchars($_POST["Telephone"]);
$myorder["fax"] = htmlspecialchars($_POST["fax"]);
$myorder["email"] = htmlspecialchars($_POST["email"]);
$myorder["addrnum"] = htmlspecialchars($_POST["addrnum"]);
$myorder["zip"] = htmlspecialchars($_POST["zip"]);
# SHIPPING INFO
$myorder["sname"] = htmlspecialchars($_POST["sname"]);
$myorder["saddress1"] = htmlspecialchars($_POST["saddress1"]);
$myorder["saddress2"] = htmlspecialchars($_POST["saddress2"]);
$myorder["scity"] = htmlspecialchars($_POST["scity"]);
$myorder["sstate"] = htmlspecialchars($_POST["sstate"]);
$myorder["szip"] = htmlspecialchars($_POST["szip"]);
$myorder["scountry"] = "US";
# MISC
$myorder["comments"] = htmlspecialchars($_POST["comments"]);
$myorder["referred"] = "Insurance Carrier: ".htmlspecialchars($_POST["Carrier"]).", Policy Number: ".htmlspecialchars($_POST["Policy_Number"]);
# Send transaction. Use one of two possible methods
// $result = $mylphp->process($myorder); # use shared library model
$result = $mylphp->curl_process($myorder); # use curl methods
if ($result["r_approved"] != "APPROVED") // transaction failed, print the reason
{
if ($result["r_approved"] != "APPROVED" && strstr($result['r_error'], 'D:Declined'))
{
$err .= 'Your credit card was declined. Please try another card or contact your bank for more info.';
}
elseif ($result["r_approved"] != "APPROVED" && strstr($result['r_error'], 'R:Referral'))
{
$err .= 'Your credit card was declined. Please try another card or contact your bank for more info.';
}
elseif ($result["r_approved"] != "APPROVED" && strstr($result['r_error'], 'Duplicate transaction'))
{
$err .= 'It appears you submitted your order more than once. If it was previously declined please wait 10 minutes.';
}
elseif ($result["r_approved"] != "APPROVED" && strstr($result['r_error'], 'SGS'))
{
$err .= $result["r_error"];
}
elseif ($result["r_approved"] != "APPROVED" )
{
$err .= $result["r_error"];
$err .= 'There has been an error processing you credit card, please wait 10 minutes before trying again.';
}
$logy = "./linkpoint.out";
foreach ($result as $key1 => $value1)
{
$erry .= "\n\t".$key1.":\t".$value1." ";
}
if ( $fp1y = @fopen($logy,'a') )
{
fwrite($fp1y, sprintf("\r\n%s", $erry));
fclose($fp1y);
}
}
else // success
{
if ($result["r_approved"] == "APPROVED") // transaction failed, print the reason
{
$t=time();
$d = date("F d, Y");
$from_email = "payment@insureusa.com";
$subject = "InsureUSA Insurance Payment Confirmation";
$message = implode('', file("receipt.html"));
$message = str_replace("[DATE]",$d,$message);
$message = str_replace("[sname]",$_POST['sname'],$message);
$message = str_replace("[saddress1]",$_POST['saddress1'],$message);
$message = str_replace("[saddress2]",$_POST['saddress2'],$message);
$message = str_replace("[scity]",$_POST['scity'],$message);
$message = str_replace("[szip]",$_POST['szip'],$message);
$message = str_replace("[sstate]",$_POST['sstate'],$message);
$message = str_replace("[Carrier]",$_POST['Carrier'],$message);
$message = str_replace("[Policy_Number]",$_POST['Policy_Number'],$message);
$message = str_replace("[chargetotal]",$_POST['chargetotal'],$message);
$message = str_replace("[Telephone]",$_POST['Telephone'],$message);
$message = str_replace("[email]",$_POST['email'],$message);
$message = str_replace("[comments]",$_POST['comments'],$message);
/****** Mail to Customer ***********/
MyMail::my_send_mail( $_POST['email'], $subject, $message, $from_email, "InsureUSA.com");
$err .= $MyMail->_err;
/****** Mail to Admin ***********/
$subject = "InsureUSA Website CC Payment";
$from_email = "payment@insureusa.com";
MyMail::my_send_mail( $from_email, $subject, $message, $_POST['email'], "InsureUSA.com");
$err .= $MyMail->_err;
$_SESSION['customer_email'] = $_POST['email'];
header("Location:secure-form-thanks.htm");
exit();
}
else
{
$err .= "Payment is not approved. It is decliend by yourpay.";
}
}// end if ($result["r_approved"] != "APPROVED")
}
}
?>
Credit Card Secure Payment Form
Our secure server
encrypts your information, ensuring that your
credit card data stays private and protected.
If your policy was already cancelled, your
credit card payment will not automatically reinstate
your policy.
Once you complete this form, and submit your payment information to our secure server, we will send you an email confirmation receipt to the email address you indicate below.