summaryrefslogtreecommitdiffstats
path: root/frontend/payments/getPdf.php
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/payments/getPdf.php')
-rw-r--r--frontend/payments/getPdf.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/frontend/payments/getPdf.php b/frontend/payments/getPdf.php
new file mode 100644
index 0000000..df2aa5d
--- /dev/null
+++ b/frontend/payments/getPdf.php
@@ -0,0 +1,35 @@
+<?php
+
+# Skripta za downloadanje pdf-jev (ker ga izvedemo preko lepega linka "www.1ka.si/payment/hash")
+
+
+include_once '../../function.php';
+global $site_path;
+
+if(isset($_GET['hash'])){
+
+ // Decode hash
+ $hash = $_GET['hash'];
+ $params = unserialize(urldecode(base64_decode($hash)));
+
+ // Vrnemo predracun
+ if($params['type'] == 'predracun' || $params['type'] == 'racun'){
+
+ $pdf_name = "1ka_".$params['type']."_".$params['id'].".pdf";
+
+ if($params['type'] == 'predracun')
+ $pdf_folder = $site_path."/frontend/payments/cebelica/predracuni/";
+ else
+ $pdf_folder = $site_path."/frontend/payments/cebelica/racuni/";
+
+ $pdf_path = $pdf_folder . $pdf_name;
+
+ header('Content-type: application/pdf');
+ header('Content-Disposition: attachment; filename="'.$pdf_name.'"');
+
+ readfile($pdf_path);
+ }
+}
+
+
+?>