-
Notifications
You must be signed in to change notification settings - Fork 0
/
maccounts.php
125 lines (118 loc) · 4.52 KB
/
maccounts.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
<?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 active"> <a class="nav-link" href="maccounts.php">Accounts</a></li>
<li class="nav-item "> <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 login (email,password,type) values ('$_POST[email]','$_POST[password]','cashier')")) {
echo "<div claass='alert alert-success'>Failed. Error is:".$con->error."</div>";
}
}
if (isset($_GET['del']) && !empty($_GET['del']))
{
$con->query("delete from login where id ='$_GET[del]'");
}
$array = $con->query("select * from login where type='cashier'");
?>
<div class="container">
<div class="card w-100 text-center shadowBlue">
<div class="card-header">
All Staff Accounts <button class="btn btn-outline-success btn-sm float-right" data-toggle="modal" data-target="#exampleModal">Add New Account</button>
</div>
<div class="card-body">
<table class="table table-bordered">
<thead>
<tr>
<th>Email</th>
<th>Password</th>
<th>Account Type</th>
<th></th>
</tr>
</thead>
<tbody>
<?php
if ($array->num_rows > 0)
{
while ($row = $array->fetch_assoc())
{
echo "<tr>";
echo "<td>".$row['email']."</td>";
echo "<td>".$row['password']."</td>";
echo "<td>".$row['type']."</td>";
echo "<td><a href='maccounts.php?del=$row[id]' class='btn btn-danger btn-sm'>Delete</a></td>";
echo "</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>