-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTransfer.php
More file actions
131 lines (105 loc) · 3.35 KB
/
Transfer.php
File metadata and controls
131 lines (105 loc) · 3.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?php
session_start();
$user = $_SESSION['User'];
if (!isset($_SESSION['auth'])) {
$_SESSION['msg'] = "You must log in first";
header('location: login.php');
}
if (isset($_GET['logout'])) {
session_destroy();
unset($_SESSION['auth']);
header("location: login.php");
}
include('functions.php');
// include('server.php');
update_accounts();
if (isset($_POST['Transfer'])) {
$title = mysqli_real_escape_string($db, $_POST['Transfer_name']);
$desc = mysqli_real_escape_string($db, $_POST['Transfer_desc']);
$to_account = mysqli_real_escape_string($db, $_POST['Transfer_to']);
$from_account = mysqli_real_escape_string($db, $_POST['Transfer_from']);
$amnt_dirty = mysqli_real_escape_string($db, $_POST['Transfer_amnt']);
$amnt = number_format($amnt_dirty, 2, '.', ',');
// array_push($errors, "NULL");
transfer($from_account,$to_account,$amnt,$title,$desc);
update_accounts();
echo '<script type="text/javascript">';
echo "alert('".$message." !');";
echo 'window.location.href = "index.php";';
echo '</script>';
}
?>
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.1/css/all.css">
</head>
<body>
<div class="header" style="border-bottom: 8px solid #f2e711;">
<h2 class="Welcome">Nigga rigged accounting (beta)</h2>
<div class="relative">
<style>
a {
text-decoration: none;
color: #ffffff;
}
</style>
</div>
<?php $site = basename(__FILE__, '.php');
include('server.php');
home_bar($site);
?>
<form style="height:100%; width:90%; margin: auto;" method="post" action="Transfer.php" enctype="multipart/form-data">
<!-- Transfer Name -->
<div class="input-group" style="width:100%; margin:auto; overflow: hidden;">
<label>Transfer Name</label>
<input type="text" name="Transfer_name" >
</div>
<!-- Transfer Desc -->
<div class="input-group" style="width:100%; margin:auto; overflow: hidden;">
<label>Transfer Description</label>
<input type="text" name="Transfer_desc" >
</div>
<!-- Transfer Amount -->
<div class="input-group" style="width:100%; margin:auto; overflow: hidden;">
<label>Transfer Amount</label>
<input placeholder="$" type="text" name="Transfer_amnt" >
</div>
<!-- From account -->
<label>Transfer From</label>
<select style="width:100%; height:70%;" name="Transfer_from" id="Transfer_from">
<?php
$query = "SELECT * FROM Budget.Accounts WHERE Account_Owner = '$user' ";
$result = mysqli_query($db, $query);
// Counting system
$x = 0;
while($row = mysqli_fetch_assoc($result)) {
$account_name = $row['Account_name'];
echo " <option value=\"$account_name\"> $account_name </option>";
$x++;
}
?>
</select>
<!-- To account -->
<label>Transfer To</label>
<select style="width:100%; height:70%;" name="Transfer_to" id="Transfer_to">
<?php
$query = "SELECT * FROM Budget.Accounts WHERE Account_Owner = '$user' ";
$result = mysqli_query($db, $query);
// Counting system
$x = 0;
while($row = mysqli_fetch_assoc($result)) {
$account_name = $row['Account_name'];
echo " <option value=\"$account_name\"> $account_name </option>";
$x++;
}
?>
</select>
<div class="input-group">
<button style="margin-left:75%;" type="submit" class="btn-login" name="Transfer">Complete Transfer</button>
</div>
</form>
</body>
</html>