This repository has been archived by the owner on Aug 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
table_with_stats.php
98 lines (93 loc) · 2.41 KB
/
table_with_stats.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
<html>
<body>
<head>
<style>
table.redTable {
border: 2px solid #4AA4A0;
background-color: #EEE7DB;
width: 100%;
text-align: center;
border-collapse: collapse;
}
table.redTable td, table.redTable th {
border: 1px solid #AAAAAA;
padding: 3px 2px;
}
table.redTable tbody td {
font-size: 13px;
}
table.redTable tr:nth-child(even) {
background: #F5C8BF;
}
table.redTable thead {
background: #000000;
}
table.redTable thead th {
font-size: 19px;
font-weight: bold;
color: #003FFF;
text-align: center;
border-left: 2px solid #6B90A4;
}
table.redTable thead th:first-child {
border-left: none;
}
table.redTable tfoot {
font-size: 13px;
font-weight: bold;
color: #FFFFFF;
background: #4A4343;
}
table.redTable tfoot td {
font-size: 13px;
}
table.redTable tfoot .links {
text-align: right;
}
table.redTable tfoot .links a{
display: inline-block;
background: #FFFFFF;
color: #A40808;
padding: 2px 8px;
border-radius: 5px;
}
</style>
</head>
<?php
$username = "lazy";
$password = "bum";
$database = "autospeak";
$host = "localhost";
$mysqli = new mysqli($host, $username, $password, $database);
$query = "SELECT client_nick,connections,time_spent,idle_time_spent,client_version,client_lastconnected FROM clients";
echo '<table class ="redTable" border="0" cellspacing="2" cellpadding="2">
<tr>
<td> <font face="Arial">Nick</font> </td>
<td> <font face="Arial">Connections</font> </td>
<td> <font face="Arial">Time Spent</font> </td>
<td> <font face="Arial">Idle Time Spent</font> </td>
<td> <font face="Arial">Client Version</font> </td>
<td> <font face="Arial">Client Lastconnected</font> </td>
</tr>';
if ($result = $mysqli->query($query)) {
while ($row = $result->fetch_assoc()) {
$field1name = $row["client_nick"];
$field2name = $row["connections"];
$field3name = $row["time_spent"]/3600000;
$field4name = $row["idle_time_spent"]/3600000;
$field5name = $row["client_version"];
$field6name = $row["client_lastconnected"];
echo '<tr>
<td>'.$field1name.'</td>
<td>'.$field2name.'</td>
<td>'.$field3name.'</td>
<td>'.$field4name.'</td>
<td>'.$field5name.'</td>
<td>'.$field6name.'</td>
</tr>';
}
$result->free();
}
?>
</body>
</html>