-
Notifications
You must be signed in to change notification settings - Fork 6
/
status.jsp
55 lines (49 loc) · 1.27 KB
/
status.jsp
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
<%@page import="protocol.*"%>
<%@page import="java.sql.*"%>
<%@include file="WEB-INF/.pwadminconf.jsp"%>
<head>
<link rel="shortcut icon" href="include/fav.ico">
<link rel="stylesheet" type="text/css" href="include/style.css">
<meta http-equiv="refresh" content="30" >
<%
String status = "<font color=\"#00cc00\">Online</font>";;
String users;
int count = 0;
try
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection connection = DriverManager.getConnection("jdbc:mysql://" + db_host + ":" + db_port + "/" + db_database, db_user, db_password);
Statement statement = connection.createStatement();
ResultSet rs = statement.executeQuery("SELECT COUNT(*) FROM users");
rs.next();
count = rs.getInt(1);
rs.close();
statement.close();
connection.close();
}
catch(Exception e)
{
count = -1;
}
try
{
Integer[] user = new Integer[3];
DeliveryDB.GetMaxOnlineNum(user);
if(user[2] == null)
{
status = "<font color=\"#ee0000\">Offline</font>";
user[2] = 0;
}
users = user[2] + " / " + count;
}
catch(Exception e)
{
users = "-1" + " / " + count;
}
%>
</head>
<body style="margin: 0;">
Status: <b><%out.print(status);%></b>
<br>
Users: <font color="#000000"><b><%out.print(users);%></b></font>
</body>