From a32ace1057aeecacf707086cadc2b4e49871fe20 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 16 Mar 2019 19:32:41 -0400 Subject: [PATCH] Added Account Transfer module --- add_transfer_modal.php | 88 +++++++++++++++++++++++++++++++++++++++++ edit_transfer_modal.php | 87 ++++++++++++++++++++++++++++++++++++++++ post.php | 31 +++++++++++++++ transfers.php | 77 ++++++++++++++++++++++++++++++++++++ 4 files changed, 283 insertions(+) create mode 100644 add_transfer_modal.php create mode 100644 edit_transfer_modal.php create mode 100644 transfers.php diff --git a/add_transfer_modal.php b/add_transfer_modal.php new file mode 100644 index 00000000..514e7d1d --- /dev/null +++ b/add_transfer_modal.php @@ -0,0 +1,88 @@ + \ No newline at end of file diff --git a/edit_transfer_modal.php b/edit_transfer_modal.php new file mode 100644 index 00000000..2039c480 --- /dev/null +++ b/edit_transfer_modal.php @@ -0,0 +1,87 @@ + \ No newline at end of file diff --git a/post.php b/post.php index bc0131db..35c00431 100644 --- a/post.php +++ b/post.php @@ -180,6 +180,37 @@ if(isset($_POST['edit_expense'])){ } +if(isset($_POST['add_transfer'])){ + + $date = strip_tags(mysqli_real_escape_string($mysqli,$_POST['date'])); + $amount = $_POST['amount']; + $account_from = intval($_POST['account_from']); + $account_to = intval($_POST['account_to']); + + mysqli_query($mysqli,"INSERT INTO transfers SET transfer_date = '$date', transfer_amount = '$amount', transfer_account_from = $account_from, transfer_account_to = $account_to"); + + $_SESSION['alert_message'] = "Transfer added"; + + header("Location: " . $_SERVER["HTTP_REFERER"]); + +} + +if(isset($_POST['edit_transfer'])){ + + $transfer_id = intval($_POST['transfer_id']); + $date = strip_tags(mysqli_real_escape_string($mysqli,$_POST['date'])); + $amount = $_POST['amount']; + $account_from = intval($_POST['account_from']); + $account_to = intval($_POST['account_to']); + + mysqli_query($mysqli,"UPDATE transfers SET transfer_date = '$date', transfer_amount = '$amount', transfer_account_from = $account_from, transfer_account_to = $account_to WHERE transfer_id = $transfer_id"); + + $_SESSION['alert_message'] = "Transfer added"; + + header("Location: " . $_SERVER["HTTP_REFERER"]); + +} + if(isset($_POST['add_user'])){ $email = strip_tags(mysqli_real_escape_string($mysqli,$_POST['email'])); $password = mysqli_real_escape_string($mysqli,$_POST['password']); diff --git a/transfers.php b/transfers.php new file mode 100644 index 00000000..6dd42eab --- /dev/null +++ b/transfers.php @@ -0,0 +1,77 @@ + + + + + +
+
+
Transfers
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
DateFrom AccountTo AccountAmountActions
$ + +
+
+
+
+ + + +