<?
# Автор движка: InstalScript
# vk.com/k.karamin  - Я Вк
# bymas.ru/id3741  - Я на бумасе
# Специально для обитателей bymas.ru
# Ток на бумасе можно найти моды для данного движка
require_once("inc/mysql.php");

if(isset($_GET['tk'])){
$tk = $_GET['tk'];
$tk = explode("_",$_GET['tk']);
}


if(isset($tk['1'])){
if(file_exists($_SERVER['DOCUMENT_ROOT']."/instalscript/images/angar/".abs($tk['1']).".jpg") == null){
$aimg = "/instalscript/images/angar/standart.jpg";
}else{
$aimg = "/instalscript/images/angar/".abs($tk['1']).".jpg";
}
}else{
$aimg = "/instalscript/images/angar/standart.jpg";
}

$background = imagecreatefromjpeg($_SERVER['DOCUMENT_ROOT'].$aimg);
$background_sy = imagesy($background);
$background_sx = imagesx($background);



if(isset($tk['0'])){
$tankq = mysql_fetch_assoc(mysql_query("SELECT * FROM `tank` WHERE `id` = '".intval($tk['0'])."' "));



if(isset($tankq)){
if(isset($tankq['img'])){
if(file_exists($_SERVER['DOCUMENT_ROOT'].$tankq['img']) == null){
$tankimg = '/instalscript/images/tank/empty.png';

}else{$tankimg = $tankq['img'];}
}else{$tankimg = '/instalscript/images/tank/empty.png';}


if($tankq != null){
$img = "/instalscript/images/tank/flag/".$tankq['country'].".png";
$flag = imagecreatefrompng($_SERVER['DOCUMENT_ROOT'].$img);
$flag_sy = imagesy($flag);
$flag_sx = imagesx($flag);
imagecopy($background, $flag,$background_sx-$flag_sx-0,$background_sx-$background_sy-60,0,0,$flag_sx,$flag_sy);
}


}
}else{$tankimg = '/instalscript/images/tank/empty.png';}



if(file_exists($_SERVER['DOCUMENT_ROOT'].$tankq['img']) == null){
$tankimg = '/instalscript/images/tank/empty.png';
}else{
$tank = imagecreatefrompng($_SERVER['DOCUMENT_ROOT'].$tankimg);
}

$tank = imagecreatefrompng($_SERVER['DOCUMENT_ROOT'].$tankimg);



$tank_sy = imagesy($tank);
$tank_sx = imagesx($tank);

imagecopy($background, $tank,$background_sx-$tank_sx+0,$background_sx-$background_sy-60,0,0,$tank_sx,$tank_sy);


if(isset($tankq)){
if($tankq != null){
# $textcolor_black = imagecolorallocate($background, 0, 0, 0); # цвет текста в системе RGB
$textcolor_white = imagecolorallocate($background, 255, 255, 255); # цвет текста в системе RGB
$text_sample = ($tankq['name']); # Текст
imagefttext($background,10,0,5,95,$textcolor_white,$_SERVER['DOCUMENT_ROOT']."/instalscript/main/fonts/arial.ttf","$text_sample");
}
}



header('content-type:image/jpg');
imagejpeg($background);
imagedestroy($background);
# */
?>
