<?php    
    
	//include ("/conex.php");

	$chasis = $_GET['itemdai'];
	$color = $_GET['d'];
	$marca = $_GET['m'];
	
    //echo "<h3> LATKIC S.A.</h3>";
    
    //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 = 6;
    if (isset($_REQUEST['size']))
        $matrixPointSize = min(max((int)$_REQUEST['size'], 1), 10);


    if (isset($_REQUEST['data'])) { 
    
        //it's very important!
        if (trim($_REQUEST['data']) == '')
            die('data cannot be empty! <a href="?">back</a>');
            
        // user data
        $filename = $PNG_TEMP_DIR.'test'.md5($_REQUEST['data'].'|'.$errorCorrectionLevel.'|'.$matrixPointSize).'.png';
        QRcode::png($_REQUEST['data'], $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($chasis, $filename, $errorCorrectionLevel, $matrixPointSize, 2);    
        
    }  

		
?>         
      
 

<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<meta name="description" content="">
		<meta name="author" content="">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
		<!--<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>-->
		<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
		<title>V0.01 LATKIC S.A</title>
		<link rel="shortcut icon" href="/latkic/resources/img/icon.ico">
		<link href="/latkic/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
		<link href="/latkic/vendor/metisMenu/metisMenu.min.css" rel="stylesheet">
		<link href="/latkic/dist/css/sb-admin-2.css" rel="stylesheet">
		<link href="/latkic/vendor/morrisjs/morris.css" rel="stylesheet">
		<link href="/latkic/vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
		<link rel="stylesheet" type="text/css" href="/latkic/resources/media/css/datatables.bootstrap.min.css"/>
	</head>
		<div class="col-lg-12 col-md-12">
			
			<?php 
				//display generated file
				//echo '<img src="'.$PNG_WEB_DIR.basename($filename).'">'; 
				
				echo "<center><h3> LATKIC S.A.</h3></center>";
				
			?> 
			
		</div>
		<div class="col-lg-12 col-md-12">
			
			<?php 
				//display generated file
				echo '<center><img src="'.$PNG_WEB_DIR.basename($filename).'"></center>'; 
				//echo "<h3>".$chasis."</h3>";
			?> 
			
		</div>
		<div class="col-lg-12 col-md-12">
			
			<?php 	
				echo "<center><h4>".$chasis."</h4><center>";
				//echo "<center><h5>"."Color: ".$color."</h5><center>";
				echo "<center><h4>".$marca." ".$color."</h4></center>";
			?> 
		</div>
	<script>	
		
        window.print();        
		//history.back();
	</script>
	
</html>	
