Viewing file: index.php (5.12 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') $url = "https://"; else $url = "http://"; // Append the host(domain name, ip) to the URL. $url.= $_SERVER['HTTP_HOST']; // Append the requested resource location to the URL $url.= $_SERVER['REQUEST_URI']; ?> <?php include('session.php'); ?>
<?php
//set it to writable location, a place for temp generated PNG files $PNG_TEMP_DIR = dirname(__FILE__).DIRECTORY_SEPARATOR.'temp'.DIRECTORY_SEPARATOR; //html PNG location prefix $PNG_WEB_DIR = 'temp/';
include "qrlib.php"; //ofcourse we need rights to create temp dir if (!file_exists($PNG_TEMP_DIR)) mkdir($PNG_TEMP_DIR); $filename = $PNG_TEMP_DIR.'test.png'; //processing form input //remember to sanitize user input in real-life solution !!! $errorCorrectionLevel = 'L'; if (isset($_REQUEST['level']) && in_array($_REQUEST['level'], array('L','M','Q','H'))) $errorCorrectionLevel = $_REQUEST['level'];
$matrixPointSize = 4; if (isset($_REQUEST['size'])) $matrixPointSize = min(max((int)$_REQUEST['size'], 1), 10); $urldata=$url;
if (strlen($urldata)>1) { //it's very important! if (trim($urldata) == '') die('data cannot be empty! <a href="?">back</a>'); // user data $filename = $PNG_TEMP_DIR.'test'.md5($urldata.'|'.$errorCorrectionLevel.'|'.$matrixPointSize).'.png'; QRcode::png($urldata, $filename, $errorCorrectionLevel, $matrixPointSize, 2); } else { //default data echo 'You can provide data in GET parameter: <a href="?data=like_that">like that</a><hr/>'; QRcode::png('PHP QR Code :)', $filename, $errorCorrectionLevel, $matrixPointSize, 4); } //display generated file $qrcodegen='<img src="'.$PNG_WEB_DIR.basename($filename).'" /><hr/>'; ?> <?php $urlvar = $_GET['ID']; $link = mysqli_connect("localhost", "pcclasses_user", "rb!pcc838", "pcclasses_data"); // Check connection if($link === false){ die("ERROR: Could not connect. " . mysqli_connect_error()); } $field = 'certificate_no'; // Attempt select query execution $sql = "SELECT * FROM certificate where certificate_no='$urlvar' order by ID "; if($result = mysqli_query($link, $sql)){ if(mysqli_num_rows($result) > 0){
$serial=0;
while($row = mysqli_fetch_array($result)){ $image="<img border='1' width='150' height='150' src=http://pcclasses.in/branch/upload/".$row['photo'].">"; $certificate_no= $row['certificate_no']; $rollno= $row['roll_no']; $studentname=$row['student_name']; $fathers_name=$row['fathers_name']; $roll_no=$row['roll_no']; $address=$row['address']; $course_name=$row['course_name'];
$total_marks=$row['total_marks']; $obtained_marks=$row['obtained_marks']; $grade=$row['grade']; $serial=$serial+1;
echo "<p class=\"auto-style1\">Purushottam Computer Classes </p>\n"; echo "<p class=\"auto-style2\"><a href=\"http://www.pcclasses.in\">www.pcclasses.in</a> \n"; echo "</p>\n"; echo "<p class=\"auto-style2\">Certificate Verification</p>\n"; echo "<table style=\"width: 100%\">\n"; echo " <tr>\n"; echo " <td style=\"width: 225px\">Certificate No</td>\n"; echo " <td style=\"width: 438px\">$certificate_no</td>\n"; echo " <td rowspan=\"8\" align='left'>$image.$qrcodegen
</td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td style=\"width: 225px; height: 23px\">Student Name</td>\n"; echo " <td style=\"height: 23px; width: 438px\">$studentname</td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td style=\"width: 225px; height: 23px\">Father Name</td>\n"; echo " <td style=\"height: 23px; width: 438px\">$fathers_name</td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td style=\"width: 225px; height: 23px\">Roll No</td>\n"; echo " <td style=\"height: 23px; width: 438px\">$roll_no</td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td style=\"width: 225px\">Address</td>\n"; echo " <td style=\"width: 438px\">$address</td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td style=\"width: 225px; height: 23px\">Course Name</td>\n"; echo " <td style=\"height: 23px; width: 438px\">$course_name</td>\n"; echo " </tr>\n";
echo " <tr>\n"; echo " <td style=\"width: 225px\">Total Marks</td>\n"; echo " <td style=\"width: 438px\">$total_marks</td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td style=\"width: 225px\">Obtained Marks</td>\n"; echo " <td style=\"width: 438px\">$obtained_marks</td>\n"; echo " <td> </td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td style=\"width: 225px\">Grade</td>\n"; echo " <td style=\"width: 438px\">$grade</td>\n"; echo " <td> </td>\n"; echo " </tr>\n"; echo "</table>\n";
$count++ ; }
echo "</table>\n"; // Free result set mysqli_free_result($result); } else{ echo "Certificate Number Incorrect."; } } else{ echo "ERROR: Could not able to execute $sql. " . mysqli_error($link); } // Close connection mysqli_close($link); ?>
|