forked from renaldi1982/android-php-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
view_user.php
115 lines (112 loc) · 1.97 KB
/
view_user.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
<?php
/**
* Displays User information
*/
?>
<html>
<head><title>View Users</title>
<style>
body {
font: normal medium/1.4 sans-serif;
}
table {
border-collapse: collapse;
width: 20%;
margin-left: auto;
margin-right: auto;
}
tr > td {
padding: 0.25rem;
text-align: center;
border: 1px solid #ccc;
}
tr:nth-child(even) {
background: #FAE1EE;
}
tr:nth-child(odd) {
background: #edd3ff;
}
tr#header{
background: #c1e2ff;
}
td#sync{
background: #fff;
}
div.header{
padding: 10px;
background: #e0ffc1;
width:30%;
color: #008000;
margin:5px;
}
div.refresh{
margin-top:10px;
width: 5%;
margin-left: auto;
margin-right: auto;
}
div#norecord{
margin-top:10px;
width: 15%;
margin-left: auto;
margin-right: auto;
}
img{
height: 32px;
width: 32px;
}
</style>
<script>
var val= setInterval(function(){
location.reload();
},2000);
</script>
</head>
<body>
<?php
include_once 'db_functions.php';
$db = new DatabaseFunction();
$result = $db->getAllUsers();
$users = $result['data'];
if ($result['flag'] != false)
$no_of_users = count($users);
else
$no_of_users = 0;
?>
<center>
<div id="link_insert_user"><a href="http://ray-renaldi.com:44400/services/insert_user.php">Add New User</a></div>
<div class="header">
View Users
<h2>There's <?= $no_of_users ?> users</h2>
</div>
</center>
<?php
if ($no_of_users > 0) {
?>
<table>
<tr id="header"><td>Id</td><td>Username</td><td>Sync Status</td></tr>
<?php
for($i = 0; $i < $no_of_users; $i++) {
?>
<tr>
<td><span><?php echo $users[$i]['id'] ?></span></td>
<td><span><?php echo $users[$i]['name'] ?></span></td>
<td id="sync"><span>
<?php
if($users[$i]['sync_status'])
{
echo "<img src='img/sync.png'/>";
}else {
echo "<img src='img/unsync.png'/>";
}
?></span></td>
</tr>
<?php } ?>
</table>
<?php }else{ ?>
<div id="norecord">
No records in MySQL DB
</div>
<?php } ?>
</body>
</html>