-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdeposit2.php
More file actions
148 lines (132 loc) · 3.64 KB
/
deposit2.php
File metadata and controls
148 lines (132 loc) · 3.64 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
<!DOCTYPE html>
<html><head><meta http-equiv="Content-Type" content="text/html; 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 rel="stylesheet" href="./deposit_files/animate.css">
<link rel="stylesheet" href="./deposit_files/set.css">
<title>Deposit</title>
<style>
#backs{
background-image:url("images/dep.jpg");
background-size: cover;
}
#mar{
color:black;
}
input[type=text] {
width: 40%;
height:10%
padding: 10px 18px;
margin: 8px 0;
box-sizing: border-box;
border: 3px solid #ccc;
transition: 0.5s;
outline: none;
}
input[type=password] {
width: 40%;
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;
}
#with_form{
font-size: 20px;
margin-top:50px;
margin-left:400px;
}
#with_form b{
color: black;
}
#enter{
font-size: 18px;
color:black;
margin-left: 1163px;
text-decoration: none;
border: none;
background-color: transparent;
}
#heading{
font-size:75px;
}
</style></head>
<?php $name="";$accno="";$amount="";
$print="";
if($_SERVER['REQUEST_METHOD']=="POST")
{
if(empty($_POST['name']))
{
$name="name required";
}
if(empty($_POST['accno']))
{
$accno="account number required";
}
if(empty($_POST['amount']))
{
$amount="amount required";
}
}
?>
<?php
if($_SERVER['REQUEST_METHOD']=="POST")
{
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');
$var=$_POST["name"];
$var2=$_POST["accno"];
$var3=(int)$_POST["amount"];
$sql=mysqli_query($conn,"select * from account where name='$var' and accountno='$var2'");
if(mysqli_num_rows($sql)==0)
{
$print="NO SUCH ACCOUNT EXISTS";
$name="";
$accno="";
$amount="";
}
else
{
$date=date('Y-m-d');
$txn=rtxn();
$sql=mysqli_query($conn,"update account set balance=balance+$var3 where accountno='$var2'");
$print="FORM SUBMITTED SUCESSFULLY";
$sql=mysqli_query($conn,"insert into transaction values('$date',$var3,'CASH DEPOSIT','$var2','$txn')");
}
}
?>
<body id="backs">
<div id="mar"><marquee>Be careful while typing your details to avoid any incovinience.</marquee></div>
<center>
<img src="images/logo4.png" width="400"></center><br><br>
<div id="heading"><center><b>CASH DEPOSIT</b></center></div>
<form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
<div id="with_form">
<b>NAME:</b> <input type="text" name="name" placeholder="Name" value="<?php echo $name;?>" ><br>
<b>AMOUNT:</b> <input type="text" name="amount" placeholder="Amount" value="<?php echo $amount; ?>" ><br>
<b>ACCOUNT NO:</b> <input type="text" name="accno" placeholder="Account number" value="<?php echo $accno;?>" ><br><br>
</div>
<div style="margin-left:600px">
<input type="submit" value="SUBMIT"> <button type="button" onclick="location.href='bank.html'"> Back To Bank </button>
</div >
</form>
<br><br><br><br>
<?php echo '<center> <font face="verdana" size="10" color="red" >'.$print.'</font></center>'; ?>
</body>
</html>