<?php
include("config.inc.php");
session_start();

$connection = mysql_connect($config['dbServer'] , $config['dbUser'] , $config['dbPass']) or die("Could not connect to DB");
mysql_select_db($_SESSION['dbName'] , $connection) or die("Could not find DB");

$id  = $_GET['id'];
$img = $_GET['img'];

if ($id != ''){
	if ($img == 1){
		$queryComp = " Select vehicleservice_quotation From vehicleservice where vehicleservice_id = $id "; 	
	} 
	else if ($img == 2){
		$queryComp = " Select vehicleservice_invoice From vehicleservice where vehicleservice_id = $id "; 	
	}
	else $queryComp = " ";  //echo$queryComp;exit;
	$resultComp = mysql_query($queryComp , $connection);

	while($rowComp = mysql_fetch_array($resultComp)){
		$CompanyLogo = $rowComp[0];
	} 

	header('Content-type: image/jpeg');
	header('Content-type: image/png');
	header('Content-type: image/mpeg');
	header('Content-type: image/bmp');
	header('Content-type: application/msword'); 
	header('Content-type: application/vnd.openxmlformats-officedocument.wordprocessingml.document');
	header('Content-type: application/pdf');
	header('Content-type: application/vnd.ms-excel');
	header('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
	
	echo $CompanyLogo;

}

?> 