header("Location: index2.php");
}
if ($user_usertype_current < 2) {
    header("Location: index2.php");
}
//  Use FDPI to get the template
define('FPDF_FONTPATH', 'fpdf/font/');
require 'fpdf/fpdi.php';
$pdf = new fpdi();
$pagecount = $pdf->setSourceFile("pdf/template.pdf");
$tplidx = $pdf->ImportPage(1);
$pdf->addPage();
$pdf->useTemplate($tplidx, 0, 0, 210, 297);
$format_font = "century";
$format_font_2 = "Century.php";
$pdf->AddFont($format_font, '', $format_font_2);
$format_bg_r = "220";
$format_bg_g = "220";
$format_bg_b = "220";
$format_ln_r = "220";
$format_ln_g = "220";
$format_ln_b = "220";
$current_date = TimeFormat(time());
$proj_id = CleanUp($_GET[proj_id]);
// Begin creating the page
//Page Title
$sql_proj = "SELECT * FROM intranet_projects WHERE proj_id = {$proj_id} LIMIT 1";
$result_proj = mysql_query($sql_proj, $conn) or die(mysql_error());
$array_proj = mysql_fetch_array($result_proj);
$proj_num = $array_proj['proj_num'];
$proj_name = $array_proj['proj_name'];
$label_file = "library/background.pdf";
if (file_exists($label_file)) {
    $import_template = "1";
} else {
    $import_template = NULL;
}
if ($import_template == "1") {
    $pdf->setSourceFile("library/background.pdf");
    $tplidx = $pdf->ImportPage(1);
}
// Now add the first page
$pdf->addPage();
if ($import_template == "1") {
    $pdf->useTemplate($tplidx, 0, 0, 210, 297);
}
$pdf->AddFont('century', '', 'Century.php');
$pdf->AddFont('franklingothicbook', '', 'franklingothicbook.php');
$pdf->AddFont('gillsans', '', 'gillsans.php');
$pdf->SetMargins(0, 0);
$pdf->SetAutoPageBreak("no");
// Create the sheet header
$pdf->SetFont("arial", '', $label_j);
$label_print_date = $label_title . ", created " . date("jS M y", time());
$label_url = "http://labelstudio.redcitrus.com";
$pdf->SetFontSize(8);
$pdf->SetTextColor(190, 190, 190);
$pdf->Cell(0, 5, $label_print_date, 0, 1, L, 0, $label_url);
$pdf->SetFont($font, '', $label_j);
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFontSize($label_j);
if ($_GET[labeltype] != NULL) {