<?php
session_start();
$charMessage = "";
$charMessage2 = "";
$jobsMessage = "";
$passMessage = "";
$passMessage2 = "";
$emailMessage = "";
$emailMessage2 = "";
$essayMessage = "";
$codeMessage = "";
$CharFont = "allClearFont";
$jobsFont = "allClearFont";
$passFont = "allClearFont";
$emailFont = "allClearFont";
$essayFont = "allClearFont";
$codeFont = "allClearFont";
$charName = strip_tags($_POST['charName']);
$jobs = strip_tags($_POST['jobs']);
$pass1 = strip_tags($_POST['pass1']);
$pass2 = strip_tags($_POST['pass2']);
$email = strip_tags($_POST['email']);
$email2 = strip_tags($_POST['email2']);
$zm = strip_tags($_POST['zm']);
$cop = strip_tags($_POST['cop']);
$toa = strip_tags($_POST['toa']);
$wotg = strip_tags($_POST['wotg']);
$essay = strip_tags($_POST['essay']);
$code = strip_tags($_POST['code']);
if (isset($_POST['submit']))
{
##################
# CHECK CHAR NAME
##################
if(strlen($charName) < 4 || strlen($charName) > 16 || $charName == "")
{
$charFont = "errorFont";
$charMessage = "Character Name must be between 4 and 16 characters.";
}
else if(!ctype_alpha($charName))
{
$charMessage2 = "Character name cannot contain any numbers.";
$charFont = "errorFont";
}
##################
# CHECK JOBS
##################
if(strlen($jobs) < 3)
{
$jobsFont = "errorFont";
$jobsMessage = "You have not added your jobs.";
}
##################
# CHECK PASSWORD
##################
if(strlen($pass1) < 5 || strlen($pass1) > 15 || strlen($pass2) < 5 || strlen($pass2) > 15 )
{
$passMessage = "Password must be between 5 and 15 characters.";
$passFont = "errorFont";
}
else if($pass1 != $pass2)
{
$passMessage2 = "Passwords do not match.";
$passFont = "errorFont";
}
##################
# CHECK EMAIL
##################
if(strlen($email) == "")
{
$emailMessage = "You have not added your email address.";
$emailFont = "errorFont";
}
else if($email != $email2)
{
$emailMessage2 = "Email addresses do not match.";
$emailFont = "errorFont";
}
##################
# CHECK ESSAY
##################
if($essay == "")
{
$essayMessage = "You have not filled out \"In your own words\".";
$essayFont = "errorFont";
}
##################
# CHECK CAPTCHA
##################
if(isset($_POST['code']) && isset($_SESSION['code']))
if(md5($_POST['code']) != $_SESSION['code'])
{
$codeMessage = "Validation Incorrect.";
$codeFont = "errorFont";
}
}
##################
# ALL CLEAR STUFF
##################
else
{
// DO REDIRECTION HERE }
?>
<html>
<head>
<link rel="stylesheet" href="../lib/luna.css" type="text/css"/>
<title>Luna Knights::Application for Membership</title>
</head>
<body onload="window.resizeTo(800,600); window.moveTo(100,100);">
<div id="contents">
<strong>Luna Knights Application</strong>
<br/>
Please fill out the form completely:
<br/><br/>
<form method="post" target="_self">
<fieldset id="applyInfoFieldset">
<legend name="legend">Your Information</legend>
<table width="97%" style="border: none;">
<tr>
<td align="left" class="hideIt <?php echo $charFont;?>">Character Name:</td>
<td align="left" class="hideIt"><input class="input" value="<?php echo $charName;?>" type="text" id="charName" name="charName" maxlength="16" cols="35"/></td>
<td class="hideIt"><?php if($charMessage != "") { echo $charMessage; } else if($charMessage2 != "") { echo $charMessage2; }?></td>
<td align="right" class="hideIt <?php echo $jobsFont;?>">List level 75 Jobs:</td>
<td align="right" class="hideIt"><input type="text" class="input" value="<?php echo $jobs;?>" id="jobs" name="jobs" maxlength="100" cols="50"/></td>
<td class="hideIt"><?php if($jobsMessage != "") { echo $jobsMessage; }?></td>
</tr>
<tr>
<td align="left" class="hideIt <?php print $passFont;?>">Password:</td>
<td align="left" class="hideIt"><input class="input" value="<?php echo $pass1;?>" type="password" id="pass1" name="pass1" maxlength="15" cols="35"/></td>
<td class="hideIt"><?php if($passMessage != "") { echo $passMessage; } else if($passMessage2 != "") { echo $passMessage2; }?></td>
<td align="right" class="hideIt <?php print $passFont;?>">Repeat Password:</td>
<td align="right" class="hideIt"><input class="input" value="<?php echo $pass2;?>" type="password" id="pass2" name="pass2" maxlength="15" cols="35"/></td>
</tr>
<tr>
<td align="left" class="hideIt <?php print $emailFont;?>">Email:</td>
<td align="left" class="hideIt"><input class="input" value="<?php echo $email;?>" type="text" id="email" name="email" maxlength="150"/></td>
<td class="hideIt"><?php if($emailMessage != "") { echo $emailMessage; } else if($emailMessage2 != "") { echo $emailMessage2; }?></td>
<td align="right" class="hideIt <?php print $emailFont;?>">Confirm Email:</td>
<td align="right" class="hideIt"><input class="input" value="<?php echo $email2;?>" type="text" id="email2" name="email2" maxlength="150"/></td>
</tr>
</table>
</fieldset>
<fieldset id="applyMissionFieldset">
<legend name="legend">Mission Status</legend>
<table width="90%" style="border: none;">
<tr>
<td align="left" class="hideIt">Zilart:</td>
<td align="left" class="hideIt"><input type="text" class="input" maxlength="5" name="zm" value="<?php echo $zm;?>" style="width: 45px;"/></td>
<td align="right" class="hideIt">CoP</td>
<td align="right" class="hideIt"><input type="text" class="input" maxlength="5" name="cop" value="<?php echo $cop;?>" style="width: 45px;"/></td>
</tr>
<tr>
<td align="left" class="hideIt">Aht Urgan</td>
<td align="left" class="hideIt"><input type="text" class="input" maxlength="5" name="toa" value="<?php echo $toa;?>" style="width: 45px;"/></td>
<td align="right" class="hideIt">WotG</td>
<td align="right" class="hideIt"><input type="text" class="input" maxlength="5" name="wotg" value="<?php echo $wotg;?>" style="width: 45px;"/></td>
</tr>
</table>
</fieldset>
<fieldset id="applyEssayFieldset">
<legend name="legend">In your own Words</legend>
<?php if($essayMessage != "") { echo $essayMessage."<br/>"; }?>
<span class="<?php echo $essayFont;?>">Why should you be a member of Luna Knights?</span>
<br/>
<textarea name="essay" maxlength="500" style="width: 600px; height: 100px;" wrap="hard"><?php if($essay != "") { echo $essay; } ?></textarea>
</fieldset>
<table width="25%" style="border: none;">
<tr>
<td align="left" class="hideIt">Verification Code:</td>
</tr>
<tr>
<td align="left" class="hideIt"><img src="../images/verify.php"></td>
</tr>
<tr>
<td align="left" class="hideIt"><input class="input" type="text" name="code" maxlength="6"/></td>
<td align="right" class="hideIt"><input type="submit" id="submit" name="submit" class="button" value="Submit"/></td>
</tr>
<tr>
<td class="hideIt <?php echo $codeFont;?>" align="left"><?php if($codeMessage != "") { echo $codeMessage; }?></td>
</tr>
</table>
</form>
</div>
</body>
</html>