Viewing file: certificateprint.php (18.67 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<div id="container"> <p> <button class="btn" onclick="generatePdf()">Download PDF</button> </p> <div id="outer"> <div id="doc-target"> <?php
$var =$_GET['ID']; $trimmed = trim($var);
$link = mysqli_connect("localhost",'itce_user','rb!itc838',"itce_data"); // Check connection if($link === false){ die("ERROR: Could not connect. " . mysqli_connect_error()); } // Attempt select query execution $sql = "select * from certificate where CertificateNo='$var' "; if($result = mysqli_query($link, $sql)) { if(mysqli_num_rows($result) > 0) { while($row = mysqli_fetch_array($result)) {
$grades=$row['grade'];
$certificate_no=$row['CertificateNo']; $enrollment=$row['enrollment'];
$certifcate_issue_date=$row['certifcate_issue_date'];
$start_date=$row['start_date']; $end_date=$row['end_date'];
$pn1 =$row['pn1']; $pn1_total_marks=$row['pn1_total_marks']; $pn1_obtained_marks=$row['pn1_obtained_marks']; $pn2 =$row['pn2']; $pn2_total_marks=$row['pn2_total_marks']; $pn2_obtained_marks=$row['pn2_obtained_marks']; $pn3 =$row['pn3']; $pn3_total_marks=$row['pn3_total_marks']; $pn3_obtained_marks=$row['pn3_obtained_marks']; $pn4 =$row['pn4']; $pn4_total_marks=$row['pn4_total_marks']; $pn4_obtained_marks=$row['pn4_obtained_marks']; $pn5 =$row['pn5']; $pn5_total_marks=$row['pn5_total_marks']; $pn5_obtained_marks=$row['pn5_obtained_marks']; $pn6 =$row['pn6']; $pn6_total_marks=$row['pn6_total_marks']; $pn6_obtained_marks=$row['pn6_obtained_marks']; $pn7 =$row['pn7']; $pn7_total_marks=$row['pn7_total_marks']; $pn7_obtained_marks=$row['pn7_obtained_marks'];
$count++ ; } // Free result set mysqli_free_result($result); } else{ } } else{ echo "ERROR: Could not able to execute $sql. " . mysqli_error($link); } $totalmarks=$pn1_total_marks+$pn2_total_marks+$pn3_total_marks+$pn4_total_marks+$pn5_total_marks+$pn6_total_marks+$pn7_total_marks+$pn8_total_marks+$pn9_total_marks+$pn10_total_marks; $otainedmarks=$pn1_obtained_marks+$pn2_obtained_marks+$pn3_obtained_marks+$pn4_obtained_marks+$pn5_obtained_marks+$pn6_obtained_marks+$pn7_obtained_marks+$pn8_obtained_marks+$pn9_obtained_marks+$pn10_obtained_marks; $percentage=round(($otainedmarks/ $totalmarks)*100); if($percentage>89) { $grade='A+'; } if($percentage<89 AND $percentage>75) { $grade='A'; } if($percentage<75 AND $percentage>66) { $grade='B'; } if($percentage<65 AND $percentage>56) { $grade='C'; } if($percentage<55 AND $percentage>50) { $grade='D'; } // Close connection mysqli_close($link); ?> <?php
$link = mysqli_connect("localhost",'itce_user','rb!itc838',"itce_data"); // Check connection if($link === false){ die("ERROR: Could not connect. " . mysqli_connect_error()); }
// Attempt select query execution $sql = "select * from admission where enrollment='$enrollment' "; if($result = mysqli_query($link, $sql)) { if(mysqli_num_rows($result) > 0) { while($row = mysqli_fetch_array($result)) {
$student_name=$row['name'];
$Enrollment=$row['enrollment']; $father_name=$row['fatherName']; $branch='INFYSYS TECHNOLOGIES COMPUTER EDUCATION (SARAIMIR, AZAMGARH, UP India)'; $course=$row['course']; $subject=$row['subject'];
$qrcod='Roll No:-'.$Enrollment."\n".'Certificate No:-'.$certificate_no."\n".'Name:-'.$student_name."\n".'Father Name:-'.$father_name."\n".'Course:-'.$course."\n".'Grade:-'.$grades."\n".'Issue Date:-'.$certifcate_issue_date;
$newqrcode="https://barcode.tec-it.com/barcode.ashx?data=".$qrcod; $studentphoto=$row['photo']; $newpohto='http://itce.co.in/data/files/'.str_replace(' ', '%20',$studentphoto); $count++ ;
} // Free result set mysqli_free_result($result); } else{ } } else{ echo "ERROR: Could not able to execute $sql. " . mysqli_error($link); } // Close connection mysqli_close($link); ?> <?php
$link = mysqli_connect("localhost",'itce_user','rb!itc838',"itce_data"); // Check connection if($link === false){ die("ERROR: Could not connect. " . mysqli_connect_error()); } // Attempt select query execution $sql = "select * from courses where course_code='$course' "; if($result = mysqli_query($link, $sql)) { if(mysqli_num_rows($result) > 0) { while($row = mysqli_fetch_array($result)) {
$course_name=$row['course_name'];
$course_content=$row['certificate_course']; $month=$row['course_duration'];
$count++ ; } // Free result set mysqli_free_result($result); } else{ } } else{ echo "ERROR: Could not able to execute $sql. " . mysqli_error($link); } // Close connection mysqli_close($link); ?>
<?php
require_once 'certificate/qrlib.php'; // Make sure to include the library
// Define temp directory for QR code images $PNG_TEMP_DIR = __DIR__ . DIRECTORY_SEPARATOR . 'temp' . DIRECTORY_SEPARATOR; $PNG_WEB_DIR = 'temp/';
// Ensure the temp directory exists if (!file_exists($PNG_TEMP_DIR)) { mkdir($PNG_TEMP_DIR, 0755, true); }
// Set default QR code settings $errorCorrectionLevel = 'L'; $matrixPointSize = 4;
// Override default settings based on request parameters if available if (isset($_REQUEST['level']) && in_array($_REQUEST['level'], ['L', 'M', 'Q', 'H'])) { $errorCorrectionLevel = $_REQUEST['level']; } if (isset($_REQUEST['size'])) { $matrixPointSize = min(max((int)$_REQUEST['size'], 1), 10); }
// Retrieve the roll number or keywords for the QR code content $rollno = isset($_GET['ID']) ? $_GET['ID'] : ''; $cert_url = "https://itce.co.in/cerificateverify.php?q=" . urlencode($rollno); $urldata = $cert_url;
// Check if data is available to encode if (!empty($urldata)) { // Generate a unique filename for the QR code image $filename = $PNG_TEMP_DIR . 'qr_' . md5($urldata . '|' . $errorCorrectionLevel . '|' . $matrixPointSize) . '.png'; // Generate the QR code and save it as an image file QRcode::png($urldata, $filename, $errorCorrectionLevel, $matrixPointSize, 2);
// Output the image directly to the browser header('Content-type: image/png'); readfile($filename); } else { // Use a default QR code if no data is provided $filename = $PNG_TEMP_DIR . 'qr_default.png'; // Fixed filename QRcode::png('PHP QR Code :)', $filename, $errorCorrectionLevel, $matrixPointSize, 2);
// Output the image directly to the browser header('Content-type: image/png'); readfile($filename); } ?>
<div id="container"> <div id="outer"> <div id="doc-target">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <!--page generated by WebAcappella--> <!-- 2023-01-09T12:20:07 ***************************--> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7;IE=EmulateIE9" /> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> <meta name="generator" content="WebAcappella 4.6.9 ecommerce (WIN) #0"/> <title></title> <meta name="keywords" content=""/> <meta name="description" content=""/>
<style type="text/css"> body{margin-left:0px;margin-top:0px;margin-right:0px;margin-bottom:0px;background-color:#ffffff;} </style> <link rel="stylesheet" type="text/css" href="wa_global_style.css"/> <script type="text/javascript" src="jquery.js?v=86c"></script> <script type="text/javascript"> var waJSQuery = jQuery.noConflict(); </script> <script type="text/javascript" src="webacappella_core.js?v=1ups"></script> <!--[if lte IE 8]><script type="text/javascript" src="excanvas.js?v=1f2a"></script> <![endif]--> <!--[if lte IE 8]><script type="text/javascript" src="webacappella_patch_ie8.js?v=tc5"></script> <![endif]--> <script type="text/javascript"> document.write("\u003cscript type='text/javascript' src='wa_site_global_settings.js?v=21xdlg2ykpn01y"+urlSuffixe(1)+"'>\u003c/script>"); </script> <script type="text/javascript" src="jquery.mousewheel.js?v=use"></script> <link href="webacappella.css?v=10nl" rel="stylesheet" type="text/css" media="all"/> <!--[if lte IE 7]> <link href="webacappella_ie.css?v=1tjn" rel="stylesheet" type="text/css" media="all"/> <![endif]--> <script type="text/javascript" src="webacappella_tools.js?v=blf"></script> <script type="text/javascript"> waJSQuery(function() { initializeWA_JQuery() }); </script> <script type="text/javascript"> var waWebFontDescription={families:[ ]} </script>
</div> </head> <body><div id='wa-dialog-container' class='wa-fullscreen-contenair' style='position:absolute;z-index:52000;'></div><div id='html-centered' style='position:relative;width:100%;z-index:200;'><div id='is-global-layer' class='wa-main-page-contenair' style='position:relative;z-index:200;top:0px;width:1000px;;text-align:left;margin:0 auto; '><div style="position:absolute;top:1px;left:0px;width:1px;height:1px;"><a name="anchor-top"> </a></div>
<img src="<?php echo $qrcodegen2 ?>?v=25euuw2yjeiduq" alt="photo" title="photo" class="wa-img wa-comp " style="position:absolute;z-index:10056;left:807px;top:140px;width:80px;height:80px;border:0px;"/>
<div style="position:absolute;z-index:10052;left:512px;top:515px;width:93px;height:28px;border:0px;background:rgba(0,0,0,0);overflow:hidden;" class="wa-comp wa-text wa-bg-gradient param[grad(rgba(0,0,0,0)) border(0 #969696)] " ><div style="position:absolute;z-index:10;line-height:1.2;margin:2px;top:0px;left:0px;width:91px;height:26px;word-wrap:break-word;overflow-y:auto;overflow-x:hidden;" ><div align="left"><span style="font-family:'Arial';font-size:13px;font-weight:BOLD;color:#000000;" ><?php echo $certifcate_issue_date ?></span></div></div></div><div style="position:absolute;z-index:10048;left:309px;top:514px;width:93px;height:28px;border:0px;background:rgba(0,0,0,0);overflow:hidden;" class="wa-comp wa-text wa-bg-gradient param[grad(rgba(0,0,0,0)) border(0 #969696)] " ><div style="position:absolute;z-index:10;line-height:1.2;margin:2px;top:0px;left:0px;width:91px;height:26px;word-wrap:break-word;overflow-y:auto;overflow-x:hidden;" ><div align="left"><span style="font-family:'Arial';font-size:13px;font-weight:BOLD;color:#000000;" ><?php echo $end_date?></span></div></div></div><div style="position:absolute;z-index:10044;left:172px;top:513px;width:93px;height:28px;border:0px;background:rgba(0,0,0,0);overflow:hidden;" class="wa-comp wa-text wa-bg-gradient param[grad(rgba(0,0,0,0)) border(0 #969696)] " ><div style="position:absolute;z-index:10;line-height:1.2;margin:2px;top:0px;left:0px;width:91px;height:26px;word-wrap:break-word;overflow-y:auto;overflow-x:hidden;" ><div align="left"><span style="font-family:'Arial';font-size:13px;font-weight:BOLD;color:#000000;" ><?php echo $start_date ?></span></div></div></div><div style="position:absolute;z-index:10040;left:520px;top:480px;width:93px;height:28px;border:0px;background:rgba(0,0,0,0);overflow:hidden;" class="wa-comp wa-text wa-bg-gradient param[grad(rgba(0,0,0,0)) border(0 #969696)] " ><div style="position:absolute;z-index:10;line-height:1.2;margin:2px;top:0px;left:0px;width:91px;height:26px;word-wrap:break-word;overflow-y:auto;overflow-x:hidden;" ><div align="left"><span style="font-family:'Arial';font-size:13px;font-weight:BOLD;color:#000000;" ><?php echo $grades ?></span></div></div></div><div style="position:absolute;z-index:10036;left:214px;top:480px;width:93px;height:28px;border:0px;background:rgba(0,0,0,0);overflow:hidden;" class="wa-comp wa-text wa-bg-gradient param[grad(rgba(0,0,0,0)) border(0 #969696)] " ><div style="position:absolute;z-index:10;line-height:1.2;margin:2px;top:0px;left:0px;width:91px;height:26px;word-wrap:break-word;overflow-y:auto;overflow-x:hidden;" ><div align="left"><span style="font-family:'Arial';font-size:13px;font-weight:BOLD;color:#000000;" ><?php echo $certificate_no ?></span></div></div></div><div style="position:absolute;z-index:10032;left:249px;top:400px;width:629px;height:80px;border:0px;background:rgba(0,0,0,0);overflow:hidden;" class="wa-comp wa-text wa-bg-gradient param[grad(rgba(0,0,0,0)) border(0 #969696)] " ><div style="position:absolute;z-index:10;line-height:1.2;margin:2px;top:0px;left:0px;width:627px;height:78px;word-wrap:break-word;overflow-y:auto;overflow-x:hidden;" ><div align="left"><span style="font-family:'Arial';font-size:13px;font-weight:BOLD;color:#000000;" ><?php echo $course_content ?></span></div></div></div><div style="position:absolute;z-index:10028;left:240px;top:366px;width:660px;height:28px;border:0px;background:rgba(0,0,0,0);overflow:hidden;" class="wa-comp wa-text wa-bg-gradient param[grad(rgba(0,0,0,0)) border(0 #969696)] " ><div style="position:absolute;z-index:10;line-height:1.2;margin:2px;top:0px;left:0px;width:658px;height:26px;word-wrap:break-word;overflow-y:auto;overflow-x:hidden;" ><div align="left"><span style="font-family:'Arial';font-size:13px;font-weight:BOLD;color:#000000;" ><?php echo $branch ?></span></div></div></div>
<div style="position:absolute;z-index:10024;left:254px;top:332px;width:550px;height:28px;border:0px;background:rgba(0,0,0,0);overflow:hidden;" class="wa-comp wa-text wa-bg-gradient param[grad(rgba(0,0,0,0)) border(0 #969696)] " ><div style="position:absolute;z-index:10;line-height:1.2;margin:2px;top:0px;left:0px;width:566px;height:26px;word-wrap:break-word;overflow-y:auto;overflow-x:hidden;" ><div align="left"><span style="font-family:'Arial';font-size:13px;font-weight:BOLD;color:#000000;" ><?php echo $course_name ?></span></div></div></div>
<div style="position:absolute;z-index:10020;left:129px;top:332px;width:520px;height:28px;border:0px;background:rgba(0,0,0,0);overflow:hidden;" class="wa-comp wa-text wa-bg-gradient param[grad(rgba(0,0,0,0)) border(0 #969696)] " >
<div style="position:absolute;z-index:10;line-height:1.2;margin:2px;top:0px;left:0px;width:69px;height:26px;word-wrap:break-word;overflow-y:auto;overflow-x:hidden;" ><div align="center"><span style="font-family:'Arial';font-size:13px;font-weight:BOLD;color:#000000;" ><?php echo $month ?></span></div></div></div><div style="position:absolute;z-index:10016;left:300px;top:298px;width:472px;height:28px;border:0px;background:rgba(0,0,0,0);overflow:hidden;" class="wa-comp wa-text wa-bg-gradient param[grad(rgba(0,0,0,0)) border(0 #969696)] " ><div style="position:absolute;z-index:10;line-height:1.2;margin:2px;top:0px;left:0px;width:470px;height:26px;word-wrap:break-word;overflow-y:auto;overflow-x:hidden;" ><div align="left"><span style="font-family:'Arial';font-size:13px;font-weight:BOLD;color:#000000;" ><?php echo $father_name ?></span></div></div></div><div style="position:absolute;z-index:10012;left:352px;top:264px;width:520px;height:28px;border:0px;background:rgba(0,0,0,0);overflow:hidden;" class="wa-comp wa-text wa-bg-gradient param[grad(rgba(0,0,0,0)) border(0 #969696)] " ><div style="position:absolute;z-index:10;line-height:1.2;margin:2px;top:0px;left:0px;width:518px;height:26px;word-wrap:break-word;overflow-y:auto;overflow-x:hidden;" ><div align="left"><span style="font-family:'Arial';font-size:13px;font-weight:bold;color:#000000;" ><?php echo $student_name ?></span></div></div></div><div style="position:absolute;z-index:10008;left:740px;top:74px;width:188px;height:20px;border:0px;background:rgba(0,0,0,0);overflow:hidden;" class="wa-comp wa-text wa-bg-gradient param[grad(rgba(0,0,0,0)) border(0 #969696)] " ><div style="position:absolute;z-index:10;line-height:1.2;margin:2px;top:0px;left:0px;width:186px;height:18px;word-wrap:break-word;overflow-y:auto;overflow-x:hidden;" ><div align="left"><span style="font-family:'Arial';font-size:13px;font-weight:BOLD;color:#000000;" ><?php echo $Enrollment ?></span></div></div></div><img src="<?php echo $newpohto ?>?v=25euuw2yjeiduq" alt="photo" title="photo" class="wa-img wa-comp " style="position:absolute;z-index:10004;left:689px;top:140px;width:82px;height:93px;border:0px solid #969696;-moz-border-radius:0px;border-radius:0px;-webkit-border-radius:0px;"/><img src="certificate/Annu_20Bhaskar.jpg?v=2sa44o2ykpn01z" alt="" class="wa-img wa-comp " style="position:absolute;z-index:10000;left:0px;top:9px;width:976px;height:691px;border:0px;"/><div style="position:absolute;top:679px;left:0px;width:1px;height:1px;" ><a name="anchor-bottom"> </a></div> <div id='dynmenu-container' style='position:absolute;z-index:51000;'></div></div> </div> <!--end html-centered--> <script type="text/javascript"> <!-- document.webaca_page_option_background=0 document.webaca_page_background_img_size=[-1,-1] document.webaca_page_is_centered=true; document.webaca_width_page=1000; document.webaca_height_page=699; document.webaca_banner_height=0; document.webaca_is_preview=false; var wa_global_market = {markets:new Array(),id_modif_dlg_js:''}; Translator.m_lang="en"; Translator.m_languages={} Translator.m_lang_for_filename=""; function wa_timeout(_fct,_time,p1,p2,p3){return setTimeout(_fct,_time,p1,p2,p3)} function wa_evaluate(_s){return eval(_s)} function IS_onload(){ IS_onload_WA(); } --> </script> <script type="text/javascript" src='wa_common_messages_en.js?v='></script> <script type="text/javascript"> <!-- WA_loadMessages(); --> </script> <script type="text/javascript"> <!-- --> </script> </body> </html>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js" integrity="sha512-BNaRQnYJYiPSqHHDb58B0yaPfCu+Wgds8Gp/gU33kqBtgNS4tSPHuGibyoeqMV/TJlSKda6FXzoEyYGjTe+vXA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script>
// https://html2canvas.hertzen.com/configuration // https://rawgit.com/MrRio/jsPDF/master/docs/module-html.html#~html // https://artskydj.github.io/jsPDF/docs/jsPDF.html window.jsPDF = window.jspdf.jsPDF; function generatePdf() { let jsPdf = new jsPDF('l', 'pt', 'A4'); var htmlElement = document.getElementById('doc-target'); // you need to load html2canvas (and dompurify if you pass a string to html) const opt = { callback: function (jsPdf) { jsPdf.save(<?php echo json_encode($keywords); ?>); // to open the generated PDF in browser window // window.open(jsPdf.output('bloburl')); }, margin: [-8, -8, 00, -155], autoPaging: 'text', html2canvas: { allowTaint: true, dpi: 300, letterRendering: true, logging: false, scale: .87 } };
jsPdf.html(htmlElement, opt); } </script>
<!-- --> </script> </body> </html>
|