start copy from cimac web
This commit is contained in:
@@ -0,0 +1,200 @@
|
||||
|
||||
<?php
|
||||
include('include/headscript.php'); ?>
|
||||
<?php
|
||||
// pickup the get variable
|
||||
if (isset($_POST["idtrf"])) {
|
||||
$idtrf=$_POST["idtrf"]; }
|
||||
if (isset($_GET["idtrf"])) {
|
||||
$idtrf=$_GET["idtrf"]; }
|
||||
if (isset($_POST["tokensignatureon"])) {
|
||||
$tokensignatureon=$_POST["tokensignatureon"]; }
|
||||
if (isset($_POST["clientname"])) {
|
||||
$clientname=$_POST["clientname"]; }
|
||||
if (isset($_POST["datetrf"])) {
|
||||
$datetrf=$_POST["datetrf"]; }
|
||||
if (isset($_POST["sndrpt"])) {
|
||||
$sndrpt=$_POST["sndrpt"]; } else { $sndrpt="N"; }
|
||||
|
||||
if (isset($_GET["codestep"])) {
|
||||
$code=$_GET["codestep"];
|
||||
|
||||
$InsertQuery = new WA_MySQLi_Query($cmctrfdb);
|
||||
$InsertQuery->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);
|
||||
}
|
||||
|
||||
?>
|
||||
<?php
|
||||
$tokenid=$user->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);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<?php
|
||||
$trfnumberfinal = new WA_MySQLi_RS("trfnumberfinal",$cmctrfdb,1);
|
||||
$trfnumberfinal->setQuery("SELECT * FROM `trf-details` WHERE `trf-details`.idtrfdetails='$idtrf'");
|
||||
$trfnumberfinal->execute();
|
||||
$idcertn=$trfnumberfinal->getColumnVal("idcertification");
|
||||
$idarticletype=$trfnumberfinal->getColumnVal("idarticletype");
|
||||
$appformn=$trfnumberfinal->getColumnVal("trfnumber");
|
||||
?>
|
||||
<?php $idcert=$trfnumberfinal->getColumnVal("idcertification") ?>
|
||||
<?php
|
||||
$certname = new WA_MySQLi_RS("certname",$cmctrfdb,1);
|
||||
$certname->setQuery("SELECT * FROM certificationtype WHERE certificationtype.idcertificationtype='$idcert'");
|
||||
$certname->execute();?>
|
||||
<?php
|
||||
$chemicalagentlist = new WA_MySQLi_RS("chemicalagentlist",$cmctrfdb,0);
|
||||
$chemicalagentlist->setQuery("SELECT * FROM chemicalagent ORDER BY chemicalagent.name_chemicalagent");
|
||||
$chemicalagentlist->execute();
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<button class="btn btn-primary">
|
||||
<span class="spinner-border spinner-border-sm"></span>
|
||||
Loading..
|
||||
</button><?php sleep('10'); ?>
|
||||
|
||||
<!-- card for optional TRF -->
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- jQuery -->
|
||||
<script src="assets/js/jquery.min.js"></script>
|
||||
<script src="assets/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="assets/js/metismenu.min.js"></script>
|
||||
<script src="assets/js/waves.js"></script>
|
||||
<script src="assets/js/feather.min.js"></script>
|
||||
<script src="assets/js/jquery.slimscroll.min.js"></script>
|
||||
<script src="assets/js/jquery-ui.min.js"></script>
|
||||
|
||||
<script src="../plugins/jquery-steps/jquery.steps.min.js"></script>
|
||||
<script src="assets/pages/jquery.form-wizard.init.js"></script>
|
||||
|
||||
<!-- App js -->
|
||||
<script src="assets/js/app.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
<?php //pdf creation
|
||||
include('pdf-creation.php');
|
||||
|
||||
|
||||
// attachment
|
||||
$filename = $filepathname;
|
||||
$path = 'pdf';
|
||||
$file = $path . "/" . $filename;
|
||||
|
||||
// Recipient
|
||||
$to = $emailuser;
|
||||
|
||||
// Sender
|
||||
$from = $fromaddresssmail;
|
||||
$fromName = 'CIMAC Application Form System';
|
||||
|
||||
// Email subject
|
||||
$subject = $appformn;
|
||||
|
||||
// Attachment file
|
||||
$file = $file;
|
||||
$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);
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
header( 'Location: thanks.phps' ) ;
|
||||
?>
|
||||
Reference in New Issue
Block a user