Your IP : 216.73.217.87


Current Path : /hdd/hdd11/www/vlevski/enter/gr/
Upload File :
Current File : /hdd/hdd11/www/vlevski/enter/gr/index.php

<?php
	$df9dsjds09fjs09fj90sdfjdsv09jds0vc = mysqli_connect('localhost', 'bel', 'B3l_Tr0y4n!', 'bel');
	$db=$df9dsjds09fjs09fj90sdfjdsv09jds0vc;
	@mysqli_set_charset($db, 'utf8');
	if (isset($_GET["p"]))
	{
		$p=$_GET["p"];
		$p--;
	}
	else
	{
		$p=0;
	}
	if ($p<0)
	{
		$p=0;
	}
	$n=$p;
	$p=$p*10;
	$i=0;
	//$std=mysqli_query($db, "SELECT * FROM `gr` ORDER BY `i` LIMIT ".$p.", 15");
	$std=mysqli_query($db, "SELECT * FROM `gr` ORDER BY `i`");
	while ($st=mysqli_fetch_row($std))
	{
		if (($st[3]=="I") || ($st[3]=="II") || ($st[3]=="III"))
		{
			$im=imagecreatefrompng("./".$st[7]."-m.png");
		}
		else
		{
			$im=imagecreatefrompng("./".$st[7]."-n.png");
		}
		$font = './gara.ttf';
		$font2 = './c.ttf';
		$font3 = './ba.ttf';
		$font4 = './im.ttf';
		if ($st[7]=="g3")
		{
			if ($st[1]=="Първенец на випуск 85 и носител на награда „Знание“")
			{
				$color = imagecolorallocate($im, 255, 255, 255);
				$text = "Първенец на випуск 85 и носител на награда „Знание“";
				imagettftext($im, 75, 0, 650, 205, $color, $font, $text);
			}
			else
			{
				$color = imagecolorallocate($im, 255, 255, 255);
				$text = "Първенец на випуск 85 и носител на награда „Знание“";
				imagettftext($im, 65, 0, 465, 210, $color, $font, $text);
			}
		}
		else if ($st[7]=="g2" || $st[7]=="g4")
		{
			$text = $st[1];
			$color = imagecolorallocate($im, 70, 110, 110);
			$bbox = imagettfbbox(90, 0, $font4, $text);
			$center_x = (imagesx($im) / 2) - (($bbox[2] - $bbox[0]) / 2);
			imagettftext($im, 90, 0, $center_x, 1070, $color, $font2, $text);
			// $text = $st[1];
			// imagettftext($im, 90, 0, 280, 930, $color, $font, $text);
		}
		else
		{
			$color = imagecolorallocate($im, 255, 255, 255);
			$text = "".$st[1]."";
			$bbox = imagettfbbox(95, 0, $font4, $text);
			$center_x = (imagesx($im) / 2) - (($bbox[2] - $bbox[0]) / 2);
			imagettftext($im, 95, 0, $center_x, 910, $color, $font4, $text);	
		}		
		$color = imagecolorallocate($im, 0, 32, 96);
		if ($st[7]=="g2" || $st[7]=="g4")
		{
			$text = "".$st[4]."";
			$bbox = imagettfbbox(110, 0, $font, $text);
			$center_x = (imagesx($im) / 2) - (($bbox[2] - $bbox[0]) / 2);
			imagettftext($im, 110, 0, $center_x, 1250, $color, $font, $text);
			$text = "".$st[5]."";
			$bbox = imagettfbbox(55, 0, $font2, $text);
			$center_x = (imagesx($im) / 2) - (($bbox[2] - $bbox[0]) / 2);
			imagettftext($im, 55, 0, $center_x, 1350, $color, $font2, $text);
		}
		else
		{
			$text = "".$st[4]."";
			$bbox = imagettfbbox(110, 0, $font, $text);
			$center_x = (imagesx($im) / 2) - (($bbox[2] - $bbox[0]) / 2);
			imagettftext($im, 110, 0, $center_x, 1150, $color, $font, $text);
			$text = "".$st[5]."";
			$bbox = imagettfbbox(55, 0, $font2, $text);
			$center_x = (imagesx($im) / 2) - (($bbox[2] - $bbox[0]) / 2);
			imagettftext($im, 55, 0, $center_x, 1250, $color, $font2, $text);
		}		
		$text = "".$st[6]."";
		$bbox = imagettfbbox(55, 0, $font2, $text);
		$center_x = (imagesx($im) / 2) - (($bbox[2] - $bbox[0]) / 2);
		imagettftext($im, 55, 0, $center_x, 1325, $color, $font2, $text);
		$text = "".$st[2]."";
		$bbox = imagettfbbox(60, 0, $font, $text);
		$center_x = (imagesx($im) / 2) - (($bbox[2] - $bbox[0]) / 2);
		imagettftext($im, 60, 0, $center_x, 1420, $color, $font, $text);
		if ($st[3]=="I")
		{
			$text = "I";
			imagettftext($im, 220, 0, 540, 1840, $color, $font, $text);
		}
		else if ($st[3]=="II")
		{
			$text = "II";
			imagettftext($im, 150, 0, 520, 1810, $color, $font, $text);
		}
		else if ($st[3]=="III")
		{
			$text = "III";
			imagettftext($im, 120, 0, 505, 1800, $color, $font, $text);
		}
		else
		{
			$text = "".$st[3]."";
			imagettftext($im, 50, 0, 380, 1930, $color, $font3, $text);
		}
		header('Content-Type: image/png');
		imagepng($im, "./myimage.png", 0);
		$i++;
		$v=$i+$p;
		$systemline = system("convert -quality 100 myimage.png myimage".$v.".pdf", $dont_print);
		imagedestroy($im);
	}
	$k=2+$p;
	$f=1+$p;
	$prep="myimage".$f.".pdf";
	while ($k<=$v)
		{
			$prep.=" myimage".$k.".pdf";
			$k++;
		}
	$n++;
	$systemline = system("/usr/bin/pdftk ".$prep." cat output myimage.pdf", $dont_print);
	$systemline = system("/usr/bin/ps2pdf14 myimage.pdf newimage".$n.".pdf", $dont_print);
	$systemline = system("rm myimage*.*", $dont_print);
	$t=time();
	header("location: ./newimage".$n.".pdf?t=".$t."");
?>