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"); $ntrfmail=$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 <?php echo $ownercompanyname;?>

100%
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'; if ($adminconfirm=='N') { // $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'; if ($adminconfirm=='N') { // $mail->send(); } // echo 'Message has been sent'; } catch (Exception $e) { echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}"; } // mail REV to CS // if rev is > 0 if ($revnumb>0) { //query to see the previous CS in charge $revnumberprev = $revnumb - 1; $trfprevrev = new WA_MySQLi_RS("trfprevrev", $cmctrfdb, 1); $trfprevrev->setQuery("SELECT * FROM `trf-details` LEFT JOIN company ON `trf-details`.idcompany=company.idcompany WHERE `trf-details`.trfnumber='$ntrfmail' AND `trf-details`.revtrf='$revnumberprev'"); $trfprevrev->execute(); $csinchargeprev = $trfprevrev->getColumnVal("csincharge"); if ($csinchargeprev == 'ddondena') { $mailincharge = 'd.dondena@cimac.it'; } elseif ($csinchargeprev == 'lgerlotti') { $mailincharge = 'l.gerlotti@cimac.it'; } elseif ($csinchargeprev == 'cboscaino') { $mailincharge = 'c.boscaino@cimac.it'; } elseif ($csinchargeprev == 'solocla') { $mailincharge = 'info@acscreativesolutions.com'; } else { $mailincharge = 'd.dondena@cimac.it'; } // Define array with all CS mails $csmailall = array($csmail, $csmail2, $csmail3, 'info@acscreativesolutions.com'); // Extract the recipient that matches $mailincharge $recipientTo = $mailincharge; $recipientsCC = array_diff($csmailall, array($recipientTo)); $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($recipientTo); // Add the recipient in "To" field foreach ($recipientsCC as $ccRecipient) { $mail->addCC($ccRecipient); // Add recipients in "CC" field } $companynamemail=$trfprevrev->getColumnVal("companyname_company"); $descart=$trfprevrev->getColumnVal("sample_description"); $mail->Subject = $appformn . 'r' . $revnumb; $mail->Body = "Ciao $csinchargeprev!
E' stato inserito un nuovo ETRF N. $trfnmbmail.

" . "Ragione Sociale = $companynamemail

" . "Descrizione articolo $descart.
"; $mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; if ($adminconfirm=='N') { // $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); */ //} ?>