-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathadmin.php
More file actions
82 lines (78 loc) · 2.2 KB
/
Copy pathadmin.php
File metadata and controls
82 lines (78 loc) · 2.2 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
<!DOCTYPE html>
<?php
require("connection.php");
require_once('session.php');
require_once("./header.php");
$sql = "SELECT * FROM trees.user ORDER BY ID ASC";
$result = $conn->query($sql);
$data = array();
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$data[] = $row;
}
} else {
echo "0 results";
}
?>
<html>
<head>
<title>Table</title>
<script src="./script/jquery/jquery-3.2.1.min.js"></script>
<script src="./script/custom-javascript.js"></script>
<link rel="stylesheet" href="./bootstrap-3.3.7/css/bootstrap.min.css">
<script src="./bootstrap-3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<?php
if(isset($_SESSION['login']) && $_SESSION['login'] == true){
?>
<div class="row"><!--
<div>
<h2 class="text-center"><button type="button" class="btn btn-warning col-md-2" onclick="deleteAccount('<?php echo $_SESSION['username']; ?>')">Delete Account</button><a href="login.php">Logout</a> - <?php echo $_SESSION['username']?></h2>
</div> -->
<div class="col-md-4"></div>
<div class="col-md-5"></div>
<!-- <div class="col-md-3">
<form method="post">
<input id="search" name="search" type="text" placeholder="Type here">
<input id="submit" type="submit" value="Search">
</form>
</div> -->
</div>
<?php }
else { header('location:login.php');
}
?>
<h3>List Of Users - <a href="addEmp.php">Add</a></h3>
<table class="table table-condensed">
<thead>
<tr>
<th>Id</th>
<th>Name</th>
<th>Email</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<?php
for($i=0; $i<count($data); $i++){
?>
<tr>
<td><?php echo $data[$i]['id']?></td>
<td><?php echo $data[$i]['username']?></td>
<td><?php echo $data[$i]['email']?></td>
<td><a class="text-primary" href="addEmp.php?id=<?php echo $data[$i]['id']?>">Update</a></td>
<td><a class="text-danger" href="deletEmp.php?id=<?php echo $data[$i]['id'];?>">Delete</a></td>
</tr>
<?php }?>
</tbody>
</table>
</div>
</body>
</html>
<?php
require_once("./footer.php");
?>