-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtransfer2.php
More file actions
212 lines (179 loc) · 4.4 KB
/
transfer2.php
File metadata and controls
212 lines (179 loc) · 4.4 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
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
<?php
session_start();
?>
<html>
<head>
<title> </title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" type="text/css" href="files/css/reset.css">
<link href="files/css/font-awesome.min.css" rel="stylesheet">
<link href="files/css/bootstrap.css" rel="stylesheet" />
<link rel="stylesheet" href="files/animate/animate.css" />
<link rel="stylesheet" href="files/animate/set.css" />
<link href='files/fonts/sans.css' rel='stylesheet' type='text/css'>
<style>
#backs{
background-image:url();
background-size: cover;
}
#lines{
margin-top: 0px;
width:100%;
}
#bank-name{
width: 400px;
}
#bank-name img{
width: 200px;
margin-top:0px;
}
.nav-div{
width:100%;
height:70px;
background:white;
}
.nav-div ul{
position:absolute;
list-style: none;
}
.nav-div li{
float:left;
display: inline-block;;
}
.nav-div a{
font: Roboto,Arial,Helvetica;
margin-top:15px;
text-decoration: none;
width:150px;
color: black;
display: block;
padding: 10px;
text-align: center;
}
.nav-div a:hover{
color: #12DAD1;
text-decoration: none;
}
.nav-div a:active{
color: #12DAD1;
}
@font-face {
font-family: myFirstFont;
src: url(files/css/Redressed.ttf);
font-weight: bold;
}
#area{
font-family: myFirstFont;
font-size: 70px;
text-align: center;
}
input[type=text] {
width: 30%;
height:10%
padding: 10px 18px;
margin: 8px 0;
box-sizing: border-box;
border: 3px solid #ccc;
transition: 0.5s;
outline: none;
}
input[type=text]:focus {
border: 3px solid #555;
}
.button {
background-color: #4CAF50; /* Green */
border: none;
color: white;
padding: 16px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
transition-duration: 0.4s;
cursor: pointer;
margin-left: -5%;
}
.button5 {
background-color: transparent;
color: black;
border: 2px solid #555555;
}
.button5:hover {
background-color: #555555;
color: white;
}
#with_form{
font-size: 28px;
margin-top:80px;
text-align: center;
}
#with_form b{
color: black;
}
</style>
</head>
<body id="backs">
<div id="lines-div">
<img id="lines" src="images/lines1.png">
</div>
<div class="nav-div">
<ul>
<li id="bank-name"><img src="images/logo2.png"> </li>
<li><a href="2.php">Home</a></li>
<li><a href="transfer.php">Transfer</a></li>
<li><a href="cards.html">Cards</a></li>
<li><a href="profile.php">Profile</a></li>
<li><a href="logout.php">Log Out</a></li>
<li style="margin-top:-10px;"><a href=""><b> <?php echo "WELCOME<br>".$_SESSION['name'];?> </b> </a> </li>
</ul>
</div>
<div id="area"><br>
<?php
function rtxn()
{
$sample="0123456789";
$result="";
for( $i=1;$i<=16;$i++)
{
$result.=$sample[rand(0,strlen($sample)-1)];
}
return $result;
}
$conn=mysqli_connect("localhost","root","");
$sql=mysqli_select_db($conn,'bank');
$accno=$_SESSION['accno'];
$sql=mysqli_query($conn,"select balance from account where accountno='$accno'");
$row=mysqli_fetch_assoc($sql);
$bal=$row['balance'];
$amt=$_POST['amount'];
$accno2=$_POST['accno'];
if($amt>$bal)
{
echo "insufficent amount in the bank balance";
}
else
{
if($_POST['benef']=="inter")
{
$sql=mysqli_query($conn,"update account set balance=balance-$amt where accountno='$accno' ");
$date=date("Y-m-d");
$txn=rtxn();
$sql=mysqli_query($conn,"insert into transaction values('$date',$amt,'$accno','$accno2','$txn')");
echo "transaction sucessful";
}
else if($_POST['benef']=="intra")
{
$sql=mysqli_query($conn,"update account set balance=balance-$amt where accountno='$accno' ");
$sql=mysqli_query($conn,"update account set balance=balance+$amt where accountno='$accno2' ");
$date=date("Y-m-d");
$txn=rtxn();
$sql=mysqli_query($conn,"insert into transaction values('$date',$amt,'$accno','$accno2','$txn')");
echo "transaction sucessful";
}
}
?>
</div>
</body>
</html>