Action = "insert";
$InsertQuery->Table = "wheretrfstep";
$InsertQuery->bindColumn("idtrf", "i", "$idtrf", "WA_DEFAULT");
$InsertQuery->bindColumn("code", "i", "$code", "WA_DEFAULT");
$InsertQuery->saveInSession("");
$InsertQuery->execute();
$InsertGoTo = "";
$InsertQuery->redirect($InsertGoTo);
}
?>
present()->signaturecode;
if ($tokenid!=$tokensignatureon) {
header("Location: declaration.php?idtrf=$idtrf&tokenresult=ko");
} else {
// update trf details`
if (isset($_POST["formdeclaration"])) {
if ($sndrpt=='N') {
$UpdateQuery = new WA_MySQLi_Query($cmctrfdb);
$UpdateQuery->Action = "update";
$UpdateQuery->Table = "`trf-details`";
$UpdateQuery->bindColumn("signedon", "s", "$datetrf", "WA_DEFAULT");
$UpdateQuery->addFilter("idtrfdetails", "=", "i", "".($idtrf) ."");
$UpdateQuery->execute();
$UpdateGoTo = "";
if (function_exists("rel2abs")) $UpdateGoTo = $UpdateGoTo?rel2abs($UpdateGoTo,dirname(__FILE__)):"";
$UpdateQuery->redirect($UpdateGoTo);
} else {
$UpdateQuery = new WA_MySQLi_Query($cmctrfdb);
$UpdateQuery->Action = "update";
$UpdateQuery->Table = "`trf-details`";
$UpdateQuery->bindColumn("signedonsecondcert", "s", "$datetrf", "WA_DEFAULT");
$UpdateQuery->addFilter("idtrfdetails", "=", "i", "".($idtrf) ."");
$UpdateQuery->execute();
$UpdateGoTo = "";
if (function_exists("rel2abs")) $UpdateGoTo = $UpdateGoTo?rel2abs($UpdateGoTo,dirname(__FILE__)):"";
$UpdateQuery->redirect($UpdateGoTo);
}
}
?>
setQuery("SELECT * FROM `trf-details` WHERE `trf-details`.idtrfdetails='$idtrf'");
$trfnumberfinal->execute();
$idcertn=$trfnumberfinal->getColumnVal("idcertification");
$idarticletype=$trfnumberfinal->getColumnVal("idarticletype");
$appformn=$trfnumberfinal->getColumnVal("trfnumber");
$revnumb=$trfnumberfinal->getColumnVal("revtrf");
?>
getColumnVal("idcertification") ?>
setQuery("SELECT * FROM certificationtype WHERE certificationtype.idcertificationtype='$idcert'");
$certname->execute();?>
setQuery("SELECT * FROM chemicalagent ORDER BY chemicalagent.name_chemicalagent");
$chemicalagentlist->execute();
?>
TRF CIMAC
setQuery("SELECT * FROM `trf-details` WHERE `trf-details`.idtrfdetails='$idtrf'");
$checkpdffiles->execute();
$path = 'pdf';
$filename1=$checkpdffiles->getColumnVal("pdffilename");
$file1 = $path . "/" . $filename1;
if (!empty($checkpdffiles->getColumnVal("pdffilename2"))) {
$filename2=$checkpdffiles->getColumnVal("pdffilename2");
$file2 = $path . "/" . $filename2;
}
//Now include the following following files based
//on the correct file path. Third file is required only if you want to enable SMTP.
require 'phpmailer/src/Exception.php';
require 'phpmailer/src/PHPMailer.php';
require 'phpmailer/src/SMTP.php';
//mail to client
$mail = new PHPMailer(true);
try {
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = $mailhost; // Specify main and backup server
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = $mailusername; // SMTP username
$mail->Password = $mailpassword; // SMTP password
$mail->SMTPSecure = $mailmethod; // Enable encryption, 'ssl' also accepted
$mail->Port = $mailport;
$mmessage="mailtrf";
include('include/mailhtml.php');
// Email body content
$trfnmbmail=$appformn.'r'.$revnumb;
$htmlContent = $mailmessage1;
$mail->From = $fromaddresssmail;
$mail->FromName = 'CIMAC Application Form System';
$mail->addAddress($emailuser); // Add a recipient
$mail->addAttachment($file1); // Add attachments
if (!empty($checkpdffiles->getColumnVal("pdffilename2"))) {
$mail->addAttachment($file2); } // Optional name
$mail->Subject = $appformn.'r'.$revnumb;
$mail->Body = $htmlContent;
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
$mail->send();
// echo 'Message has been sent';
} catch (Exception $e) {
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}
// mail to CS
$mail = new PHPMailer(true);
try {
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = $mailhost; // Specify main and backup server
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = $mailusername; // SMTP username
$mail->Password = $mailpassword; // SMTP password
$mail->SMTPSecure = $mailmethod; // Enable encryption, 'ssl' also accepted
$mail->Port = $mailport;
$mmessage="mailtrf";
// Email body content
$htmlContent = $mailmessage1;
$mail->From = $fromaddresssmail;
$mail->FromName = 'CIMAC Application Form System';
$mail->addAddress($csmail); // Add a recipient
$mail->addAddress($csmail2);
$mail->addAddress($csmail3);
$mail->addBCC($csmailccn);
$mail->Subject = $appformn.'r'.$revnumb;;
$mail->Body = "Ciao! E' stato inserito un nuovo ETRF N. $trfnmbmail ";
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
$mail->send();
// echo 'Message has been sent';
} catch (Exception $e) {
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}
// exit();
/*
//$filename = $filepathname;
$path = 'pdf';
$file1 = $path . "/" . $filename1;
$file2 = $path . "/" . $filename2;
// Recipient
$to = $emailuser;
// Sender
$from = $fromaddresssmail;
$fromName = 'CIMAC Application Form System';
// Email subject
$subject = $appformn;
// Attachment file
$file = $file1;
$mmessage="mailtrf";
include('include/mailhtml.php');
// Email body content
$htmlContent = $mailmessage1;
// Header for sender info
$headers = "From: $fromName"." <".$from.">";
// Boundary
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
// Headers for attachment
$headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\"";
// Multipart boundary
$message = "--{$mime_boundary}\n" . "Content-Type: text/html; charset=\"UTF-8\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" . $htmlContent . "\n\n";
// Preparing attachment
if(!empty($file) > 0){
if(is_file($file)){
$message .= "--{$mime_boundary}\n";
$fp = @fopen($file,"rb");
$data = @fread($fp,filesize($file));
@fclose($fp);
$data = chunk_split(base64_encode($data));
$message .= "Content-Type: application/octet-stream; name=\"".basename($file)."\"\n" .
"Content-Description: ".basename($file)."\n" .
"Content-Disposition: attachment;\n" . " filename=\"".basename($file)."\"; size=".filesize($file).";\n" .
"Content-Transfer-Encoding: base64\n\n" . $data . "\n\n";
}
}
$message .= "--{$mime_boundary}--";
$returnpath = "-f" . $from;
// Send email
$mail = @mail($to, $subject, $message, $headers, $returnpath);
*/
}
?>