-
Notifications
You must be signed in to change notification settings - Fork 7
/
modifyrecruit.php
138 lines (137 loc) · 4.14 KB
/
modifyrecruit.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
<?php
session_name("icsession");
session_start();
include('db.php');
include('varset.php');
$getguild = mysql_query("SELECT * FROM guilds WHERE name='".$charguild."'");
$guild = mysql_fetch_assoc($getguild);
if($charname == $guild['leader'] || $charname == $guild['coleader'])
{
if($_POST['modify'] == "recruit")
{
if($guild['recruiting'] == "Yes")
{
$set = "No";
}
else
{
$set = "Yes";
}
$setguild = mysql_query("UPDATE guilds SET recruiting='".$set."' WHERE name='".$char['guild']."'");
}
elseif($_POST['modify'] == "accept")
{ if($guild['accept'] == "Approve")
{
$set = "Auto";
}
else
{
$set = "Approve";
}
$setguild = mysql_query("UPDATE guilds SET accept='".$set."' WHERE name='".$charguild."'");
}
elseif($_POST['modify'] == "applicant")
{
if($charname == $guild['leader'] || $charname == $guild['coleader'] || $charname == $guild['captain'])
{
$username = $_POST['username'];
$getuser = mysql_query("SELECT * FROM characters WHERE username='".$username."' AND guild='None'");
if(mysql_num_rows($getuser) == "1")
{
$getapplication = mysql_query("SELECT * FROM applications WHERE username='".$username."'");
if(mysql_num_rows($getapplication) == "1")
{
$updateapplicant = mysql_query("UPDATE characters SET guild='".$guild['name']."' WHERE username='".$username."'");
$deleteapplication = mysql_query("DELETE FROM applications WHERE username='".$username."'");
}
}
}
}
elseif($_POST['modify'] == "kick")
{
if($charname == $guild['leader'] || $charname == $guild['coleader'])
{
$username = $_POST['username'];
$getuser = mysql_query("SELECT * FROM characters WHERE username='".$username."' AND guild='".$guild['name']."'");
if(mysql_num_rows($getuser) == "1")
{
if($username != $guild['leader'])
{
$getmember = mysql_query("SELECT * FROM characters WHERE username='".$username."'");
if(mysql_num_rows($getmember) == "1")
{
$updateapplicant = mysql_query("UPDATE characters SET guild='None' WHERE username='".$username."'");
if($username == $guild['coleader'])
{
$updateguild = mysql_query("UPDATE guilds SET coleader='' WHERE name='".$charguild."'");
}
if($username == $guild['captain'])
{
$updateguild = mysql_query("UPDATE guilds SET captain='' WHERE name='".$charguild."'");
}
}
}
}
}
}
elseif($_POST['modify'] == "promote")
{
$username = $_POST['username'];
$getuser = mysql_query("SELECT * FROM characters WHERE username='".$username."' AND guild='".$guild['name']."'");
if(mysql_num_rows($getuser) == "1")
{
if($charname == $guild['leader'])
{
if($username != $guild['leader'])
{
if($username == $guild['captain']) //Make Co-Leader
{
$updateguild = mysql_query("UPDATE guilds SET coleader='".$username."', captain='' WHERE name='".$charguild."'");
}
else //Make Captain
{
$updateguild = mysql_query("UPDATE guilds SET captain='".$username."' WHERE name='".$charguild."'");
}
}
}
elseif($charname == $guild['coleader'])
{
if($username != $guild['leader'] && $username != $guild['coleader'])
{
$updateguild = mysql_query("UPDATE guilds SET captain='".$username."' WHERE name='".$charguild."'");
}
}
}
}
elseif($_POST['modify'] == "demote")
{
$username = $_POST['username'];
$getuser = mysql_query("SELECT * FROM characters WHERE username='".$username."' AND guild='".$guild['name']."'");
if(mysql_num_rows($getuser) == "1")
{
if($charname == $guild['leader'])
{
if($username != $guild['leader'])
{
if($username == $guild['coleader']) //Make Captain
{
$updateguild = mysql_query("UPDATE guilds SET coleader='', captain='".$username."' WHERE name='".$charguild."'");
}
else //Make Member
{
$updateguild = mysql_query("UPDATE guilds SET captain='' WHERE name='".$charguild."'");
}
}
}
elseif($charname == $guild['coleader'])
{
if($username != $guild['leader'] && $username != $guild['coleader'])
{
$updateguild = mysql_query("UPDATE guilds SET captain='' WHERE name='".$charguild."'");
}
}
}
}
print("viewGuild();");
}
?>