-
Notifications
You must be signed in to change notification settings - Fork 0
/
accountManagement.php
79 lines (59 loc) · 1.37 KB
/
accountManagement.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
<?php
require_once('includes/globals.inc');
emitTop('Peanut Butter -> Account -> Management', $_SERVER['PHP_SELF']);
if($userType == SITEADMIN)
{
?>
<h2>Site users</h2>
<table class="list">
<thead>
<tr>
<th>User</th>
<th>User Type</th>
<th>Created</th>
<th>Delete User</th>
<th>Promote/Demote User</th>
</tr>
</thead>
<tbody>
<?php
mysqlSetup();
$sqlquery = "SELECT `name`,`category`,`created` FROM `pb_users` ORDER BY `name` ASC";
$result = mysql_query($sqlquery) or die('Invalid query: ' . mysql_error());
$rownum = 0;
while($row = mysql_fetch_row($result))
{
print("<tr>");
$style = '';
if($rownum++ % 2 == 0)
$style = ' class="greyed"';
foreach($row as $value)
print("\t<td$style>$value</td>\n");
$urlname = urlencode($row[0]);
if($row[0] == $userName)
print("<td$style>------</td>\n");
else
print("\t<td$style><a href=\"userDelete.php?name=$urlname\">Delete</a></td>\n");
if($row[1] == NORMAL)
{
print("<td$style><a href=\"usertypeChange.php?type=promote&"
. "name=$urlname\">Promote to admin</a></td>");
}
elseif($row[1] == ADMIN)
{
print("<td$style><a href=\"usertypeChange.php?type=demote&"
. "name=$urlname\">Demote to normal user</a></td>");
}
elseif($row[1] == SITEADMIN)
{
print("<td$style>------</td>\n");
}
}
mysql_close();
?>
</tbody>
</table>
<?php
}
emitBottom();
?>