-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathb2team.php
More file actions
212 lines (182 loc) · 6.83 KB
/
b2team.php
File metadata and controls
212 lines (182 loc) · 6.83 KB
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
<?php
$title = "Team management";
/* <Team> */
$b2varstoreset = array('action','standalone','redirect','profile');
for ($i=0; $i<count($b2varstoreset); $i += 1) {
$b2var = $b2varstoreset[$i];
if (!isset($$b2var)) {
if (empty($HTTP_POST_VARS["$b2var"])) {
if (empty($HTTP_GET_VARS["$b2var"])) {
$$b2var = '';
} else {
$$b2var = $HTTP_GET_VARS["$b2var"];
}
} else {
$$b2var = $HTTP_POST_VARS["$b2var"];
}
}
}
switch ($action) {
case "promote":
$standalone = 1;
require_once("./b2header.php");
if (empty($HTTP_GET_VARS["prom"])) {
header("Location: b2team.php");
}
$id = $HTTP_GET_VARS["id"];
$prom = $HTTP_GET_VARS["prom"];
$user_data=get_userdata($id);
$usertopromote_level=$user_data[13];
if ($user_level <= $usertopromote_level) {
die("Can't change the level of an user whose level is higher than yours.");
}
if ($prom == "up") {
$sql="UPDATE $tableusers SET user_level=user_level+1 WHERE ID = $id";
} elseif ($prom == "down") {
$sql="UPDATE $tableusers SET user_level=user_level-1 WHERE ID = $id";
}
$result=mysql_query($sql) or die("Couldn't change $id's level.");
header("Location: b2team.php");
break;
case "delete":
$standalone = 1;
require_once("./b2header.php");
$id = $HTTP_GET_VARS["id"];
if (!$id) {
header("Location: b2team.php");
}
$user_data=get_userdata($id);
$usertodelete_level=$user_data[13];
if ($user_level <= $usertodelete_level)
die("Can't delete an user whose level is higher than yours.");
$sql="DELETE FROM $tableusers WHERE ID = $id";
$result=mysql_query($sql) or die("Couldn't delete user #$id.");
$sql="DELETE FROM $tableposts WHERE post_author = $id";
$result=mysql_query($sql) or die("Couldn't delete user #$id's posts.");
header("Location: b2team.php");
break;
default:
$standalone=0;
include ("./b2header.php");
?>
<?php echo $blankline.$tabletop ?>
<table cellspacing="0" cellpadding="5" border="0" width="100%">
<tr>
<td>Click on an user's login name to see his/her complete Profile.<br />
To edit your Profile, click on your login name.</td>
</tr>
</table>
<?php echo $tablebottom ?>
<br />
<?php echo $tabletop ?>
<p><b>Active users</b>
<table cellpadding="5" cellspacing="0">
<tr>
<td class="tabletoprow">ID</td>
<td class="tabletoprow">Nickname</td>
<td class="tabletoprow">Name</td>
<td class="tabletoprow">E-mail</td>
<td class="tabletoprow">URL</td>
<td class="tabletoprow">Level</td>
<?php if ($user_level > 3) { ?>
<td class="tabletoprow">Login</td>
<?php } ?>
</tr>
<?php
$request = " SELECT * FROM $tableusers WHERE user_level>0 ORDER BY ID";
$result = mysql_query($request);
while($row = mysql_fetch_object($result)) {
$user_data = get_userdata2($row->ID);
echo "<tr>\n<!--".$user_data["user_login"]."-->\n";
$email = $user_data["user_email"];
$url = $user_data["user_url"];
$bg1 = ($user_data["user_login"] == $user_login) ? "style=\"background-image: url('b2-img/b2button.gif');\"" : "bgcolor=\"#dddddd\"";
$bg2 = ($user_data["user_login"] == $user_login) ? "style=\"background-image: url('b2-img/b2button.gif');\"" : "bgcolor=\"#eeeeee\"";
echo "<td $bg1>".$user_data["ID"]."</td>\n";
echo "<td $bg2><b><a href=\"javascript:profile(".$user_data["ID"].")\">".$user_data["user_nickname"]."</a></b></td>\n";
echo "<td $bg1>".$user_data["user_firstname"]." ".$user_data["user_lastname"]."</td>\n";
echo "<td $bg2> <a href=\"mailto:$email\" title=\"e-mail: $email\"><img src=\"b2-img/email.gif\" border=\"0\" alt=\"e-mail: $email\" /></a> </td>";
echo "<td $bg1> ";
if (($user_data["user_url"] != "http://") and ($user_data["user_url"] != ""))
echo "<a href=\"$url\" target=\"_blank\" title=\"website: $url\"><img src=\"b2-img/url.gif\" border=\"0\" alt=\"website: $url\" /></a> ";
echo "</td>\n";
echo "<td $bg2>".$user_data["user_level"];
if (($user_level >= 2) and ($user_level > ($user_data["user_level"] + 1)))
echo " <a href=\"b2team.php?action=promote&id=".$user_data["ID"]."&prom=up\">+</a> ";
if (($user_level >= 2) and ($user_level > $user_data["user_level"]) and ($user_data["user_level"] > 0))
echo " <a href=\"b2team.php?action=promote&id=".$user_data["ID"]."&prom=down\">-</a> ";
echo "</td>\n";
if ($user_level > 3) {
echo "<td $bg1>".$user_data["user_login"]."</td>\n";
}
echo "</tr>\n";
}
?>
</table>
</p>
<?php echo $tablebottom ?>
<?php
$request = " SELECT * FROM $tableusers WHERE user_level=0 ORDER BY ID";
$result = mysql_query($request);
if (mysql_num_rows($result)) {
?>
<br />
<?php echo $tabletop ?>
<p><b>Inactive users (level 0)</b>
<table cellpadding="5" cellspacing="0">
<tr>
<td class="tabletoprow">ID</td>
<td class="tabletoprow">Nickname</td>
<td class="tabletoprow">Name</td>
<td class="tabletoprow">E-mail</td>
<td class="tabletoprow">URL</td>
<td class="tabletoprow">Level</td>
<?php if ($user_level > 3) { ?>
<td class="tabletoprow">Login</td>
<?php } ?>
</tr>
<?php
while($row = mysql_fetch_object($result)) {
$user_data = get_userdata2($row->ID);
echo "<tr>\n<!--".$user_data["user_login"]."-->\n";
$email = $user_data["user_email"];
$url = $user_data["user_url"];
$bg1 = ($user_data["user_login"] == $user_login) ? "style=\"background-image: url('b2-img/b2button.gif');\"" : "bgcolor=\"#dddddd\"";
$bg2 = ($user_data["user_login"] == $user_login) ? "style=\"background-image: url('b2-img/b2button.gif');\"" : "bgcolor=\"#eeeeee\"";
echo "<td $bg1>".$user_data["ID"]."</td>\n";
echo "<td $bg2><b><a href=\"javascript:profile(".$user_data["ID"].")\">".$user_data["user_nickname"]."</a></b></td>\n";
echo "<td $bg1>".$user_data["user_firstname"]." ".$user_data["user_lastname"]."</td>\n";
echo "<td $bg1> <a href=\"mailto:".antispambot($email)."\" title=\"e-mail: ".antispambot($email)."\"><img src=\"b2-img/email.gif\" border=\"0\" alt=\"e-mail: ".antispambot($email)."\" /></a> </td>";
echo "<td $bg2> ";
if (($user_data["user_url"] != "http://") and ($user_data["user_url"] != ""))
echo "<a href=\"$url\" target=\"_blank\" title=\"website: $url\"><img src=\"b2-img/url.gif\" border=\"0\" alt=\"website: $url\" /></a> ";
echo "</td>\n";
echo "<td $bg1>".$user_data["user_level"];
if ($user_level >= 2)
echo " <a href=\"b2team.php?action=promote&id=".$user_data["ID"]."&prom=up\">+</a> ";
if ($user_level >= 3)
echo " <a href=\"b2team.php?action=delete&id=".$user_data["ID"]."\" style=\"color:red;font-weight:bold;\">X</a> ";
echo "</td>\n";
if ($user_level > 3) {
echo "<td $bg2>".$user_data["user_login"]."</td>\n";
}
echo "</tr>\n";
}
?>
</table>
</p>
<?php echo $tablebottom ?>
<?php
}
if ($user_level >= 3) { ?>
<br />
<?php echo $tabletop ?>
To delete an user, bring his/her level to zero, then click on the red cross.<br />
<b>Warning:</b> deleting an user also deletes all posts made by this user.
<?php echo $tablebottom ?>
<?php
}
break;
}
/* </Team> */
include($b2inc."/b2footer.php") ?>