<h1>Create Character</h1>
<?php
if (isset($_GET['success']) && empty($_GET['success'])) {
echo 'Congratulations! Your character has been created. See you in-game!';
} else {
if (empty($_POST) === false && empty($errors) === true) {
if ($config['log_ip']) {
znote_visitor_insert_detailed_data(2);
}
//Register
$character_data = array(
'name' => format_character_name($_POST['name']),
'account_id'=> $session_user_id,
'vocation' => $_POST['selected_vocation'],
'town_id' => $_POST['selected_town'],
'*********************' => $_POST['selected_gender'],
'lastip' => getIPLong(),
'created' => time()
);
user_create_character($character_data);
header('Location: createcharacter.php?success');
exit();
//End register
} else if (empty($errors) === false){
echo '<font color="red"><b>';
echo output_errors($errors);
echo '</b></font>';
}
?>
<form action="" method="post">
<ul><center>
<li>
Name:<br>
<input type="text" name="name">
</li><br>
<li>
<!-- Available genders to select from when creating character -->
Gender:<br>
<select name="selected_gender">
<option value="1">Male</option>
<option value="0">Female</option>
</select>
</li><br>
<li>
<!-- Available vocations to select from when creating character -->
Vocation:<br>
<select name="selected_vocation">
<?php foreach ($config['available_vocations'] as $id) { ?>
<option value="<?php echo $id; ?>"><?php echo vocation_id_to_name($id); ?></option>
<?php } ?>
</select>
</li><br>
<li>
<!-- Available genders to select from when creating character -->
Starting Town:<br>
<select name="selected_gender">
<option value="1">Dawnport</option>
</select>
</li><br>
<?php
$available_towns = $config['available_towns'];
if (count($available_towns) > 1):
?>
<li>
<!-- Available towns to select from when creating character -->
Town:<br>
<select name="selected_town">
<?php
foreach ($available_towns as $tid):
?>
<option value="<?php echo $tid; ?>"><?php echo town_id_to_name($tid); ?></option>
<?php
endforeach;
?>
</select>
</li><br>
<?php
else:
?>
<input type="hidden" name="selected_town" value="<?php echo end($available_towns); ?>">
<?php
endif;
/* Form file */
Token::create();
?>
<li>
<input class="play" type="submit" value="Create Char">
</li></center>
</ul>
</form>
<?php
}
include 'layout/overall/footer.php'; ?>