<?php

require_once "functions.php";
session_start();
security::redirect_if_not_loggedin();
# Delete & Modify
if (isset($_POST["TrModify"])) {
    $TrModify = $_POST["TrModify"];
    if (isset($_POST["TrDelete"]) && $TrModify == "Delete") {
        $TrDeleteArr = $_POST["TrDelete"];
        db_function::transaction_delete_group($TrDeleteArr);
        attachments::delete_group($TrDeleteArr);
        header("Location: show.php");
    }
    if (!isset($_POST["TrDelete"]) && $TrModify == "Delete") {
        $test = various::send_alert_and_redirect("No transaction selected!", "show.php");
    }
    if (isset($_POST["TrEdit"]) && $TrModify == "Edit") {
        $TrEdit = $_POST["TrEdit"];
        header("Location: new_transaction.php?TrEditNr={$TrEdit[0]}");
    }
    if (!isset($_POST["TrEdit"]) && $TrModify == "Edit") {
        $test = various::send_alert_and_redirect("No transaction selected!", "show.php");
    }
}
Esempio n. 2
0
    #Download Attachments by name
    if (isset($_GET["download_attachment"])) {
        $AttachmentFileName = $_GET["download_attachment"];
        if (!empty($AttachmentFileName)) {
            $FullPath = costant::attachments_folder() . "/" . $AttachmentFileName;
            header("Content-Type:");
            header("Cache-Control: public");
            header("Content-Description: File Transfer");
            header("Content-Disposition: attachment; filename= " . $AttachmentFileName);
            header("Content-Transfer-Encoding: binary");
            readfile($FullPath);
        }
    }
    #Delete Attachments
    if (isset($_GET["delete_attachment"])) {
        $AttachmentFileName = $_GET["delete_attachment"];
        if (!empty($AttachmentFileName)) {
            attachments::delete_attachment_by_name($AttachmentFileName);
        }
    }
    #Delete transaction group
    if (isset($_GET["delete_group"])) {
        $deletegroup_string = $_GET["delete_group"];
        $deletegroup_array = explode(",", $deletegroup_string);
        db_function::transaction_delete_group($deletegroup_array);
        attachments::delete_group($deletegroup_array);
        echo $operation_succeded;
    }
} else {
    echo $wrong_guid;
}