-
Notifications
You must be signed in to change notification settings - Fork 1
/
admin_banuser.php
218 lines (192 loc) · 7.06 KB
/
admin_banuser.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
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
213
214
215
216
217
218
<?php
// Ultimate PHP Board
// Author: Tim Hoeppner aka RR_Pilot, FixITguy
// Website: http://www.myupb.com
// Version: 2.0
// Using textdb Version: 4.3.2
require_once("./includes/upb.initialize.php");
$where = "<a href='admin.php'>Admin</a> ".$_CONFIG["where_sep"]." <a href='admin_baduser.php'>Manage banned users</a>";
require_once("./includes/header.php");
if(isset($_COOKIE["user_env"]) && isset($_COOKIE["uniquekey_env"]) && isset($_COOKIE["power_env"]) && isset($_COOKIE["id_env"])) {
if($tdb->is_logged_in() && $_COOKIE["power_env"] >= 3) {
if (isset($_GET["action"])) {
if($_GET["action"] == "edit" && $_GET["word"] != "") {
//edit banned user
$words = explode("\n", file_get_contents(DB_DIR."/banneduser.dat"));
if(($index = array_search($_GET["word"], $words)) !== FALSE) {
if(isset($_POST["newword"])) {
echo "
<div class='alert_confirm'>
<div class='alert_confirm_text'>
<strong>Editing banned user: ".$rec[0]["user_name"]."!</div><div style='padding:4px;'>";
$words[$index] = trim($_POST["newword"]);
$f = fopen(DB_DIR."/banneduser.dat", 'w');
fwrite($f, implode("\n", $words));
fclose($f);
echo "Done!</div>
</div>";
redirect("admin_banuser.php", 1);
} else {
echoTableHeading(str_replace($_CONFIG["where_sep"], $_CONFIG["table_sep"], $where), $_CONFIG);
echo "
<tr>
<th>Admin Panel Navigation</th>
</tr>";
echo "
<tr>
<td class='area_2' style='padding:20px;' valign='top'>";
require_once("admin_navigation.php");
echo "</td>
</tr>";
echoTableFooter(SKIN_DIR);
echo "<form action='admin_banuser.php?action=edit&word=".((isset($_POST["word"])) ? $_POST['word'] : $_GET['word'])."' method=POST>";
echoTableHeading("Changing banned username", $_CONFIG);
echo "
<tr>
<th colspan='2'> </th>
</tr>
<tr>
<td class='area_1' style='width:25%;padding:8px;'><strong>Change a banned username to</strong></td>
<td class='area_2'><input type=text name=newword value='$words[$index]' size=20></td>
</tr>
<tr>
<td class='footer_3' colspan='2'><img src='./skins/default/images/spacer.gif' alt='' title='' /></td>
</tr>
<tr>
<td class='footer_3a' colspan='2' style='text-align:center;'><input type=submit value='Edit'></td>
</tr>";
echoTableFooter(SKIN_DIR);
echo "</form>";
}
} else {
echo $_GET["word"]." was not found in the banned users list.";
}
} elseif($_GET["action"] == "delete" && $_GET["word"] != "") {
//delete banned user
if($_POST["verify"] == "Ok") {
// delete the user
echo "
<div class='alert_confirm'>
<div class='alert_confirm_text'>
<strong>deleting user from ban list</div><div style='padding:4px;'>";
$words = explode("\n", file_get_contents(DB_DIR."/banneduser.dat"));
if(($index = array_search($_GET["word"], $words)) !== FALSE) unset($words[$index]);
$f = fopen(DB_DIR."/banneduser.dat", 'w');
fwrite($f, implode("\n", $words));
fclose($f);
echo "Done!</div>
</div>";
if($_POST["ref"] != "") redirect($_POST["ref"], 1);
else redirect("admin_banuser.php", 1);
} elseif($verify == "Cancel") {
if($_POST["ref"] != "") redirect($_POST["ref"], 1);
else redirect("admin_banuser.php", 1);
} else {
ok_cancel("admin_banuser.php?action=delete&word=".$_GET["word"], "Are you sure you want to delete <b>".$_GET["word"]."</b> from the banned users list?<input type='hidden' name='ref' value='".$_GET["ref"]."'>");
}
} elseif($_GET["action"] == "addnew") {
//add new user
if($_POST["word"] != "") {
echo "
<div class='alert_confirm'>
<div class='alert_confirm_text'>
<strong>Adding banned user: ".$_POST['word']."!</div><div style='padding:4px;'>";
if(filesize(DB_DIR.'/banneduser.dat') > 0) {
$names = explode("\n", file_get_contents(DB_DIR."/banneduser.dat"));
} else $names = array();
$names[] = stripslashes(trim($_POST['word']));
$f = fopen(DB_DIR."/banneduser.dat", 'w');
fwrite($f, implode("\n", $names));
fclose($f);
echo "Done!</div>
</div>";
if($_POST["ref"] != "") redirect($_POST["ref"], 1);
else redirect("admin_banuser.php", 1);
} else {
echoTableHeading(str_replace($_CONFIG["where_sep"], $_CONFIG["table_sep"], $where), $_CONFIG);
echo "
<tr>
<th>Admin Panel Navigation</th>
</tr>";
echo "
<tr>
<td class='area_2' style='padding:20px;' valign='top'>";
require_once("admin_navigation.php");
echo "</td>
</tr>";
echoTableFooter(SKIN_DIR);
echo "<form action='admin_banuser.php?action=addnew' method=POST><input type='hidden' name='ref' value='".$_GET["ref"]."'>";
echoTableHeading("Banning a member", $_CONFIG);
echo "
<tr>
<th colspan='2'> </th>
</tr>
<tr>
<td class='area_1' style='width:25%;padding:8px;'><strong>Enter user name to be banned</strong></td>
<td class='area_2'><input type=text name='word' size=20 value='".$_GET['newword']."'></td>
</tr>
<tr>
<td class='footer_3' colspan='2'><img src='./skins/default/images/spacer.gif' alt='' title='' /></td>
</tr>
<tr>
<td class='footer_3a' colspan='2' style='text-align:center;'><input type=submit value='Add to ban list'></td>
</tr>";
echoTableFooter(SKIN_DIR);
echo "</form>";
}
}
} else {
$list = explode("\n", file_get_contents(DB_DIR."/banneduser.dat"));
echoTableHeading(str_replace($_CONFIG["where_sep"], $_CONFIG["table_sep"], $where), $_CONFIG);
echo "
<tr>
<th>Admin Panel Navigation</th>
</tr>";
echo "
<tr>
<td class='area_2' style='padding:20px;' valign='top'>";
require_once("admin_navigation.php");
echo "</td>
</tr>";
echoTableFooter(SKIN_DIR);
echo "
<div id='tabstyle_2'>
<ul>
<li><a href='admin_banuser.php?action=addnew' title='Add a banned user?'><span>Add a banned user?</span></a></li>
</ul>
</div>
<div style='clear:both;'></div>";
echoTableHeading("Manage banned users", $_CONFIG);
echo "
<tr>
<th colspan='3'>Managing your banned members.</th>
</tr>";
if(trim($list[0]) == "") echo "
<tr>
<td class='area_2' style='text-align:center;font-weight:bold;padding:12px;line-height:20px;' colspan='3'>No members banned.</td>
</tr>";
else {
for($i=0;$i<count($list);$i++) {
echo "
<tr>
<td class='area_1' style='width:80%'><strong>$list[$i]</strong></td>
<td class='area_2' style='width:10%'><a href='admin_banuser.php?action=edit&word=$list[$i]'>Edit</a></td>
<td class='area_2' style='width:10%'><a href='admin_banuser.php?action=delete&word=$list[$i]'>Delete</a></td>
</tr>";
}
}
echoTableFooter(SKIN_DIR);
}
} else {
echo "
<div class='alert'><div class='alert_text'>
<strong>Access Denied!</strong></div><div style='padding:4px;'>you are not authorized to be here.</div></div>";
}
} else {
echo "
<div class='alert'><div class='alert_text'>
<strong>Caution!</strong></div><div style='padding:4px;'>You are not logged in!.</div></div>";
redirect("login.php?ref=admin_basuser.php", 2);
}
require_once("./includes/footer.php");
?>