Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- if (isset($_GET["module"])) {
- $order_id = (int)$_GET["module"];
- if (preg_match("@^[0-9]{1,6}$@i", $order_id)) {
- if ($functions->existsOrderById($order_id)){
- $getOrderData = $db->query("SELECT * FROM orders WHERE id='".$order_id."'")->fetch_assoc();
- if ($_globalUserData["company_id"] == $getOrderData["client_id"] || $functions->isPrivileged($_SESSION["PublicAccess"])) {
- if (isset($_GET["submodule"])) {
- $attachment_id = (int)$_GET["submodule"];
- if (preg_match("@^[0-9]{1,8}$@i", $attachment_id)) {
- $set_query = $db->query("SELECT * FROM attachments WHERE id=".$attachment_id." AND order_id=".$order_id);
- if ($set_query->num_rows > 0) {
- $fetch_file = $set_query->fetch_assoc();
- $file = UPLOAD_PATH.$fetch_file["file_name"];
- if (file_exists($file) && is_file($file)) {
- if(ini_get('zlib.output_compression')) { ini_set('zlib.output_compression', 'Off'); }
- header('Content-Type: "application/octet-stream"');
- header('Content-Disposition: attachment; filename="'.basename($file).'"');
- header("Content-Transfer-Encoding: binary");
- header('Expires: 0');
- header('Pragma: no-cache');
- header("Content-Length: ".filesize($file));
- } else {
- $smarty->assign("error", $ErrorMessages["ERROR_INEXISTENT"]);
- $smarty->display("error");
- echo "Kod wystąpienia: 10001";
- }
- } else {
- $smarty->assign("error", $ErrorMessages["ERROR_INEXISTENT"]);
- $smarty->display("error");
- echo "Kod wystąpienia: 10002";
- }
- } else {
- $smarty->assign("error", $ErrorMessages["ERROR_FORMAT"]);
- $smarty->display("error");
- echo "Kod wystąpienia: 10003";
- }
- } else {
- $smarty->assign("error", $ErrorMessages["ERROR_INEXISTENT"]);
- $smarty->display("error");
- echo "Kod wystąpienia: 10004";
- }
- } else {
- $smarty->assign("error", $ErrorMessages["ERROR_ACCESS"]);
- $smarty->display("error");
- echo "Kod wystąpienia: 10005";
- }
- } else {
- $smarty->assign("error", $ErrorMessages["ERROR_INEXISTENT"]);
- $smarty->display("error");
- echo "Kod wystąpienia: 10006";
- }
- } else {
- $smarty->assign("error", $ErrorMessages["ERROR_FORMAT"]);
- $smarty->display("error");
- echo "Kod wystąpienia: 10007";
- }
- } else {
- $smarty->assign("error", $ErrorMessages["ERROR_INEXISTENT"]);
- $smarty->display("error");
- echo "Kod wystąpienia: 10008";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement