From 99c1d9af689e5325f3cf535c4007b3aeb8325229 Mon Sep 17 00:00:00 2001 From: Minteck Date: Tue, 10 Jan 2023 14:54:04 +0100 Subject: Update - This is an automated commit --- pages/metadata.inc | 5 + pages/money.inc | 588 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 593 insertions(+) create mode 100644 pages/money.inc (limited to 'pages') diff --git a/pages/metadata.inc b/pages/metadata.inc index ffe2397..f3e48d7 100644 --- a/pages/metadata.inc +++ b/pages/metadata.inc @@ -67,6 +67,10 @@ if ($member === null) { $toUpdate["bitset"] = (int)$_GET["bitset"]; } + if (isset($_GET["interest"])) { + $toUpdate["interest"] = strip_tags($_GET["interest"]); + } + if (isset($_GET["marefriends"])) { $toUpdate["marefriends"] = array_values(array_filter(array_map(function ($i) { return trim($i); }, explode(",", $_GET["marefriends"])), function ($i) { return !!preg_match("/^(ynmuc|gdapd)\/[a-z]{5}$/m", $i); @@ -126,6 +130,7 @@ if ($member === null) { "heat" => $metadata["heat"] ?? null, "birth" => $metadata["birth"] ?? ["age" => 0, "date" => "01-01", "year" => null], "code" => $metadata["code"] ?? null, + "interest" => $metadata["interest"] ?? null ]; file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $memberID . ".json", json_encode($metadata)); diff --git a/pages/money.inc b/pages/money.inc new file mode 100644 index 0000000..9c98613 --- /dev/null +++ b/pages/money.inc @@ -0,0 +1,588 @@ + 0) { + $myId = $fronters[0]["id"]; +} else { + $myId = "zdtsg"; +} + +if ((isset($_GET["create"]) || isset($_GET["delete"])) && isset($parts[2])) { + $account = array_values(array_filter($accounts, function ($i) use ($parts) { return $i["_name"] === $parts[2]; }))[0]; + + header("Content-Type: text/plain"); + //var_dump($_GET); + + if (isset($_GET["create"])) { + if (!(isset($_GET["amount"]) && is_numeric($_GET["amount"]) && (float)$_GET["amount"] < 9999 && (float)$_GET["amount"] > -9999)) { + header("Location: /-/money/" . $parts[2]); + die(); + } + if (!isset($_GET["description"])) $_GET["description"] = ""; + $_GET["description"] = substr($_GET["description"], 0, 150); + + array_unshift($account["transactions"], [ + "author" => $myId, + "description" => $_GET["description"], + "amount" => (float)$_GET["amount"], + "date" => date('c') + ]); + + $name = $account["_name"]; + unset($account["_name"]); + + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/money/" . $name . ".json", json_encode($account, JSON_PRETTY_PRINT)); + } else { + if (isset($_GET["id"]) && is_numeric($_GET["id"]) && isset($account["transactions"][(int)$_GET["id"]])) { + unset($account["transactions"][(int)$_GET["id"]]); + + $name = $account["_name"]; + unset($account["_name"]); + + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/money/" . $name . ".json", json_encode($account, JSON_PRETTY_PRINT)); + } + } + + //die(); + + header("Location: /-/money/" . $parts[2]); + die(); +} + +$rate = (float)trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/exchange.txt")); + +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; + +?> + + + + + +
+
+ +
+

Money tracker

+ +
+ + +

£ · €

+

As of · €1 = £

+ + + + + +
+ +

Cloudburst System

+
+ $account): if ($account["owner"] === "cloudburst"): ?> + "> +
+
+

+ Default · % interests +
Max balance: (% used) +
+
+
+ +
+ + + + +

Raindrops System

+
+ $account): if ($account["owner"] === "raindrops"): ?> + "> +
+
+

+ Default · % interests +
Max balance: (% used) +
+
+
+ +
+ + + +
+ +

+ · (default) + Back +

+
+

+
+
Maximum balance: (% used)No maximum balance
+
Interests: % interestsNone
+
+
+ + + + +
+ +
+
Add new transaction
+ $transaction): $member = getMemberWithoutSystem($transaction["author"]) ?? getMemberWithoutSystem("zdtsg"); ?> +
" style="border-radius: 999px; width: 32px; height: 32px; margin-right: 10px;">
 "> :
+ +
+ + + + + + + +
+ + -- cgit