0% found this document useful (0 votes)
49 views2 pages

Mod

This PHP document contains code for generating and displaying QR codes and barcodes from input content. It includes functions to display the images, get tracking code data from a database, and retrieve attachment files. The code takes in GET parameters to determine the type of image to generate and any additional options, retrieves the necessary data, sets the correct header, and outputs the image or file contents.

Uploaded by

Alvian Rizaldi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views2 pages

Mod

This PHP document contains code for generating and displaying QR codes and barcodes from input content. It includes functions to display the images, get tracking code data from a database, and retrieve attachment files. The code takes in GET parameters to determine the type of image to generate and any additional options, retrieves the necessary data, sets the correct header, and outputs the image or file contents.

Uploaded by

Alvian Rizaldi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

<?

php
require_once(dirname(__FILE__) . '/spear/libs/qr_barcode/qrcode.php');
require_once(dirname(__FILE__) . '/spear/libs/qr_barcode/barcode.php');
require_once(dirname(__FILE__) . '/spear/config/db.php');
require_once(dirname(__FILE__) . '/spear/manager/common_functions.php');

if(isset($_GET['content']))
$content = $_GET['content'];
else
$content = ' ';

if(isset($_GET['type']))
switch ($_GET['type']) {
case 'qr_ir':
case 'qr_b64':
case 'qr_att': displayQRImage(); break;
case 'bar_ir':
case 'bar_b64':
case 'bar_att': displayBarcodeImage(); break;
}

if(isset($_GET['tlink']))
getTrackerCode($conn, $_GET['tlink']);
if(isset($_GET['mbf']) && is_numeric($_GET['mbf']))
getMailBodyFile($_GET['mbf']);

//--------------------------------------------------

function displayQRImage(){
$generator = new barcode_generator();
if(isset($_GET['options']))
$options = $_GET['options'];
else
$options = ['sx'=>5, 'sf'=>5];

header('Content-Type: image/png');
$generator->output_image("png", "qr", $GLOBALS['content'], $options);
}

function displayBarcodeImage(){
header('Content-Type: image/png');
echo barcode( "", $GLOBALS['content'], 50, "horizontal", "code128", false,
1);
}

function getTrackerCode($conn, $tracker_id){


$stmt = $conn->prepare("SELECT content_js FROM tb_core_web_tracker_list WHERE
tracker_id = ?");
$stmt->bind_param("s", $tracker_id);
$stmt->execute();
$result = $stmt->get_result();
header('Content-Type: application/javascript');
if($result->num_rows != 0){
$row = $result->fetch_row() ;
echo ($row[0]) ;
}
$stmt->close();
}
function getMailBodyFile($mbf){
$mbf = doFilter($mbf,'NUM');
$files = glob('spear/uploads/attachments/*'.$mbf.".mbf");

if(!empty($files)){
$file = $files[0];
$mime = mime_content_type($file);
header("Content-type: ".$mime);

if(strstr($mime, "video/"))
readfile($file);
else if(strstr($mime, "image/"))
readfile($file);
}
}
?>

You might also like