<?php

// Load a banner and display it

$banner_id = $_GET['id'];
$banner_format = $_GET['ft'];
if( preg_match( "/^[0-9a-zA-Z_ ]*$/", $banner_id ) !== 1 )
    die( "unauthorized caracters" );

$ext = '';
switch( $banner_format )
{
case 'jpg': $ext = 'jpg';
            break;
case 'gif': $ext = 'gif';
            break;
case 'flash': $ext = 'swf';
            break;
default:
    die( "unauthorized caracters" );
    break;
}

// Minimal Tournoi configuration
require_once('../../../config.inc.php');
function __autoload($class)
  {
    $file = $class.'.inc.php';     
    require_once( APP_CORE_PATH.$file);
  }

//$g = new APP_GameFactory;

//$o_banner = $g->getNewUnique( "module.website.banner" );
//$banner_name = $o_banner->getBannerName();

$image = APP_DATA_PATH.'das/'.$banner_id.'.'.$ext;

$fp = fopen($image, 'rb');


header("Content-Type: image/png");
header("Content-Length: " . filesize($image));

// dump the picture and stop the script
fpassthru($fp);
exit;


?>
