<?php
$aid = intval( $_GET['aid'] );
$url = trim( $_GET['url'] );
if ( empty( $aid ) || empty( $url ) ) {
		exit( 'param error' );
} 
foreach ( $_GET as $k => $v ) {
		if ( !in_array( $k, array( 'aid', 'url' ) ) ) $url .= '&' . $k . '=' . $v;
}
include "../core.php";
$sub_path = saxue_getsubdir( $aid );
$save_path = saxue_uploadpath( 'qr' ) . $sub_path;
$save_url = saxue_uploadurl( 'qr' ) . $sub_path;
saxue_checkdir( $save_path, true );
$save_path .=  '/' . $aid . '.png';
$save_url .=  '/' . $aid . '.png';

include SAXUE_ROOT_PATH . "/qrcode/qrlib.php";
$errorCorrectionLevel = 'M';
$matrixPointSize = 4;
if ( !is_file( $save_path ) ) {
		QRcode :: png( $url, $save_path, $errorCorrectionLevel, $matrixPointSize, 2 );
}
header( "location: " . $save_url );