-
Notifications
You must be signed in to change notification settings - Fork 2
/
admin_controller.php
146 lines (119 loc) · 6.44 KB
/
admin_controller.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
<?php
switch($pageref){
case 'deleteco':
$qry = "select id from ships where co=$co";
$allshipsqry = mysql_query($qry,$link)
or die(mysql_error() . "<br>while<br>$qry");
$allships = mysql_fetch_array($allshipsqry);
while($allships != 0){
$qry = "update ships set co=0 where id=$allships[0]";
mysql_query($qry,$link)
or die(mysql_error() . "<br>while<br>$qry");
//echo($qry);
$allships = mysql_fetch_array($allshipsqry);
}
mysql_query($qry,$link)
or die(mysql_error() . "<br>while<br>$qry");
header("Location: admintemplate.php?pageref=switchboard");
break;
case 'delship':
$qry = "delete from crewlist where ship=$shipid";
mysql_query($qry,$link)
or die(mysql_error() . "<br>while<br>$qry");
$qry = "delete from monthrep where ship=$shipid";
mysql_query($qry,$link)
or die(mysql_error() . "<br>while<br>$qry");
$qry = "delete from ships where id=$shipid";
mysql_query($qry,$link)
or die(mysql_error() . "<br>while<br>$qry");
header("Location: admintemplate.php?pageref=switchboard");
break;
case 'addship':
$qry = "insert into ships (id, name, registry, class, website, co, xo, mco, grp, status, image, sorder, lastmreport, missiontitle, shiprole) values(
NULL,
'$shipname',
'$registry',
'$shipclass',
'none',
0,0,0,100,
'Waiting for a CO',
'ships/imagena.jpg',
$sorder,'2000-01-01','Waiting for a CO',''
)";
mysql_query($qry,$link)
or die(mysql_error() . "<br>while<br>$qry");
header("Location: admintemplate.php?pageref=switchboard");
break;
case 'manageship':
header("Location: cotemplate.php?pageref=switchboard\nSet-Cookie: " . $randomstr . "=" . $cosid . "\n");
break;
case 'edit_ship_engine':
$qry = "UPDATE ships SET ";
$qry .= "name='" . addslashes($name) . "',";
$qry .= "registry='" . addslashes($registry) . "',";
$qry .= "class='" . addslashes($class) . "',";
$qry .= "website='" . addslashes($website) . "',";
$qry .= "co=" . $cosid . ",";
$qry .= "grp=" . $grpid . ",";
$qry .= "status='" . addslashes($status) . "',";
$qry .= "missiontitle='" . addslashes($mission) . "',";
$qry .= "sorder='" . addslashes($sorder) . "',";
$qry .= "lastmreport='" . addslashes($lastreport) . "',";
$qry .= "shiprole='" . addslashes($shiprole) . "',";
$qry .= "image='" . $image . "' where id=" . $shipid;
$insqry = mysql_query($qry,$link)
or die(mysql_error() . "<br>while<br>$qry");
mysql_close($link);
header("Location: admintemplate.php?pageref=switchboard");
break;
case 'edit_co_engine':
$qry = "UPDATE co SET " .
"charname='". addslashes($charname) . "'" .
",rank=" . $rank.
",email='" . $email . "'" .
",password='" . addslashes($password) . "'" .
",realname='" . addslashes($realname) . "'" .
",race='" . addslashes($race) . "'" .
",tfrole='" . addslashes($tfrole) . "'" .
" WHERE id=" . $id;
$coqry = mysql_query($qry,$link) or die(mysql_error() . "<br>during<br>$qry");
Header("Location: admintemplate.php?pageref=switchboard");
break;
case 'manage_grp_engine':
$qry = "SELECT id FROM ships WHERE co=" . $frmcoid;
$shipqry = mysql_query($qry,$link) or die("Can't get ships");
$ship = mysql_fetch_array($shipqry);
//$selectqry = $qry;
$qry = "UPDATE grp SET co=" . $frmcoid . ",flagship=" . $ship[0] . ",name='$name' WHERE id=" . $grpid;
$updateqry = mysql_query($qry,$link) or die(mysql_error());
mysql_close($link);
header("Location: admintemplate.php?pageref=switchboard");
//$pageref = "status";
break;
case 'welcome_co':
$qry = "SELECT charname, rank.rankdesc, email, password FROM co inner join rank on co.rank=rank.rankid WHERE id=" . $co;
$coqry = mysql_query($qry,$link) or die("Can't get CO information");
$coq = mysql_fetch_array($coqry);
$mailerto = $coq[2] . "," . $OTHERwelcome;
$mailersubject= "Welcome to $taskforce_sn! ";
$mailerbody = "$coq[1] $coq[0],\n\n";
$mailerbody = $mailerbody . "Welcome to Taskforce 72, Bravo Fleet. You're Command application has been accepted and you have been given the starting rank of $coq[1]. ";
$mailerbody = $mailerbody . "Now that you are prepared to become a Commanding Officer in our Task Force you'll need to attend the Bravo Fleet Command Academy. I will send you the information on it soon. \n\n";
$mailerbody = $mailerbody . "In the mean time you are encouraged to simm with the staff of our Starbase DS12. Captain Harper is the CO there. Her email address is [email protected]. ";
$mailerbody = $mailerbody . "Captain Harper has also received a copy of this mail. Expect her to add you to her mailing list within a few days. \n\n";
$mailerbody = $mailerbody . "You may also begin logging into the CO's Lounge on the TF72 website (http://www.taskforce72.net/cotemplate.php?pageref=switchboard). \n";
$mailerbody = $mailerbody . "Your login name is the email address you are receiving this at, and your password is \"$coq[3]\" without the quotes. ";
$mailerbody = $mailerbody . "The Lounge is where you will keep a roster of your crew for myself, the TFXO and your TGCO to use, plus the Recruitment Officer uses this to determine needed positions to advertise for. Please keep your roster in the lounge as up to date as possible. ";
$mailerbody = $mailerbody . "Thanks for joining us, and let us know if you have any problems.\n\n";
$mailerbody = $mailerbody . "Regards, \n\n";
$mailerbody = $mailerbody . "VAdm Robert M Chadwick \n";
$mailerbody = $mailerbody . "Task Force Commanding Officer \n";
$mailerbody = $mailerbody . "Task Force 72 - Bravo Fleet ";
$ExtraHeaders = "From: \"VAdm Robert M Chadwick\" <[email protected]> \n";
mail ($mailerto, $mailersubject, $mailerbody,$ExtraHeaders);
mysql_close($link);
header("Location: admintemplate.php?pageref=edit_co&co=$co");
//$pageref = "status";
break;
}
?>