-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjoin.php
More file actions
executable file
·298 lines (286 loc) · 8.47 KB
/
join.php
File metadata and controls
executable file
·298 lines (286 loc) · 8.47 KB
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
<?php
/*
| Trek RPG Site Manager
| Author: Nolanator
| Version: 1.0
|
| File: join.php
| Build 5
| <Changes>
| Changed call to action variable, to comply with globals off
| Changed Css
| Fixed application setup error
| Changed where email is sent in an attempt to circumvent a problem that exists with webhosts that do not support the mail() function
|
| <Purpose>
| Join form and processor.
|
| TRSM1.0 is (c) Nolan 2003-2005, and is covered by the GPL Licence (See gpl.txt for more information)
*/
$pagename = "Join";
include "header.php";
if($_GET['action'] != "submit") {
?>
<img src="<? echo $imagepath; ?>header-app.gif">
<p>
This is the official application form to apply for service aboard <? echo $shipname; ?>. Please fill out every field except when instructed, to submit this form and apply to join the ship.
</p>
<form action="join.php?action=submit" method="post">
<table width="90%" align="center">
<tr>
<td class="joinLabel" width="30%">Real Name</td>
<td><input type="text" name="rname" size="20"></td>
</tr>
<tr>
<td class="joinLabel">Real Age</td>
<td><input type="text" name="rage" size="4" maxlength="3"></td>
</tr>
<tr>
<td class="joinLabel">Email Address</td>
<td><input type="text" name="email"></td>
</tr>
<tr>
<td class="joinLabel">PBEM Experience</td>
<td><textarea name="pbem_exp" cols="25" rows="3"></textarea></td>
</tr>
<tr>
<td class="joinLabel">Site Username</td>
<td><input type="text" name="usern" maxlength="40" size="20"></td>
</tr>
<tr>
<td class="joinLabel">Password</td>
<td><input type="password" name="passwd" maxlength="40" size="15"></td>
</tr>
<tr>
<td class="joinLabel">Again</td>
<td><input type="password" name="pass2" maxlength="40" size="15"></td>
</tr>
<tr>
<td class="joinLabel">Requested Position</td>
<td><select name="position">
<?
$getpos = "SELECT * FROM " . $table['positions'] . " AS positions LEFT JOIN " . $table['crew'] . " AS crew ON(positions.crewid = crew.crewid) WHERE positions.crewid = '0' OR crew.active = '3' ORDER BY deptid, ord";
$respos = $sql->queryme($getpos);
while($position = $sql->sql_array($respos)) {
?>
<option value="<? echo $position['posid']; ?>"><? echo $position['name']; ?></option>
<?
}
?>
</select>
</td>
</tr>
<tr>
<td class="joinLabel">Character Name</td>
<td><input type="text" name="f_name" value="First" maxlength="40" size="20"></td>
</tr>
<tr>
<td> </td>
<td><input type="text" name="m_name" value="Middle" maxlength="40" size="20"></td>
</tr>
<tr>
<td> </td>
<td><input type="text" name="l_name" value="Last" maxlength="40" size="20"></td>
</tr>
<tr>
<td class="joinLabel">Gender</td>
<td><select name="gender"><option value="Male">Male</option><option value="Female">Female</option><option value="Other">Other</option></select></td>
</tr>
<tr>
<td class="joinLabel">Species</td>
<td><input type="text" name="species" size="15"></td>
</tr>
<?
$getcustom = "SELECT * FROM " . $table['customfields'] . " AS cust_feilds ORDER BY ord ASC";
$rescustom = $sql->queryme($getcustom);
while($custom = $sql->sql_array($rescustom)) {
?>
<tr>
<td class="joinLabel"><? echo $custom['name']; ?></td>
<td>
<? switch($custom['type']) {
case "line" :
echo "<input type=\"text\" name=\"" . $custom['fid'] . "\" size=\"$line_size\">";
break;
case "box" :
echo "<textarea name=\"" . $custom['fid'] . "\" cols=\"$box_cols\" rows=\"$box_rows\"></textarea>";
break;
case "line_small" :
echo "<input type=\"text\" name=\"" . $custom['fid'] . "\" size=\"$linesmall_size\">";
break;
case "line_med" :
echo "<input type=\"text\" name=\"" . $custom['fid'] . "\" size=\"$linemed_size\">";
break;
case "box_large" :
echo "<textarea name=\"" . $custom['fid'] . "\" cols=\"$boxlarge_cols\" rows=\"$boxlarge_rows\"></textarea>";
break;
}
?>
</td>
</tr>
<?
}
?>
<tr>
<td> </td>
<td><input type="submit" value="Submit Application"> <input type="reset" value="Reset"></td>
</tr>
</table>
<?
} else {
//Start loop, check all variables
$crew = new crew;
$error = 0;
foreach($_POST as $pkey => $pvalue) {
switch($pkey) {
case "rname" :
if($pvalue == "") {
echo "Real Name Missing<br>";
$error++;
} else {
$message .= "Real name: $pvalue\n";
}
break;
case "rage" :
if($pvalue == "") {
echo "Real Age Missing<br>";
} else {
$message .= "Real Age: $pvalue\n";
}
break;
case "pbem_exp" :
if($pvalue == "") {
echo "PBEM Experience Missing<br>";
$error++;
} else {
$message .= "PBEM Exp: $pvalue\n\n";
}
break;
case "f_name" :
if($pvalue == "" || $pkey == "First") {
echo "First Name Missing<br>";
$error++;
} else {
$message .= "First name: $pvalue\n";
$crew->fn = dataCheck($pvalue);
}
break;
case "m_name" :
$message .= "Middle name: $pvalue\n";
if($pvalue <> "Middle") { $crew->mn = dataCheck($pvalue); }
break;
case "l_name" :
$message .= "Last name: $pvalue\n\n";
if($pvalue <> "Last") { $crew->ln = $pvalue; }
break;
case "email" :
if($pvalue == "") {
echo "You need an email address<br>";
$error++;
} else {
$message .= "Email Addy: $pvalue\n\n";
$crew->email = $pvalue;
}
break;
case "usern" :
if($pvalue == "") {
echo "Need a username for the site<br>";
$error++;
} else {
$findun = "SELECT user_id FROM " . $table['users'] . " AS minibb_users WHERE username = '" . $pvalue . "'";
$res = $sql->queryme($findun);
if($sql->sql_num_rows($res) == 0) {
$message .= "Site Username: $pvalue\n\n";
} else {
echo "Username is already taken, please select another";
$error++;
}
}
break;
case "passwd" :
if($pvalue == "") {
echo "Need A Password For The Site<br>";
$error++;
} else {
if($_POST['passwd'] <> $_POST['pass2']) {
echo "Password Fields Do Not match<br>";
$error++;
} else {
}
}
break;
case "pass2" :
if($pvalue == "") {
echo "You need to repeat your password for security purposes<br>";
$error++;
}
break;
case "gender" :
$message .= "Gender: $pvalue\n";
$crew->gender = $pvalue;
break;
case "species" :
if($pvalue == "") {
echo "Species has been left blank<br>";
$error++;
} else {
$message .= "Species: $pvalue\n";
$crew->species = dataCheck($pvalue);
}
break;
case "position" :
$pos = new position;
$pos->get($_POST['position']);
$message .= "Requested Position: " . $pos->name . "\n";
break;
default:
$f = new cfields;
$f->get($pkey);
if($pvalue == "") {
echo $f->name . " has been left blank<br>";
$error++;
} else {
$message .= $f->name . ": $pvalue\n";
$write[$pkey] = $pvalue;
}
break;
} //switch
} //foreach post loop
if($error == 0) {
$crew->rnk = 1;
$crew->active = 0;
$crew->joined = time();
$begin = "The following Application was recieved " . date("M j Y") . "\n\n";
$fmessage = $begin . $message;
//find Co email
$to = emails();
$subject = $shipname . " Application";
$from = "From: " . $crew->fn . " " . $crew->ln . "<" . $crew->email . ">";
$crew->add();
//Add the pending player into the position data
$pos->crewm = $crew->cid;
$pos->update();
foreach($write as $wkey => $wvalue) {
$content = new f_cont;
$content->fldid = $wkey;
$content->info = dataCheck($wvalue);
$content->crewid = $crew->cid;
$content->set();
} //write foreach
//Add pending future time served awards auto
if($mod_awards) {
$awds = new awarded;
$awds->crew_update($crew->cid);
}
//This section handles adding the new user to the forums and setting up their site wide username and password
$inslogin = "INSERT INTO " . $table['users'] . "(username, user_regdate, user_password, user_email, crewid, userlevel) VALUES ('" . $_POST['usern'] . "', '" . now() ."', '" . md5($_POST['passwd']) ."', '" . $_POST['email'] . "', '" . $crew->cid . "', '1')";
$sql->queryme($inslogin);
/**/
mail($to,$subject,$fmessage,$from) or print("Could Not Send Email, Check with the Co for a copy.\n");
echo "Application has been successful. The Commanding Officer will reply to you within a few days.";
echo nl2br($fmessage);
} else {
echo "<br>Application has not been sent for the above reasons, please press back on your browser and make sure all fields are complete";
} //error check
} //end main action if
include "footer.php"; ?>