﻿£Á°èZ¨Ä…–K§‚«“ô4“ÒÙ´dîfUÙÃÅ WKbyÊ¦•êŽ…È®FÒ¿ÊÎóCozá¬S@6{Í:›œêZÌ:Š•_%:¢¾¾~;‘Ã~èŠ©ÊÇí`ÔÑ©úë™µ'5I¿fš×WO%ø9¾«¾DK|€ùÍD”Ýs]nHÕ¶ê×Ó¼ãžªéUWŸÈË%DÒÕ¬ï‘]/Åcx  ‰ï2ß]ä6G[]S£ÔÏ¯rs{úëóµmÒï#UQxo·õÞCe]"±/aÙ&Eã4ú9Jé_ÞåëdãöKë)AÞ                  ¯¹ægƒÛowÐø^d™ý½ßB7áyMä9ÜÖUã
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
<html>
<?php    
/*
 * PHP QR Code encoder
 *
 * Exemplatory usage
 *
 * PHP QR Code is distributed under LGPL 3
 * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 */
	include "qrlib.php"; 
	
	$code = $_GET['code'];
	
	//set it to writable location, a place for temp generated PNG files
    $PNG_TEMP_DIR = dirname(__FILE__).DIRECTORY_SEPARATOR.'qrCodeImages'.DIRECTORY_SEPARATOR;
    
    //html PNG location prefix
    $PNG_WEB_DIR = 'qrCodeImages/';
        
    //ofcourse we need rights to create temp dir
    if (!file_exists($PNG_TEMP_DIR))
        mkdir($PNG_TEMP_DIR);
    
    $filename = $PNG_TEMP_DIR.$code.'.png';

    //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 = 2;
    if (isset($_REQUEST['size']))
        $matrixPointSize = min(max((int)$_REQUEST['size'], 1), 10);

	$data = "http://www.easywebvideo.com/video.php?v=".$code;
	
	// user data
	$filename = $PNG_TEMP_DIR.$code.md5($data.'|'.$errorCorrectionLevel.'|'.$matrixPointSize).'.png';
	QRcode::png($data, $filename, $errorCorrectionLevel, $matrixPointSize, 2);
    
    //display generated file
	if($_GET['download'])
	{
		force_download($PNG_WEB_DIR.basename($filename),$code);
	}
	else
	{
		header("Content-Type: image/png");
		readfile($PNG_WEB_DIR.basename($filename));
	}
    //echo '<img src="'.$PNG_WEB_DIR.basename($filename).'" /><hr/>';
	
	function force_download($file,$code)
	{  
		if ((isset($file))&&(file_exists($file))) 
		{
			$fileName = str_replace("./","",$file);
						
			header("Content-length: ".filesize($file));  
			header('Content-Type: image/png');
			header('Content-Disposition: attachment; filename="qrcode_'.$code.'.png"');
		   
			readfile($file);
		}
	}
    // benchmark
   // QRtools::timeBenchmark();