-
Notifications
You must be signed in to change notification settings - Fork 0
/
maddnew.php
172 lines (161 loc) · 6.69 KB
/
maddnew.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
<?php
session_start();
if(!isset($_SESSION['managerId'])){ header('location:login.php');}
?>
<!DOCTYPE html>
<html>
<head>
<title>Banking</title>
<?php require 'assets/autoloader.php'; ?>
<?php require 'assets/db.php'; ?>
<?php require 'assets/function.php'; ?>
<?php if (isset($_GET['delete']))
{
if ($con->query("delete from useraccounts where id = '$_GET[id]'"))
{
header("location:mindex.php");
}
} ?>
</head>
<body style="background:#000000;background-size: 100%">
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
<a class="navbar-brand" href="#">
<img src="images/logo1.jpg" width="30" height="30" class="d-inline-block align-top" alt="">
<!-- <i class="d-inline-block fa fa-building fa-fw"></i> --><?php echo bankname; ?>
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item ">
<a class="nav-link " href="mindex.php">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item "> <a class="nav-link" href="maccounts.php">Accounts</a></li>
<li class="nav-item active"> <a class="nav-link" href="maddnew.php">Add New Account</a></li>
<li class="nav-item "> <a class="nav-link" href="mfeedback.php">Feedback</a></li>
<!-- <li class="nav-item "> <a class="nav-link" href="transfer.php">Funds Transfer</a></li> -->
<!-- <li class="nav-item "> <a class="nav-link" href="profile.php">Profile</a></li> -->
</ul>
<?php include 'msideButton.php'; ?>
</div>
</nav><br><br><br>
<?php
if (isset($_POST['saveAccount']))
{
if (!$con->query("insert into useraccounts (name,cnic,accountNo,accountType,city,address,email,password,balance,source,number,branch) values ('$_POST[name]','$_POST[cnic]','$_POST[accountNo]','$_POST[accountType]','$_POST[city]','$_POST[address]','$_POST[email]','$_POST[password]','$_POST[balance]','$_POST[source]','$_POST[number]','$_POST[branch]')")) {
echo "<div claass='alert alert-success'>Failed. Error is:".$con->error."</div>";
}
else
echo "<div class='alert alert-info text-center'>Account added Successfully</div>";
}
if (isset($_GET['del']) && !empty($_GET['del']))
{
$con->query("delete from login where id ='$_GET[del]'");
}
?>
<div class="container">
<div class="card w-100 text-center shadowBlue">
<div class="card-header">
New Account Forum
</div>
<div class="card-body bg-dark text-white">
<table class="table">
<tbody>
<tr>
<form method="POST">
<th>Name</th>
<td><input type="text" name="name" class="form-control input-sm" required></td>
<th>CNIC</th>
<td><input type="number" name="cnic" class="form-control input-sm" required></td>
</tr>
<tr>
<th>Account Number</th>
<td><input type="" name="accountNo" readonly value="<?php echo time() ?>" class="form-control input-sm" required></td>
<th>Account Type</th>
<td>
<select class="form-control input-sm" name="accountType" required>
<option value="current" selected>Current</option>
<option value="saving" selected>Saving</option>
</select>
</td>
</tr>
<tr>
<th>City</th>
<td><input type="text" name="city" class="form-control input-sm" required></td>
<th>Address</th>
<td><input type="text" name="address" class="form-control input-sm" required></td>
</tr>
<tr>
<th>Email</th>
<td><input type="email" name="email" class="form-control input-sm" required></td>
<th>Password</th>
<td><input type="password" name="password" class="form-control input-sm" required></td>
</tr>
<tr>
<th>Deposit</th>
<td><input type="number" name="balance" min="500" class="form-control input-sm" required></td>
<th>Source of income</th>
<td><input type="text" name="source" class="form-control input-sm" required></td>
</tr>
<tr>
<th>Contact Number</th>
<td><input type="number" name="number" class="form-control input-sm" required></td>
<th>Branch</th>
<td>
<select name="branch" required class="form-control input-sm">
<option selected value="">Please Select..</option>
<?php
$arr = $con->query("select * from branch");
if ($arr->num_rows > 0)
{
while ($row = $arr->fetch_assoc())
{
echo "<option value='$row[branchId]'>$row[branchName]</option>";
}
}
else
echo "<option value='1'>Main Branch</option>";
?>
</select>
</td>
</tr>
<tr>
<td colspan="4">
<button type="submit" name="saveAccount" class="btn btn-primary btn-sm">Save Account</button>
<button type="Reset" class="btn btn-secondary btn-sm">Reset</button></form>
</td>
</tr>
</tbody>
</table>
</div>
<div class="card-footer text-muted">
<?php echo bankname; ?>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">New Cashier Account</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form method="POST">
Enter Details
<input class="form-control w-75 mx-auto" type="email" name="email" required placeholder="Email">
<input class="form-control w-75 mx-auto" type="password" name="password" required placeholder="Password">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="submit" name="saveAccount" class="btn btn-primary">Save Account</button>
</form>
</div>
</div>
</div>
</div>
</body>
</html>