| Server IP : 172.67.201.108 / Your IP : 216.73.216.11 Web Server : Apache/2.4.68 (Amazon Linux) OpenSSL/3.5.5 System : Linux ip-172-31-69-123.ec2.internal 6.1.176-223.369.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jul 24 13:34:27 UTC 2026 x86_64 User : ec2-user ( 1000) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/nymp/wwwdev/ |
Upload File : |
<?php
require_once('classes/PHPWord/Autoloader.php');
use PhpOffice\PhpWord\Autoloader;
use PhpOffice\PhpWord\Settings;
session_start();
require_once('mod/_sanitize.php');
include_once('config.php');
date_default_timezone_set(APP_TIMEZONE);
$db = new PDO(DB_CONNECT_STRING, DB_USER, DB_PWD);
if (!$db) :
die('Could not connect: ' . 'Database Error!');
else :
$sql_tz = "SET time_zone = '".APP_TIMEZONE."'";
$db->query($sql_tz);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
endif;
include_once('mod/_functions.php');
$rpt = addslashes($_GET['rpt']);
$type = addslashes($_GET['type']);
if (!empty($_SESSION['logged_in']) && !empty($_SESSION['user_id']) && $_SESSION['logged_in'] == true) :
$authorized_call = 1;
$_SESSION['timeout'] = time() + $app_timeout;
if ($type == 'label') :
if ($_GET['fmt'] == 'pdf') :
ini_set('display_errors', '0');
ini_set("pcre.backtrack_limit","10000000");
ini_set("memory_limit","2048M");
include("mpdf60/mpdf.php");
include_once('rpt/'.$rpt.'.php');
elseif ($_GET['fmt'] == 'word' || $_GET['fmt'] == 'rtf') :
Autoloader::register();
Settings::loadConfig();
$pdf_path = realpath(__DIR__ . '/mpdf60');
\PhpOffice\PhpWord\Settings::setPdfRendererPath($pdf_path);
\PhpOffice\PhpWord\Settings::setPdfRendererName('MPDF');
$phpWord = new \PhpOffice\PhpWord\PhpWord();
include_once('rpt/'.$rpt.'.php');
switch ($_GET['fmt']) :
case 'pdf' :
$file = 'Report.pdf';
$writer = 'PDF';
$content_type = 'application/pdf';
break;
case 'word' :
$file = 'Report.docx';
$writer = 'Word2007';
$content_type = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
break;
case 'rtf' :
$file = 'Report.rtf';
$writer = 'RTF';
$content_type = 'application/rtf';
break;
case 'html' :
$file = 'Report.html';
$writer = 'HTML';
break;
default :
$file = 'Report.docx';
$writer = 'Word2007';
$content_type = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
endswitch;
header("Content-Description: File Transfer");
header('Content-Disposition: attachment; filename="' . $file . '"');
header('Content-Type: '.$content_type);
header('Content-Transfer-Encoding: binary');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Expires: 0');
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
$xmlWriter->save("php://output");
endif;
elseif ($type == 'report') :
ini_set('display_errors', '0');
ini_set("pcre.backtrack_limit","10000000");
ini_set("memory_limit","2048M");
include("mpdf61/mpdf.php");
include_once('rpt/'.$rpt.'.php');
endif;
else :
echo 'Not Authorized!';
endif;
?>