connectByName('trustedVendor');
$count = count($compProducts);
$sqlQry = "select * from fn_insert_trusted_vendor_list(?,?,?,?";
$j = 5;
$temp=",Array[";
$paramlist = array($fullName,$compEmail,$company,$companyURL);
for ($j=5,$i = 0; $i < $count; $i++,$j++) {
$temp = $temp."?,";
$paramlist[$j-1]=$compProducts[$i];
}
$temp = rtrim($temp,",")."]";
$sqlQry = $sqlQry.$temp.")";
$result = $dbConn->sqlExec($sqlQry,$paramlist);
//an error occured during insertion in database
if($result == '-1')
{
echo '{"error" : "true", "msg" : "Error while processing form.
Click here to return to the submission form."}';
exit();
}
if(empty($result)==true || count($result) <= 0)
{
echo '{"error" : "true", "msg" : "Error while processing form.
Click here to return to the submission form."}';
exit();
}else{
//prepare email for client
$message = file_get_contents ($emailTemplate);
$subject = 'Comodo Trusted Vendors - application received';
//prepare email for technicians
$sbj = 'Comodo Internet Security - Trusted Vendor List New customer Sign Up';
$msg = "A new customer has signed for Comodo Internet Security Trusted Vendor List - Details below";
$msg .= "\n\nName: " . $fullName;
$msg .= "\nEmail: " . $compEmail;
$msg .= "\nCompany: " . $company;
$msg .= "\nCompany Website: " . $companyURL;
$msg .= "\nProduct download URLS:\n\n";
$msg .= implode("\n", $compProducts);
if( true != sendEmail($compEmail, FROM_EMAIL_ID, $subject, $message) || true != sendEmail($to, FROM_EMAIL_ID, $sbj, $msg) )
{
echo '{"error" : "true", "msg" : "There was an error submitting your request.
Please wait a few minutes and try again."}';
}else{ echo '{"error" : "false", "msg" : ""}'; };
}
?>