forked from kevinowino869/mitrobill
QRCODE in voucher
This commit is contained in:
43
qrcode/index.php
Normal file
43
qrcode/index.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?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";
|
||||
|
||||
|
||||
//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);
|
||||
|
||||
|
||||
//it's very important!
|
||||
if (trim($_REQUEST['data']) == '')
|
||||
die('?data=text');
|
||||
QRcode::png($_REQUEST['data'], false, $errorCorrectionLevel, $matrixPointSize, 2);
|
Reference in New Issue
Block a user