-
Notifications
You must be signed in to change notification settings - Fork 2
/
bbsdeny.php
181 lines (175 loc) · 4.99 KB
/
bbsdeny.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<?php
$denyreasons = array(
'灌水',
'干扰版面讨论秩序',
'言语粗俗',
'人身攻击',
'开启无关话题',
'发表不恰当文章',
'test(在征得对方同意后供测试封禁使用)'
);
require("www2-funcs.php");
require("www2-board.php");
login_init();
bbs_session_modify_user_mode(BBS_MODE_READING);
if (isset($_GET["board"]))
$board = $_GET["board"];
else
html_error_quit("错误的讨论区");
$brdarr = array();
$bid = bbs_getboard($board, $brdarr);
if ($bid == 0)
html_error_quit("错误的讨论区");
$usernum = $currentuser["index"];
if (!bbs_is_bm($bid, $usernum))
html_error_quit("你不是版主");
$board = $brdarr['NAME'];
$brd_encode = urlencode($board);
$maxreason = bbs_getdenyreason($board, $denyreasons, 1);
bbs_board_nav_header($brdarr, "封禁名单");
if (isset($_GET['act'])) {
switch ($_GET['act']) {
case 'del':
$userid = ltrim(trim($_GET['userid']));
if (!$userid)
html_error_quit("请输入解封用户的ID");
switch (bbs_denydel($board,$userid)) {
case -1:
case -2:
html_error_quit("讨论区错误");
break;
case -3:
html_error_quit($userid." 不在封禁列表中");
break;
default:
}
break;
case 'add':
$userid = ltrim(trim($_POST['userid']));
$denyday = intval($_POST['denyday']);
$exp = (trim($_POST['exp2']))?trim($_POST['exp2']):$denyreasons[intval($_POST['exp'])]['desc'];
if (!$userid || !$denyday || !$exp)
break;
if (!strcasecmp($userid,'guest') || !strcasecmp($userid,'SYSOP'))
html_error_quit("不能封禁 ".$userid);
switch (bbs_denyadd($board,$userid,$exp,$denyday,0)) {
case -1:
case -2:
html_error_quit("讨论区错误");
break;
case -3:
html_error_quit("不正确的使用者ID");
break;
case -4:
html_error_quit("用户 ".$userid." 已在封禁列表中");
break;
case -5:
html_error_quit("封禁时间错误");
break;
case -6:
html_error_quit("请输入封禁理由");
break;
case -7:
html_error_quit($userid."没有在本版的发表权限, 不能封禁");
break;
default:
}
break;
case 'mod':
$userid = ltrim(trim($_POST['userid']));
$denyday = intval($_POST['denyday']);
$exp = (trim($_POST['exp2']))?trim($_POST['exp2']):$denyreasons[intval($_POST['exp'])]['desc'];
if (!$userid || !$denyday || !$exp)
break;
if (!strcasecmp($userid,'guest') || !strcasecmp($userid,'SYSOP'))
html_error_quit("不能封禁 ".$userid);
switch (bbs_denymod($board,$userid,$exp,$denyday,0)) {
case -1:
case -2:
html_error_quit("讨论区错误");
break;
case -3:
html_error_quit("不正确的使用者ID");
break;
case -4:
html_error_quit("用户 ".$userid." 不在封禁列表中");
break;
case -5:
html_error_quit("封禁时间错误");
break;
case -6:
html_error_quit("请输入封禁理由");
break;
case -7:
html_error_quit($userid."没有在本版的发表权限, 不能封禁");
break;
default:
}
break;
default:
}
}
$denyusers = array();
$ret = bbs_denyusers($board,$denyusers);
switch ($ret) {
case -1:
html_error_quit("系统错误,请联系管理员");
break;
case -2:
html_error_quit("错误的讨论区");
break;
case -3:
html_error_quit("您尚无权限");
break;
default:
}
$maxdenydays = ($currentuser["userlevel"]&BBS_PERM_SYSOP)?70:14;
?>
<table class="main wide adj">
<caption>封禁名单</caption>
<col class="center" width="60"/><col class="center" width="100"/><col width="*"/><col class="center" width="150"/><col class="center" width="60"/>
<tbody><tr><th>序号</th><th>用户名</th><th>理由</th><th>说明</th><th>修改</th><th>解封</th></tr>
<?php
$i = 1;
foreach ($denyusers as $user) {
echo '<tr><td>'.$i.'</td><td><a href="bbsqry.php?userid='.$user['ID'].'">'.$user['ID'].'</a></td>'.
'<td>'.htmlspecialchars($user['EXP']).' </td>'.
'<td>'.htmlspecialchars($user['COMMENT']).'</td>'.
'<td><a href="bbsmodifydeny.php?board='.$brd_encode."&user=".htmlspecialchars($user['ID']).'">修改</a></td>'.
'<td><a onclick="return confirm(\'确实解封吗?\')" href="'.$_SERVER['PHP_SELF'].'?board='.$brd_encode.'&act=del&userid='.$user['ID'].'">解封</a></td>'.
'</tr>';
$i ++ ;
}
?>
</tbody></table>
<form action="<?php $_SERVER['PHP_SELF']; ?>?act=add&board=<?php echo $brd_encode; ?>" method="post" class="medium">
<fieldset><legend>添加封禁用户</legend>
<div class="inputs">
<label>用户名</label><input type="text" name="userid" size="12" maxlength="12" /><br/>
<label>封禁时间</label><select name="denyday">
<?php
$i = 1;
while ($i <= $maxdenydays) {
echo '<option value="'.$i.'">'.$i.'</option>';
$i += ($i >= 14)?7:1;
}
?>
</select>天<br/>
<label>封禁原因</label><select name="exp">
<?php
$i = 0;
foreach ($denyreasons as $reason) {
echo '<option value="'.$i.'">'.htmlspecialchars($reason['desc']).'</option>';
$i ++;
}
?>
</select> <a href="bbsdenyreason.php?board=<?php echo $board; ?>">自定封禁理由</a><br />
或手动输入封禁理由:
<input type="text" name="exp2" size="20" maxlength="28" />
</div>
<div class="oper"><input type="submit" value="添加封禁" /></div>
</fieldset>
</form>
<?php
page_footer(FALSE);
?>