CoolFace
Apppublic

kenken999/php

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
getpdf.php48 linesDownload Raw Back to public
1<?php 2@ini_set("display_errors","1");3@ini_set("display_startup_errors","1");4 5require_once("include/dbcommon.php");6 7$table = postvalue("table");8$id = postvalue_number("id");9if(!$table || !$id)10	return;11 12$tablename="";13$tables = GetTablesList(true);14foreach($tables as $t)15{16	if(GetTableURL($t)==$table)17	{18		$tablename=$t;19		break;20	}21}22if(!$tablename)23	return;24##if @BUILDER.bCreateLoginPage##25if(!isLogged())26{ 27	HeaderRedirect("login"); 28	return;29}30$strPerm = GetUserPermissions($tablename);31if(strpos($strPerm,"S")===false && strpos($strPerm,"E")===false)32{ 33	HeaderRedirect("login"); 34	return;35}36##endif##37 38$file = dirname(__FILE__)."/templates_c/".$table.$id.".pdf";39if(!myfile_exists($file))40	return;41$value = @file_get_contents($file);42 43header("Content-Type: application/pdf");44header("Cache-Control: private");45SendContentLength(strlen($value));46echoBinary($value);47 48?>