forked from makdosx/online-banking
-
Notifications
You must be signed in to change notification settings - Fork 0
/
transf_anyone_bank_transac.php
234 lines (143 loc) · 7.42 KB
/
transf_anyone_bank_transac.php
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
<?php
/*
* Copyright (c) 2018 Barchampas Gerasimos <[email protected]>
* online-banking a online banking system for local businesses.
*
* online-banking is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
*
* online-banking is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
session_start();
if(!isset($_SESSION['login']))
{
header('Location: index.php');
}
else
{
session_start();
$idletime=898;//after 60 seconds the user gets logged out
if (time()-$_SESSION['timestamp']>$idletime)
{
session_destroy();
session_unset();
}
else
{
$_SESSION['timestamp']=time();
}
if (isset($_POST['transfer_anyone_bank']))
{
require_once('__SRC__/connect.php');
if (class_exists('DATABASE_CONNECT'))
{
$obj_conn = new DATABASE_CONNECT;
$host = $obj_conn->connect[0];
$user = $obj_conn->connect[1];
$pass = $obj_conn->connect[2];
$db = $obj_conn->connect[3];
$conn = new mysqli($host,$user,$pass,$db);
if ($conn->connect_error)
{
die ("Cannot connect " .$conn->connect_error);
}
else
{
require_once('__SRC__/secure_data.php');
if (class_exists('SECURE_INPUT_DATA_AVAILABLE'))
{
$obj_secure_data = new SECURE_INPUT_DATA;
// get personal details from user
$_to_customer_lastname = $obj_secure_data->SECURE_DATA_ENTER($_POST['lastname']);
$_to_customer_firstname = $obj_secure_data->SECURE_DATA_ENTER($_POST['firstname']);
$_to_customer_IBAN = $obj_secure_data->SECURE_DATA_ENTER($_POST['IBAN']);
$reason = $obj_secure_data->SECURE_DATA_ENTER($_POST['reason']);
$main_amount = $obj_secure_data->SECURE_DATA_ENTER($_POST['main_amount']);
$secondary_amount = $obj_secure_data->SECURE_DATA_ENTER($_POST['secondary_amount']);
$amount = $main_amount ."." .$secondary_amount;
$length_number = 16;
$transaction_number = substr(str_shuffle("0123456789"),0, $length_number);
$sql = "select firstname, lastname, IBAN from customers
where email = '".$_SESSION['login']."' ";
$result = $conn->query($sql);
while ($row = $result->fetch_assoc())
{
$amount_reserve = 3;
$total_amount = $amount + $amount_reserve;
$_from_customer_lastname = $row['lastname'];
$_from_customer_firstname = $row['firstname'];
$_from_customer_IBAN = $row['IBAN'];
$sql2 = "insert into transactions_anyone_bank
(_from_customer_lastname, _from_customer_firstname, _from_customer_IBAN,
_to_customer_lastname, _to_customer_firstname, _to_customer_IBAN,
reason, transaction_number,
amount_from_reserve, amount, total_amount)
values
('$_from_customer_lastname', '$_from_customer_firstname',
'$_from_customer_IBAN',
'$_to_customer_lastname', '$_to_customer_firstname',
'$_to_customer_IBAN',
'$reason', '$transaction_number',
'$amount_reserve', '$amount', '$total_amount')";
$result2 = $conn->query($sql2);
$sql3 = "insert into transactions_all
(_from_customer_lastname, _from_customer_firstname, _from_customer_accno_iban,
_to_customer_lastname, _to_customer_firstname, _to_customer_accno_iban,
reason, transaction_number, amount)
values
('$_from_customer_lastname', '$_from_customer_firstname',
'$_from_customer_IBAN',
'$_to_customer_lastname', '$_to_customer_firstname',
'$_to_customer_IBAN',
'$reason', '$transaction_number', '$amount')";
$result3 = $conn->query($sql3);
$sql4 = "insert into easybank_reserve_currency
(_from_customer_lastname, _from_customer_firstname, _from_customer_IBAN,
_to_customer_lastname, _to_customer_firstname, _to_customer_IBAN,
transaction_number, amount_reserve)
values
('$_from_customer_lastname', '$_from_customer_firstname',
'$_from_customer_IBAN',
'$_to_customer_lastname', '$_to_customer_firstname',
'$_to_customer_IBAN',
'$transaction_number', '$amount_reserve')";
$result4 = $conn->query($sql4);
$sql5 = "update easybank_all_reserves
set TOTAL_RESERVE = TOTAL_RESERVE + '$amount_reserve'
where EASY_BANK_ID = 'EASY_BANK_1410'";
$result5 = $conn->query($sql5);
// printf("Errormessage: %s\n", $conn->error);
if ($result2 == true && $result3 == true && $result4 == true && $result5 == true)
{
echo '<script type="text/javascript">alert("This transfer was held successfully.");
</script>';
echo ("<script>location.href='transf_anyone_bank.php'</script>");
exit;
}
// } // end of big result
else
{
//exit;
echo "Error";
}
} // end of while
//else
// {
//exit;
//}
} // end of secure data input
} // end of else for connect
} // end of if for calss exists secure data
} // end of if isset post transfer button
} // end of else session login
?>