-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbbsclub.php
143 lines (137 loc) · 3.85 KB
/
bbsclub.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
<?php
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("错误的讨论区");
if(isset($_GET["page"]))
$page = $_GET["page"];
else
$page = 0;
if(isset($_GET["mode"]))
$mode = $_GET["mode"];
else
$mode = 0;
if($mode!=0)
$mode = 1;
$clubmode = bbs_club_flag($board);
if($clubmode == "1")
$mode = 0;
else if($clubmode == "2")
$mode = 1;
// here process the submit data
if(isset($_POST["clubop"]))
{
$clubop = $_POST["clubop"];
$info = $_POST["info"];
$clubops = explode("\n", $clubop);
$numop = count($clubops);
for($i=0; $i<$numop; $i++)
{
$ret = bbs_club_write($board, trim($clubops[$i]), $mode, $info);
switch($ret)
{
case -1:
html_error_quit("错误的讨论区");
case -2:
html_error_quit("你不是版主");
case -3:
html_error_quit("没有这个俱乐部");
}
}
}
$pagesize = 20;
$userlist = array();
$total = bbs_club_read($board, $mode, $page * $pagesize, $pagesize, $userlist);
switch($total)
{
case -1:
html_error_quit("系统错误");
case -2:
html_error_quit("错误的讨论区");
case -3:
html_error_quit("你不是版主");
case -4:
html_error_quit("没有这个俱乐部");
}
$count = count($userlist);
$pagecount = intval($total/$pagesize);
if($total > $pagecount*$pagesize)
$pagecount++;
bbs_board_nav_header($brdarr, "俱乐部成员管理");
?>
<script type="text/javascript">
function clubDeleteUser(userid)
{
document.getElementById("clubop").value += "\r\n-" + userid;
}
function submitclub()
{
if(confirm("确定修改这些用户的俱乐部<?php echo $mode?"写":"读"; ?>权限吗?"))
{
form1.btnsubmit.disabled = true;
form1.btnsubmit.value = "正在操作,请等待";
form1.submit();
}
}
</script>
<table class="main wide adj">
<caption>俱乐部<?php echo $mode?"写":"读"; ?>权限成员名单</caption>
<col class="center" width="80"/><col class="center" width="*"/><col class="center" width="120"/>
<tbody><tr><th>序号</th><th>用户名</th><th>操作</th></tr>
<?php
$num = $page * $pagesize + 1;
$ret = "";
for($i=0; $i<$count; $i++)
{
$ret .= "<tr><td>{$num}</td><td>{$userlist[$i]}</td>";
$ret .= "<td><a href=\"javascript:clubDeleteUser('{$userlist[$i]}');\">删除</a></td></tr>";
$num++;
}
print($ret);
?>
</tbody></table>
<div align="right">
<?php
$ret = "";
for($i=1; $i<=$pagecount; $i++)
{
if($i != $page+1)
$ret .= "<a href=\"bbsclub.php?board={$board}&mode={$mode}&page=".($i-1)."\">{$i}</a> ";
else
$ret .= "{$i} ";
}
$ret .= " 当前第" . ($page+1) . "页/共{$pagecount}页";
if($clubmode == 3)
$ret .= " [<a href=\"bbsclub.php?board={$board}&mode=".($mode?"0":"1")."\">查看" . ($mode?"读":"写") . "权限名单</a>]";
//$ret .= " [<a href=\"bbsclub.php?board={$board}&mode={$mode}&action=clear\">清空</a>]";
//$ret .= " [<a href=\"#\">群信</a>]";
$ret .= " ";
print($ret);
?>
</div>
<table width="90%" align="center">
<tr><td width="50%"><form id="form1" action="<?php echo "bbsclub.php?board={$board}&mode={$mode}" ?>" method="post">
修改成员名单:<br><div align="center"><textarea id="clubop" name="clubop" style="width:90%;height:140px"></textarea><br></div>
附加说明:<input type="text" size="20" name="info"><br><div align="center">
<input type="button" value="确定" onclick="submitclub();" id="btnsubmit"></div>
</form></td><td width="50%">
在左边的框中输入要操作的用户名,每行写一个,带“+”
号前缀的表示添加该用户,带“-”号前缀的表示删除该用户,不带前缀的默认为添加用户。以“#”号开头的行为注释,不起作用。用户名后可加空格并附加说明,不附加说明的用户将采用下面指定的全局附加说明。例如:
<br><br>
#this line has no effect<br>
+pig2532 这是猪猪猪<br>
-atppp<br>
fancyrabbit 兔子兔子!<br>
</td></tr>
</table><br><br>
<?php
page_footer();
?>