<?php
require_once("../config/session.php");
require_once("../config/function.php");
$site_data = site_data();

if(isset($_SESSION["is_login"]) && isset($_SESSION["login_token"])){
if($_SESSION["is_login"]==true && !empty($_SESSION["login_token"])){
$user_data = user_data($_SESSION["login_token"]);
if(empty($user_data['user_id'])){
redirect("logout",0);
die; 
}
}else{
redirect("logout",0);
die;  
}
}else{
redirect("logout",0);
die;  
}
?>
<!DOCTYPE html>
  <head>
    <meta charset="utf-8">
    <title>Certificate</title>
    <meta name="author" content="RECHPAY INFOTECH">
    <link rel="icon" href="<?=$site_data['logo']?>" type="image/*" sizes="16x16">
    <link rel="stylesheet" href="../layouts/members/assets/stylesheets/certificate.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.5/jspdf.min.js"></script>
<div class="toolbar no-print">
    <button class="btn btn-info hand" onclick="window.print()">
        Print Certificate
    </button>
    <button class="btn btn-info hand" id="downloadPDF">Download PDF</button>
    <input type="hidden" id="file-name" value="<?=$user_data['username']?>-Certificate">
</div>
<div class="cert-container print-m-0">
    <div id="content2" class="cert">
        <img src="../layouts/members/assets/images/certificate-new.png" class="cert-bg" alt="" />
        <div class="cert-content">
            <h1 class="other-font">Certificate of Authorization</h1>
            <span style="font-size: 30px;">This is to certify that</span>
            <br/>
            <br/>
            <br/>
            <br/>
            <span class="other-font">
                <i><b>has completed the</b></i>
            </span>
            <br/>
            <span style="font-size: 40px;"><b><?=$user_data['name']?></b></span>
            <br/>
            <small>(For <?=$user_data['usertype']?>)</small>
            <br/>
            <br/>
            <br/>
            <br/>
            <small><?=strtoupper($user_data['address'])?>, <?=getSateName($user_data['state'])?> - <?=$user_data['pin']?></small>
            <br/>
            <br/>
            <div class="bottom-txt">
                <span>Certificate Issued By<br><?=$site_data['brand']?></span>
                <span>Issued Date<br><?=date("d-M-Y",strtotime($user_data['created_at']))?></span>
            </div>
        </div>
    </div>
</div>
<script src="../layouts/members/assets/javascript/certificate.js"></script>
</body>
</html>