-
Notifications
You must be signed in to change notification settings - Fork 0
/
moneysend.php
301 lines (245 loc) · 9.87 KB
/
moneysend.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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SEND MONEY | TSFBANKING</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-iYQeCzEYFbKjA/T2uDLTpkwGzCiq6soy8tYaI1GyVh/UjpbCx/TYkiZhlZB6+fzT" crossorigin="anonymous">
<!-- custom css file link -->
<link rel="stylesheet" href="header_style1.css">
<link rel="stylesheet" href="sm_style.css">
<!-- google icons -->
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<!-- swiper css link -->
<link rel="stylesheet" href="https://unpkg.com/swiper@8/swiper-bundle.min.css"/>
<!-- font awesome 4 cdn link -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<!-- font awesome cdn link -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
<style>
@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,400;0,500;0,600;0,700;1,400;1,600;1,800&display=swap');
*{
margin: 0;
padding: 0;
font-family: 'Poppins', sans-serif;
outline: none;
border: none;
text-decoration: none;
transition: all .4s linear;
box-sizing:border-box;
}
*::selection{
background:rgb(12, 104, 242);
color:#fff;
}
html{
font-size: 60%;
overflow-x: hidden;
scroll-padding-top:5rem;
scroll-behavior: smooth;
}
header .navbar a{
color:#004aad;
font-size: 2rem;
font-weight: 500;
margin: 0.8rem;
}
header .navbar a:hover{
color:#74d14c;
}
header .icons i{
font-size: 2.5rem;
color:#004aad;
cursor: pointer;
margin-right: 2rem;
margin-left: 2rem;
}
header .icons i:hover{
color:#74d14c;
}
header .icons #menu-btn{
display: none;
}
.container .forms{
display: flex;
align-items: center;
height: 550px;
width: 200%;
transition: height 0.2s ease;
}
/* media queries */
@media (max-width:1200px){
html{
font-size: 50%;
}
.footer{
padding:3rem 5%;
}
}
@media(max-width:990px){
.header{
padding: 2rem;
}
.footer{
padding:3rem 2rem;
}
}
@media(max-width:768px){
header .icons #menu-btn{
display: initial;
}
header .navbar{
position: absolute;
top:100%;
right:0;
left:0;
padding:1rem 2rem;
background: linear-gradient(45deg,#72b2e4,#92e1e2);
border-top: 0.1 rem solid rgba(34, 30, 30, 0.2);
clip-path: polygon(0 0,100% 0,100% 0,0 0);
text-align: center;
}
header .navbar.active{
clip-path: polygon(0 0,100% 0,100% 100%,0 100%);
}
header .navbar a{
display: block;
padding:1rem;
border-radius: .5rem;
margin: 1rem 0;
text-align:center;
background: #fff;
}
}
@media(max-width:450px){
html{
font-size: 30%;
}
}
</style>
</head>
<body>
<?php include 'spinner.php'; ?>
<!-- header section starts -->
<header class="header" style="position:sticky;top:0;left:0;right:0; background:rgba(255, 255, 255, 0.912); z-index: 1000; display: flex; align-items: center; justify-content: space-between;padding: 1rem 2%;">
<img src="TSFlogo.png" alt="Logo" style="width:6.25rem;">
<nav class="navbar">
<a href="index.php" style="text-decoration:none;">HOME</a>
<a href="viewcustomer.php" style="text-decoration:none;">VIEW ALL CUSTOMERS</a>
<a href="moneysend.php" style="text-decoration:none;">SEND MONEY</a>
<a href="transacthistory.php" style="text-decoration:none;">TRANSACTION HISTORY</a>
</nav>
<div class="icons">
<i id="menu-btn" class="fas fa-bars"></i>
</div>
</header>
<!-- header section ends -->
<section class="lf">
<div class="container">
<div class="forms">
<div class="form login">
<span class="title" style="text-align:center; margin-top:35px;">Send Money</span>
<form action="moneysend.php" method="post">
<div class="input-field">
<input type="text" placeholder="Account Number - Sender" name="accno1" id="">
</div>
<div class="input-field">
<input type="text" name="accno2" id=""
placeholder="Account Number - Reciever"
value="<?php if(isset($_GET['reads'])){echo $_GET['reads'];} ?>">
</div>
<div class="input-field">
<input type="number" name="amount" id=""
placeholder="Amount to Send">
</div>
<div class="input-field button">
<input type="submit" value="Send">
</div>
</form>
<div class="ls">
<div class="login-signup">
<span class="text">DON'T REMEMBER YOUR ACCOUNT NUMBER?<br>
<a href="viewcustomer.php" class="text signup-link">CHECK HERE</a>
</span>
</div>
<div class="login-signup">
<span class="text">WANT TO CHECK YOUR ACCOUNT DETAILS?<br>
<a href="checkbalance.php" class="text signup-link">CHECK HERE</a>
</span>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<?php
$servername = "localhost";
$username = "id19586413_root";
$password = "w]_4)QW%G7#|EmZg";
$database = "id19586413_simdb";
$conn = mysqli_connect($servername, $username, $password, $database);
if(!$conn){
die("Connection not established: ".mysqli_connect_error());
}else{
if($_SERVER['REQUEST_METHOD']== 'POST'){
$sender = $_POST['accno1'];
$amount = $_POST['amount'];
$reciever = $_POST['accno2'];
$checkblcquery = "SELECT balance FROM customer where accno='$sender'";
$checkbalance = mysqli_query($conn, $checkblcquery);
$ava_blc = mysqli_fetch_assoc($checkbalance);
if($ava_blc >= $amount && $amount >0){
$sql1 = "UPDATE customer SET balance= balance-$amount WHERE accno='$sender'";
$sql2 = "UPDATE customer SET balance= balance+$amount WHERE accno='$reciever'";
$result1 = mysqli_query($conn, $sql1);
$result2 = mysqli_query($conn, $sql2);
if($result1 && $result2){
echo '<div class="alert alert-success" style="width:100%; background: linear-gradient(45deg,#e5a663,#faee9e); padding:20px; " role="alert">
<div>
<h2 style="content-align:center; color:green;"><i class="fas fa-check-circle"></i>
The amount has been transfered successfully!!!</h2></div>
</div>
</div>';
$sqltran = "INSERT INTO `transact` (`sender`, `receiver`, `amount`, `status`) VALUES ('$sender', '$reciever', '$amount', 'success')";
$sqltransact = mysqli_query($conn, $sqltran);
}else{
echo '<div class="alert alert-danger" style="width:100%; background: linear-gradient(45deg,#e5a663,#faee9e); padding:20px;" role="alert">
<div>
<h2 style="content-align:center; color:red;"> <i class="fas fa-times-circle"></i>
Oops! Something went wrong!</h2>
</div>
</div>';
$sqltran = "INSERT INTO `transact` (`sender`, `receiver`, `amount`, `status`) VALUES ('$sender', '$reciever', '$amount', 'failure')";
$sqltransact = mysqli_query($conn, $sqltran);
}
}
else{
echo '<div class="alert alert-danger" style="width:100%; background: linear-gradient(45deg,#e5a663,#faee9e); padding:20px;" role="alert">
<div>
<h2 style="content-align:center; color:red;"><i class="fas fa-times-circle"></i>
Not Sufficient Balance in Account!</h2></div>
</div>
</div>
';
$sqltran = "INSERT INTO `transact` (`sender`, `receiver`, `amount`, `status`) VALUES ('$sender', '$reciever', '$amount', 'failure')";
$sqltransact = mysqli_query($conn, $sqltran);
}
}
}
?>
<script>
let menu=document.querySelector('#menu-btn');
let navbar= document.querySelector('.navbar');
window.onscroll = () =>{
searchbtn.classList.remove('fa-times');
searchbar.classList.remove('active');
}
menu.addEventListener('click',() =>{
menu.classList.toggle('fa-times');
navbar.classList.toggle('active');
})
</script>
</body>
</html>