forked from modi1231/DIC_Text_Based_Mafia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Staff.php
161 lines (133 loc) · 4.72 KB
/
Staff.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
<?php require("Left.php"); ?>
<html>
<head>
</head>
<body>
<?php if(isset($_POST['Add_admin'])){
if(empty($_POST['admin'])){
echo "You didn't enter a name.";
}else{
if (in_array($_POST['admin'], $admin_array)) {
echo "This person is already a admin.";
}else{
$sql = "SELECT name FROM users WHERE name='".mysql_real_escape_string($_POST['admin'])."'";
$query = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_object($query);
$admin_name = htmlspecialchars($row->name);
if(empty($admin_name)){
echo "This users doenst exist";
}else{
if(empty($admins)){
$result = mysql_query("UPDATE sitestats SET admins='".mysql_real_escape_string($admin_name)."' ,admins_ip='".mysql_real_escape_string($_SERVER['REMOTE_ADDR'])."' WHERE id='1'")
or die(mysql_error());
$admins = $admin_name;
}else{
$new_admin = $admins."-".$admin_name;
$new_ip = $admins_ip."-".$_SERVER['REMOTE_ADDR'];
$result = mysql_query("UPDATE sitestats SET admins='".mysql_real_escape_string($new_admin)."' ,admins_ip='".mysql_real_escape_string($new_ip)."' WHERE id='1'")
or die(mysql_error());
$admins = $new_admin;
}
echo "You added ".$admin_name." as new admin.";
}// if empty field.
}// if exist check.
}// if already in check.
}// if isset.
if(isset($_POST['Remove_admin'])){
if(empty($_POST['admin_name'])){
echo "You didn't select a person to demote from admin.";
}else{
if (!in_array($_POST['admin_name'], $admin_array)) {
echo "This person isn't a admin.";
}else{
$new_admin = "";
foreach( $admin_array as $key => $value){
if($value != $_POST['admin_name']){
if(empty($new_admin)){
$new_admin = $value;
}else{
$new_admin = $new_admin."-".$value;
}
}
}
$new_ip = "";
foreach( $admin_ip_array as $key => $value){
if($value != $_POST['admin_name']){
if(empty($new_ip)){
$new_ip = $value;
}else{
$new_ip = $new_ip."-".$value;
}
}
}
$result = mysql_query("UPDATE sitestats SET admins='".mysql_real_escape_string($new_admin)."' ,admins_ip='".mysql_real_escape_string($new_ip)."' WHERE id='1'")
or die(mysql_error());
$result = mysql_query("UPDATE users SET state='0' WHERE id='".mysql_real_escape_string($new_admin)."'")
or die(mysql_error());
$admins = $new_admin;
echo "You removed ".$_POST['admin_name']." from his admin position.";
}// if no friend selected.
}// if not in friendslist.
}// if isset.
?>
<?php if (in_array($name, $admin_array)){
?>
<form name="form1" method="post" action="">
<table width="90%" border="1" >
<tr>
<td colspan="4" align="left" >Admins</td>
</tr>
<tr>
<td colspan="4" align="center" ><?php
if(empty($admins)){
echo "There are no admins.";
}else{
$admins_list = explode("-", $admins);
foreach( $admins_list as $key => $value){
echo "<input name=\"admin_name\" type=\"radio\" value=\"".$value."\" onFocus=\"if(this.blur)this.blur()\">".$value."";
}
}// if no friends.
?></td>
</tr>
<tr>
<td width="50" align="left" ><b>Name:</b></td>
<td align="center" ><input name="admin" type="text" id="admin" style='width: 95%; ' maxlength="20" /></td>
<td width="100" align="right" ><input name="Add_admin" type="submit" id="Add_admin" value="Add." onFocus="if(this.blur)this.blur()" /></td>
<td width="100" align="right" ><input name="Remove_admin" type="submit" id="Remove_admin" value="Remove." onFocus="if(this.blur)this.blur()"/></td>
</tr>
</table>
<br>
<table width="90%" border="1" >
<tr>
<td colspan="4" align="left" >MOD List: </td>
</tr>
<tr>
<td height="20" colspan="4" align="center" >Names of Mods will appear here</td>
</tr>
<tr>
<td width="50" align="left" ><b>Name:</b></td>
<td align="center" ><input name="Mod" type="text" id="Mod" style='width: 95%; ' maxlength="20" /></td>
<td width="100" align="right" ><input name="Add_mod" type="submit" id="Add_mod" value="Add." onFocus="if(this.blur)this.blur()" /></td>
<td width="100" align="right" ><input name="Remove_Mod" type="submit" id="Remove_Mod" value="Remove." onFocus="if(this.blur)this.blur()"/></td>
</tr>
</table>
<br>
<table width="90%" border="1" >
<tr>
<td colspan="4" align="left" >Hdo List: </td>
</tr>
<tr>
<td colspan="4" align="center" >Names of HDOs will appear here</td>
</tr>
<tr>
<td width="50" align="left" ><b>Name:</b></td>
<td align="center" ><input name="hdo" type="text" id="hdo" style='width: 95%; ' maxlength="20" /></td>
<td width="100" align="right" ><input name="Add_hdo" type="submit" id="Add_hdo" onFocus="if(this.blur)this.blur()" value="Add." /></td>
<td width="100" align="right" ><input name="Remove_hdo" type="submit" id="Remove_hdo" value="Remove." onFocus="if(this.blur)this.blur()"/></td>
</tr>
</table>
</form>
<?php } ?>
</body>
</html>
<?php require("Right.php"); ?>