-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin.html
125 lines (110 loc) · 3.47 KB
/
admin.html
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
116
117
118
119
120
121
122
123
124
125
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>红色家园聊天室管理后台</title>
<script type="text/javascript" src="/jquery.min.js"></script>
<script type="text/javascript" src="/socket.io/socket.io.js"></script>
<script>
var url = window.location.protocol + '//' + window.location.host;
var socket = io.connect(url);
var info;
var info2;
socket.on('userlist', function(data) {
$('#onlinelists').empty();
for(var i in data){
var ip = data[i].clientIP;
ip = '\'' + ip + '\'';
//console.log(data[i].clientIP);
if (data[i].isVIP) {
info = '<li style="color:#FFA500;" id="onlineUserName' + data[i].clientID + '">昵称: <b>' + data[i].username + '</b><br>客户端ID: ' + data[i].clientID + '<br>连接端IP: ' + data[i].clientIP + '<br><br><a href="javascript:void(0);" onclick="forbidTA(\''+ data[i].username + '\');">禁止此IP的用户登录</a> ' + '</li>';
$('#onlinelists').prepend(info);
}
else {
info = '<li id="onlineUserName' + data[i].clientID + '">昵称: <b>' + data[i].username + '</b><br>客户端ID: ' + data[i].clientID + '<br>连接端IP: ' + data[i].clientIP + '<br><br><a href="javascript:void(0);" onclick="forbidTA(\''+ data[i].username + '\');">禁止此IP的用户登录</a> ' + '</li>';
$('#onlinelists').append(info);
}
}
});
socket.on('blacklist', function(data) {
$('#forbiddenlists').empty();
for(var i in data){
info2 = data[i].username + '<br>' + data[i].clientIP + '<br><a href="javascript:void(0);" onclick="delBlack(\''+ data[i].username + '\');">删除黑名单</a><br><br>';
$('#forbiddenlists').append(info2);
}
});
socket.on('blackwords', function(data) {
$('#blackwords').empty();
for (var i in data) {
var info3 = data[i] + '<span style="color:#999;">、</span>';
$('#blackwords').append(info3);
}
});
function forbidTA(data) {
socket.emit('blackit', data);
}
function delBlack(data) {
socket.emit('delblackuser', data);
}
function refresh() {
socket.emit('admin');
}
setInterval(refresh, 10000);
$(function() {
$("#butt_send").click(function() {
socket.emit('notice', $('#message').val());
$('#message').val('');
});
$("#butt_bw").click(function() {
socket.emit('addblackword', $('#blackword').val());
$('#blackword').val('');
});
refresh();
});
</script>
<style type="text/css">
.wind{
float: left;
width: 500px;
padding: 20px;
background-color: #EAEAEA;
margin-right:20px;
}
#control{
width:100%;
margin-bottom: 20px;
}
#onlinelists li{
padding:10px;
}
#onlinelists li:hover{
background-color: #E5EEF9;
border:2px solid #1672F4;
}
</style>
</head>
<body>
<div class="wind" id="control">
<b>系统操作</b>
<br>
置顶公告发送(实时变化): <br><input type="text" id="message" value=""/>
<input type="button" value="send" id="butt_send"/>
<br><br>设置用户名过滤:<br>
<input type="text" id="blackword" value=""/>
<input type="button" value="send" id="butt_bw"/>
<div id="blackwords"></div>
</div>
<div id="onlineUser" class="wind">
<b>在线用户列表:</b>
<!--系统ID:<span id="onlineClientID"></span>
客户端IP:<span id="onlineClientIP"></span>-->
<ul id="onlinelists">
</ul>
</div>
<div id="forbiddenUser" class="wind">
<b>被禁言IP名单:</b>
<ul id="forbiddenlists">
</ul>
</div>
</body>
</html>