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