summaryrefslogtreecommitdiffstats
path: root/frontend/payments/getPdf.php
blob: df2aa5d898822e65c0f9b20824ff6df6d3c1a802 (plain) (blame)
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
<?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);
    }
}


?>