-
Notifications
You must be signed in to change notification settings - Fork 0
/
secret.php
166 lines (153 loc) · 5.69 KB
/
secret.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
<?php
session_start();
?>
<html>
<head>
<title>Secret Tools page for bex</title>
</head>
<body>
<?php
include "include/config.php";
include "foc/functions.php";
if($_SESSION['pokemon'] == "a753c3945400cd54c7ffd35fc07fe031") {
function insert($uwid) {
$checkQuery = "SELECT * FROM leaders WHERE uwid='".$uwid."'";
$result = mysql_query($checkQuery);
if($result && mysql_num_rows($result)) {
echo "person already in leaders table";
} else {
$query = "SELECT * FROM constantinfo WHERE uwid='".$uwid."'";
$result = mysql_query($query);
if($result && mysql_num_rows($result)) {
$stuff = mysql_fetch_assoc($result);
$query = "INSERT INTO leaders (appid,uwid,uwname,fname,lname,pname,email,faculty,program,phone,addressw,addressp,faid) VALUES (".$stuff['lid'].",".$stuff['uwid'].",\"".$stuff['uwname']."\",\"".$stuff['fname']."\",\"".$stuff['lname']."\",\"".$stuff['pname']."\",\"".$stuff['email']."\",\"".$stuff['faculty']."\",\"".$stuff['program']."\",\"".$stuff['phone']."\",\"".$stuff['addressw']."\",\"".$stuff['addressp']."\",".$stuff['faid'].")";
$add_profile = "INSERT INTO leader_profiles(lid) select id from leaders where uwid='".$uwid."'";
$result = mysql_query($query) && mysql_query($add_profile);
if($result)
echo "Added<br />";
else
echo "Failed<br />".mysql_error();
} else {
echo "That person doesn't exist";
}
}
}
function remove($uwid,$state) {
$leader = "UPDATE leaders SET state='".$state."' WHERE uwid='".$uwid."'";
$profile = "DELETE FROM leader_profiles WHERE lid=(SELECT id FROM leaders WHERE uwid='".$uwid."')";
if(mysql_query($profile) && mysql_query($leader)) {
echo "Update complete";
} else {
echo "Update failed<br /><br />".mysql_error();
}
}
if($_POST['moo']) {
insert($_POST['person']);
} else if($_POST['remove']) {
remove($_POST['uwid'],$_POST['state']);
} else if($_POST['se']) {
if($_POST['pname'] == "")
$_POST['pname'] = $_POST['fname'];
$query = "INSERT INTO leaders (uwid,uwname,fname,lname,pname,email,faculty,program) VALUES (".$_POST['uwid'].",\"".$_POST['uwname']."\",\"".$_POST['fname']."\",\"".$_POST['lname']."\",\"".$_POST['pname']."\",\"".$_POST['email']."\",\"Engineering\",\"Software\")";
$result = mysql_query($query);
if($result)
echo "Softie added<br />";
else
echo "Failed adding softie :(<br />";
} elseif($_POST['changeteam']) {
$success = true;
$uwids = explode(',',$_POST['uwids']);
foreach($uwids as $uwid) {
$query = "UPDATE leaders SET team='".$_POST['team']."' WHERE uwid='".$uwid."';";
if(!mysql_query($query))
$success = false;
}
echo ($success) ? "Updated passed" : "Update failed";
} elseif($_POST['changerole']) {
$success = true;
$uwids = explode(',',$_POST['uwids']);
foreach($uwids as $uwid) {
if($_POST['role'] > 100)
$query = "UPDATE leaders SET cpos='".($_POST['role']-100)."' WHERE uwid='".$uwid."'";
else
$query = "UPDATE leaders SET lpos='".$_POST['role']."' WHERE uwid='".$uwid."'";
if(!mysql_query($query))
$success = false;
}
echo ($success) ? "Updated passed" : "Update failed";
}
?>
<h3>Secret Tools Page</h3>
<p>Add leader from constantinfo to leaders by uwid</p>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="text" name="person" maxlength="8" />
<input type="submit" name="moo" value="Enter them" />
</form>
<p>Remove a leader (set state to withdrawn or banned)</p>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="text" name="uwid" /><select name="state"><option value="withdrawn">Withdrawn</option><option value="banned">Banned</option></select><br />
<input type="submit" name="remove" value="Set state & Remove profile" />
</form>
<!--<p>Add a leader (SE mostly) only knowing this information</p>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
ID: <input type="text" name="uwid" value="00000000" /><br />
UWNAME: <input type="text" name="uwname" /><br />
FNAME: <input type="text" name="fname" /><br />
LNAME: <input type="text" name="lname" /><br />
PNAME: <input type="text" name="pname" /><br />
EMAIL: <input type="text" name="email" /><br />
<input type="submit" name="se" value="Add Softie" />
</form>-->
<h3>Assign leader teams by uwid</h3>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
List of ID's separated by commas:<br />
<textarea name="uwids" style="width:300px;height180px;"></textarea><br /><br />
<select name="team">
<?php
$teams = getTeams(array('leader','other','blacktie'));
foreach($teams as $t) {
echo "\t<option value=\"".$t['tid']."\">".$t['displayname']."</option>\n";
}
?>
</select> <br />
<input type="submit" name="changeteam" value="Change teams" />
</form>
<h3>Assign leader roles by UWID</h3>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
List of ID's separated by commas:<br />
<textarea name="uwids" style="width:300px;height180px;"></textarea><br /><br />
<select name="role">
<?php
$lpos = getLPositions();
$cpos = getCPositions();
foreach($lpos as $t) {
echo "\t<option value=\"".$t['id']."\">".$t['position_name']."</option>\n";
}
foreach($cpos as $t) {
echo "\t<option value=\"";
echo $t['id']+100;
echo "\">".$t['position_name']."</option>\n";
}
?>
</select> <br />
<input type="submit" name="changerole" value="Change Roles" />
</form>
<?php
// Woo security by obscruity!
} elseif($_SERVER['QUERY_STRING'] == "combee") {
if($_POST['submit']) {
$_SESSION['pokemon'] = md5($_POST['poke']);
echo "<a href=\"secret.php\">Vaporeon!</a>";
} else {
echo "Login:<br /><br />";
echo "<form method='post' action='".$_SERVER['PHP_SELF']."?combee'>";
echo "<input type=\"password\" name=\"poke\" />";
echo "<input type=\"submit\" name=\"submit\" value=\"Enter the secret lair\" />";
echo "</form>";
}
} else {
echo "Mew!";
}
?>
</body>
</html>