From e18b9890f9c40950b331e829072f63b38ef72d11 Mon Sep 17 00:00:00 2001 From: Minteck Date: Mon, 6 Jun 2022 18:15:32 +0200 Subject: Commit --- Application/AddTransaction/index.php | 82 +++++++++++++++++++++++++++++++++ Application/RemoveTransaction/index.php | 52 +++++++++++++++++++++ Private/ExchangeRate.txt | 1 + 3 files changed, 135 insertions(+) create mode 100644 Application/AddTransaction/index.php create mode 100644 Application/RemoveTransaction/index.php create mode 100644 Private/ExchangeRate.txt diff --git a/Application/AddTransaction/index.php b/Application/AddTransaction/index.php new file mode 100644 index 0000000..1c3d35f --- /dev/null +++ b/Application/AddTransaction/index.php @@ -0,0 +1,82 @@ + $_PROFILE['id'], + 'type' => $_GET['Operation'] === "+" || $_GET['Operation'] === " " ? "gain" : "pay", + 'amount' => [ + 'eur' => (float)$_GET['Amount'], + 'gbp' => (float)$_GET['Amount'] * $eurToGbp, + 'original' => 'eur' + ], + 'date' => date("c"), + 'description' => base64url_decode($_GET['Description']) + ]; +} else { + $list[] = [ + 'author' => $_PROFILE['id'], + 'type' => $_GET['Operation'] === "+" || $_GET['Operation'] === " " ? "gain" : "pay", + 'amount' => [ + 'eur' => (float)$_GET['Amount'] * $gbpToEur, + 'gbp' => (float)$_GET['Amount'], + 'original' => 'gbp' + ], + 'date' => date("c"), + 'description' => base64url_decode($_GET['Description']) + ]; +} + +$list = array_reverse($list); + +file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/Private/Data/Transactions.json", json_encode($list)); \ No newline at end of file diff --git a/Application/RemoveTransaction/index.php b/Application/RemoveTransaction/index.php new file mode 100644 index 0000000..ad0ed5d --- /dev/null +++ b/Application/RemoveTransaction/index.php @@ -0,0 +1,52 @@ +