G1BILLET/index.php

24 lines
843 B
PHP
Raw Normal View History

2021-01-24 19:21:49 +01:00
<?php
$mytime = new Datetime("now");
$timestamp = $mytime->format('U');
// CREATE 6 G1BILLETS in /tmp/g1billet/$timestamp
2021-01-25 01:01:13 +01:00
$page = shell_exec(dirname(__FILE__)."/G1BILLETS.sh '".$_REQUEST['montant']."' '".$timestamp."' 2>&1 >> /tmp/g1billet.log");
2021-01-24 19:21:49 +01:00
$attachment_location = "/tmp/g1billet/".$timestamp.".pdf";
if (file_exists($attachment_location)) {
header($_SERVER["SERVER_PROTOCOL"] . " 200 OK");
header("Cache-Control: public"); // needed for internet explorer
header("Content-Type: application/pdf");
header("Content-Transfer-Encoding: Binary");
header("Content-Length:".filesize($attachment_location));
header("Content-Disposition: attachment; filename=".$timestamp.".pdf");
readfile($attachment_location);
2021-01-25 01:25:44 +01:00
// unlink("/tmp/g1billet/".$timestamp.".pdf");
2021-01-24 19:21:49 +01:00
die();
} else {
die("Error: File not found.");
}
?>