-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathusers.php
75 lines (69 loc) · 2.59 KB
/
users.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
<?php
require 'includes/snippet.php';
require 'includes/db-inc.php';
include "includes/header.php";
include "includes/nav.php";
if(isset($_POST['del'])){
$id = sanitize(trim($_POST['id']));
$sql_del = "DELETE from admin where adminId = $id";
$error = false;
$result = mysqli_query($conn,$sql_del);
if ($result)
{
$error = true;
}
}
?>
<div class="container">
<!-- navbar ends -->
<!-- info alert -->
<div class="alert alert-warning col-lg-7 col-md-12 col-sm-12 col-xs-12 col-lg-offset-2 col-md-offset-0 col-sm-offset-1 col-xs-offset-0" style="margin-top:70px">
<h4 class="center-block">Admins</h4>
</div>
</div>
<div class="container">
<div class="panel panel-default">
<!-- Default panel contents -->
<div class="panel-heading">
<?php if(isset($error)===true) { ?>
<div class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<strong>Record Deleted Successfully!</strong>
</div>
<?php } ?>
<div class="row">
<a href="adduser.php"><button class="btn btn-success col-lg-3 col-md-4 col-sm-11 col-xs-11 button" style="margin-left: 15px;margin-bottom: 5px"><span class="glyphicon glyphicon-plus-sign"></span> ADD ANOTHER ADMIN</button></a>
</div>
</div>
<table class="table table-bordered">
<thead>
<tr>
<th>Admin Id</th>
<th>Admin Name</th>
<th>Password</th>
<th>Username</th>
<th>Email</th>
<th>Actions</th>
</tr>
</thead>
<?php
$sql = "SELECT * from admin";
$query = mysqli_query($conn, $sql);
$counter = 1;
while($row=mysqli_fetch_array($query)){ ?>
<tbody>
<td> <?php echo $counter++ ?></td>
<td> <?php echo $row['adminName']?></td>
<td> <?php echo $row['password']?></td>
<td> <?php echo $row['username']?></td>
<td> <?php echo $row['email']?></td>
<form method='post' action='users.php'>
<input type='hidden' value="<?php echo $row['adminId']; ?>" name='id'>
<td><button name='del' type='submit' value='Delete' class='btn btn-warning' onclick='return Delete()'>DELETE</button></td>
</form>
</tbody>
<?php } ?>
</table>
</div>
</div>
<?php include 'includes/footer.php'; ?>