<?php
/* setup includes */
require_once('includes/master.inc.php');

/* load url details */
if ($_REQUEST['url'])
{
    $shortUrlObj = shortUrl::loadByUrl(str_replace(array("~q"), "", $_REQUEST['url']));
}
else
{
    /* if no short url found, redirect to home page */
    redirect(WEB_ROOT . "/index." . SITE_CONFIG_PAGE_EXTENSION);
}

// make sure the short url is active
if($shortUrlObj->status != 'active')
{
	header("HTTP/1.0 404 Not Found");
	exit;
}

// output qr code
$shortUrlPath = WEB_ROOT.'/'.str_replace(array("~q"), "", $_REQUEST['url']);
QRcode::png($shortUrlPath);