<?php
include('../../includes/config.php');
error_reporting(0);

$q = $_GET['searchid'] ?? '';
$searchid = mysqli_real_escape_string($tng_conn, $q);

$stmt = mysqli_prepare($tng_conn, "SELECT * FROM panauto WHERE id=?");
mysqli_stmt_bind_param($stmt, "s", $searchid);
mysqli_stmt_execute($stmt);
$res = mysqli_stmt_get_result($stmt);
$b = mysqli_fetch_assoc($res);


$a1 = strtoupper($b['name']);
$a2 = strtoupper($b['fathername']);
$a3 = strtoupper($b['panno']);
$a4 = $b['gender'];
$a5 = str_replace('-', '/', $b['dob']);
$img = $b['image'];
$sign = $b['signimage'];

$qr = 'https://api.qrserver.com/v1/create-qr-code/?cht=qr&data='
    . urlencode('<?xml version="1.0" encoding="UTF-8"?><PrintLetterBarcodeData uid='.$a3.' name='.$a1.' dob='.$b['dob'].' co='.$a1.'/>&chld=L|0&chf=bg,s,FFFFFF00');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Pan Card Preview</title>
<link href="https://fonts.googleapis.com/css?family=Hind" rel="stylesheet">
<link href="pan.css" rel="stylesheet">
<style>
.bg{background:url('pan.jpg') no-repeat;width:800px;height:1200px;overflow:visible;display:block;background-size:100% auto;}
img.mrmins.mrninbigs{top:924px;position:absolute;left:302px;width:91px;}
img.mrminss.mrninbigss{position:absolute;top:505px;width:159px;left:459px;}
.cimg{top:923px;position:absolute;left:102px;}
.mainno{top:935px;position:absolute;left:194px;font-weight:700;font-size:14px;}
.name{top:982px;position:absolute;left:105px;font-weight:600;font-size:9px;}
.mainno2{position:absolute;top:181px;left:347px;font-size:19px;font-weight:600;}
.signs{position:absolute;top:556px;left:250px;}
.names{position:absolute;top:249px;left:253px;font-size:15px;font-weight:500;}
.fathername{top:1009px;position:absolute;left:106px;font-weight:600;font-size:9px;}
.cimgs{position:absolute;top:525px;left:66px;}
.fathernames{position:absolute;top:314px;left:253px;font-size:15px;font-weight:500;}
.gender{position:absolute;top:443px;left:253px;font-size:15px;font-weight:500;}
.bod{top:1043px;position:absolute;left:105px;font-weight:600;font-size:9px;}
.bods{position:absolute;top:379px;left:253px;font-size:15px;font-weight:500;}
.sign{top:1035px;position:absolute;left:189px;}
.settext{position:absolute;font-size:9px;top:568px;left:631px;font-weight:bold;}
</style>
</head>
<body>
<main class="bg"> 
<img class="mrmins mrninbigs" src="<?php echo $qr; ?>&ecLevel=H&margin=5&size=5=&chld=L|0&chf=bg,s,FFFFFF00">
<img class="mrminss mrninbigss" src="<?php echo $qr; ?>&ecLevel=H&margin=5&size=5=&chld=L|0&chf=bg,s,FFFFFF00">
<img class="cimg" src="<?php echo $img; ?>" width="58px" height="56px">
<img class="cimgs" src="<?php echo $img; ?>" width="130px" height="130px">
<p class="mainno2"><?php echo $a3; ?></p>
<p class="mainno"><?php echo $a3; ?></p>
<p class="name"><?php echo $a1; ?></p>
<p class="names"><?php echo $a1; ?></p>
<p class="fathername"><?php echo $a2; ?></p>
<p class="fathernames"><?php echo $a2; ?></p>
<p class="gender"><?php echo $a4; ?></p>
<p class="bod"><?php echo $a5; ?></p>
<p class="bods"><?php echo $a5; ?></p>
<img class="sign" src="<?php echo $sign; ?>" width="90px" height="20px">
<img class="signs" src="<?php echo $sign; ?>" width="190px" height="50px">
<p class="settext">
Date: 2019.12.17 22:37:21 IST <br>
Reason : NSDL ePAN Sign <br>
Location : Mumbai
</p>
</main>
</body>
</html>
