- setQuery("SELECT * FROM trfstandards LEFT JOIN standards ON trfstandards.idstandards=standards.idstandards WHERE trfstandards.idtrfdetails='$idtrf'");
- $standardselectedlist->execute(); ?>
-
-
-
-
-
-
- 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 CL. 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';
- if (!empty($csmail)) {
- $mail->addAddress($csmail); // Aggiunge il destinatario solo se non è vuoto
- }
- if (!empty($csmail2)) {
- $mail->addAddress($csmail2);
- }
- if (!empty($csmail3)) {
- $mail->addAddress($csmail3);
- }
- if (!empty($csmailccn)) {
- $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 CS. 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 == '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, $csmail3);
- // 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;
- if ($_SESSION['langselect'] == 'it') {
- // Imposta il testo in italiano
- $mail->Body = "Ciao $csinchargeprev! È stato inserito un nuovo ETRF N. $trfnmbmail.
" .
- "Ragione Sociale = $companynamemail
" .
- "Descrizione articolo $descart. ";
- } else if ($_SESSION['langselect'] == 'en') {
- // Imposta il testo in inglese
- $mail->Body = "Hi $csinchargeprev! A new ETRF No. $trfnmbmail has been submitted.
-
- 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';
- if (!empty($csmail)) {
- $mail->addAddress($csmail); // Aggiunge il destinatario solo se non è vuoto
- }
- if (!empty($csmail2)) {
- $mail->addAddress($csmail2);
- }
- if (!empty($csmail3)) {
- $mail->addAddress($csmail3);
- }
- if (!empty($csmailccn)) {
- $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 == '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);
- // 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;
- if ($_SESSION['langselect'] == 'it') {
- // Imposta il testo in italiano
- $mail->Body = "Ciao $csinchargeprev! È stato inserito un nuovo ETRF N. $trfnmbmail.
" .
- "Ragione Sociale = $companynamemail
" .
- "Descrizione articolo $descart. ";
- } else if ($_SESSION['langselect'] == 'en') {
- // Imposta il testo in inglese
- $mail->Body = "Hi $csinchargeprev! A new ETRF No. $trfnmbmail has been submitted.
-
- $value) {
- $cookies .= $key . '=' . $value . '; ';
- }
-
- $ch = curl_init($url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_TIMEOUT, 15); // Timeout leggermente più lungo
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_COOKIE, $cookies); // Invia i cookie di sessione
-
- // Aggiungi gestione degli errori cURL
- $response = curl_exec($ch);
- if (curl_errno($ch)) {
- $error_msg = curl_error($ch);
- error_log("cURL error: " . $error_msg, 3, "../logfile.log"); // Sostituisci con il percorso del tuo file di log
- } else {
- // Registra la risposta per debug
- error_log("cURL response: " . $response, 3, "../logfile.log"); // Sostituisci con il percorso del tuo file di log
- }
- curl_close($ch);
- }
-
- //if ($idcertificate==1 or $idcertificate==3 or $idcertificate==4)
- //{
- //include('pdf-creation2.php'); }
- // attachment
-
- $checkpdffiles = new WA_MySQLi_RS("checkpdffiles", $cmctrfdb, 1);
- $checkpdffiles->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';
- if (!empty($csmail)) {
- $mail->addAddress($csmail); // Aggiunge il destinatario solo se non è vuoto
- }
- if (!empty($csmail2)) {
- $mail->addAddress($csmail2);
- }
- if (!empty($csmail3)) {
- $mail->addAddress($csmail3);
- }
- if (!empty($csmailccn)) {
- $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 == '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);
- // 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;
- if ($_SESSION['langselect'] == 'it') {
- // Imposta il testo in italiano
- $mail->Body = "Ciao $csinchargeprev! È stato inserito un nuovo ETRF N. $trfnmbmail.
" .
- "Ragione Sociale = $companynamemail
" .
- "Descrizione articolo $descart. ";
- } else if ($_SESSION['langselect'] == 'en') {
- // Imposta il testo in inglese
- $mail->Body = "Hi $csinchargeprev! A new ETRF No. $trfnmbmail has been submitted.