added in-game template file

This commit is contained in:
Botanic 2013-06-05 23:39:33 -07:00
parent 1b276e849a
commit 409376af8d
3 changed files with 202 additions and 71 deletions

View file

@ -1,10 +1,20 @@
<?php <?php
class Helpers { class Helpers{
public function loadTemplate( $template, $vars = array () ) public function loadTemplate( $template, $vars = array () )
{ {
extract( $vars ); extract( $vars );
include( $template ); include( $template );
}
public function check_if_game_client()
{
// if HTTP_USER_AGENT is not set then its ryzom core
if ( !isset( $_SERVER['HTTP_USER_AGENT'] ) ){
return true;
}else{
return false;
}
}
} }
}

View file

@ -0,0 +1,117 @@
<div class="title">
aRYZOM CORE INGAME REGISTRATION
</div>
<div>
<?php echo $WELCOME_MESSAGE; ?>
</div>
<form name="Page1"
method="post"
>
<table>
<tr>
<td width="33%" <?php if ($USERNAME_ERROR == "TRUE"){ echo 'class="error"';}?> id="caption-Username">Desired Username: </td>
<td width="25%">
<input type="text"
name="Username"
value=""
maxlength="12"
onfocus=
"javascript:showTooltip('5-12 lower-case characters and numbers. The login (username) you create here will be your login name. The name of your game characters will be chosen later on.', this);" />
</td>
<td id="comment-Username" <?php if ($USERNAME_ERROR == "TRUE"){ echo 'class="error"';}?> width="42%"><?php if ($USERNAME_ERROR == "TRUE"){ echo $USERNAME;}?></td>
</tr>
<tr>
<td width="33%" <?php if ($PASSWORD_ERROR == "TRUE"){ echo 'class="error"';}?> id="caption-Password">Desired Password:</td>
<td width="25%">
<input type="password"
name="Password"
value=""
maxlength="20"
onkeyup=
"testPassword(document.Page1.Password.value, 'comment-Password')"
onfocus="javascript:showTooltip(' 5-20 characters.', this);" />
</td>
<td id="comment-Password" <?php if ($PASSWORD_ERROR == "TRUE"){ echo 'class="error"';}?> width="42%"><?php if ($PASSWORD_ERROR == "TRUE"){ echo $PASSWORD;}?></td>
</tr>
<tr>
<td width="33%"<?php if ($CPASSWORD_ERROR == "TRUE"){ echo 'class="error"';}?> id="caption-ConfirmPass">Confirm Password:</td>
<td width="25%"><input type="password"
name="ConfirmPass"
value=""
maxlength="20"
onfocus="javascript:showTooltip('Retype your Password', this);" />
</td>
<td id="comment-ConfirmPass" <?php if ($CPASSWORD_ERROR == "TRUE"){ echo 'class="error"';}?>width="42%"><?php if ($CPASSWORD_ERROR == "TRUE"){ echo $CPASSWORD;}?></td>
</tr>
<tr>
<td width="33%" <?php if ($EMAIL_ERROR == "TRUE"){ echo 'class="error"';}?> id="caption-Email">Email Address (to which a confirmation email will be sent):</td>
<td width="25%">
<input type="text"
name="Email"
value=""
maxlength="255"
onfocus=
"javascript:showTooltip('Please verify that the e-mail address you enter here is valid and will remain valid in the future. It will only be used to manage your <?php echo $GAME_NAME; ?> account.', this);" />
</td>
<td id="comment-Email" <?php if ($EMAIL_ERROR == "TRUE"){ echo 'class="error"';}?> width="42%"><?php if ($EMAIL_ERROR == "TRUE"){ echo $EMAIL;}?></td>
</tr>
<tr>
<td width=
"33%" <?php if ($TAC_ERROR == "TRUE"){ echo 'class="error"';}?>
colspan="2"><input type="checkbox"
name="TaC"
value="1"
onfocus="javascript:showTooltip('', this);" /><span id=
"caption-TaC">YES, I agree to the terms of
service</span></td><?php if ($TAC_ERROR == "TRUE"){
echo '<td id="comment-TaC" class="error" width="42%">You must accept the Terms of Service</td>';}
else {
echo '<td width="42%" id="comment-TaC" >';}; ?>
</tr>
</table>
<div class="c1">
<input type="submit"
name="Submit"
value="Continue" />
</div>
<input type="hidden" name="function" value="add_user">
</form>
<div id="signupTooltip"
class="c2"
inset=""></div>
<div id="tooltip-Username">
5-12 lower-case characters and numbers. The login (username) you create here will be
your login name. The name of your game characters will be chosen later on.
</div>
<div id="tooltip-Password">
5-20 characters.
</div>
<div id="tooltip-ConfirmPass">
Retype your Password
</div>
<div id="tooltip-Email">
Please verify that the e-mail address you enter here is valid and will remain valid
in the future. It will be used to manage your <?php echo $GAME_NAME; ?> account.
</div>
<div id="tooltip-TaC"></div>

View file

@ -1,67 +1,71 @@
<?php <?php
require( '../config.php' ); require( '../config.php' );
//check if values exist // check if values exist
if (isset($_POST["Username"]) and isset($_POST["Password"]) and isset($_POST["Email"]) ) if ( isset( $_POST["Username"] ) and isset( $_POST["Password"] ) and isset( $_POST["Email"] ) )
{ {
//check values // check values
$user = users::checkUser($_POST["Username"]); $user = users :: checkUser( $_POST["Username"] );
$pass = users::checkPassword($_POST["Password"]); $pass = users :: checkPassword( $_POST["Password"] );
$cpass = users::confirmPassword(); $cpass = users :: confirmPassword();
$email = users::checkEmail($_POST["Email"]); $email = users :: checkEmail( $_POST["Email"] );
} else { }else{
$user = ""; $user = "";
$pass = ""; $pass = "";
$cpass = ""; $cpass = "";
$email = ""; $email = "";
} }
//if all are good then create user // if all are good then create user
if (($user == "success") and ($pass == "success") and ($cpass == "success") and ($email == "success") and (isset($_POST["TaC"]))) { if ( ( $user == "success" ) and ( $pass == "success" ) and ( $cpass == "success" ) and ( $email == "success" ) and ( isset( $_POST["TaC"] ) ) ){
$edit = array( $edit = array(
'name' => $_POST["Username"], 'name' => $_POST["Username"],
'pass' => $_POST["Password"], 'pass' => $_POST["Password"],
'mail' => $_POST["Email"], 'mail' => $_POST["Email"],
'init' => $_POST["Email"], 'init' => $_POST["Email"],
'unhashpass' => $_POST["Password"], 'unhashpass' => $_POST["Password"],
'status' => 1, 'status' => 1,
'access' => REQUEST_TIME 'access' => REQUEST_TIME
); );
user_save(NULL, $edit); user_save( NULL, $edit );
header('Location: email_sent.php'); header( 'Location: email_sent.php' );
exit; exit;
} else { }else{
$pageElements = array( $pageElements = array(
'GAME_NAME' => $GAME_NAME, 'GAME_NAME' => $GAME_NAME,
'WELCOME_MESSAGE' => $WELCOME_MESSAGE, 'WELCOME_MESSAGE' => $WELCOME_MESSAGE,
'USERNAME' => $user, 'USERNAME' => $user,
'PASSWORD' => $pass, 'PASSWORD' => $pass,
'CPASSWORD' => $cpass, 'CPASSWORD' => $cpass,
'EMAIL' => $email 'EMAIL' => $email
); );
if ($user != "success") { if ( $user != "success" ){
$pageElements['USERNAME_ERROR'] = 'TRUE'; $pageElements['USERNAME_ERROR'] = 'TRUE';
} else { }else{
$pageElements['USERNAME_ERROR'] = 'FALSE'; $pageElements['USERNAME_ERROR'] = 'FALSE';
} }
if ($pass != "success") { if ( $pass != "success" ){
$pageElements['PASSWORD_ERROR'] = 'TRUE'; $pageElements['PASSWORD_ERROR'] = 'TRUE';
} else { }else{
$pageElements['PASSWORD_ERROR'] = 'FALSE'; $pageElements['PASSWORD_ERROR'] = 'FALSE';
} }
if ($cpass != "success") { if ( $cpass != "success" ){
$pageElements['CPASSWORD_ERROR'] = 'TRUE'; $pageElements['CPASSWORD_ERROR'] = 'TRUE';
} else { }else{
$pageElements['CPASSWORD_ERROR'] = 'FALSE'; $pageElements['CPASSWORD_ERROR'] = 'FALSE';
} }
if ($email != "success") { if ( $email != "success" ){
$pageElements['EMAIL_ERROR'] = 'TRUE'; $pageElements['EMAIL_ERROR'] = 'TRUE';
} else { }else{
$pageElements['EMAIL_ERROR'] = 'FALSE'; $pageElements['EMAIL_ERROR'] = 'FALSE';
} }
if (isset($_POST["TaC"])) { if ( isset( $_POST["TaC"] ) ){
$pageElements['TAC_ERROR'] = 'FALSE'; $pageElements['TAC_ERROR'] = 'FALSE';
} else { }else{
$pageElements['TAC_ERROR'] = 'TRUE'; $pageElements['TAC_ERROR'] = 'TRUE';
} }
helpers::loadtemplate('templates/register.phtml',$pageElements); if ( helpers :: check_if_game_client() ){
} helpers :: loadtemplate( '../../ams_lib/ingame_templates/register.phtml', $pageElements );
}else{
helpers :: loadtemplate( 'templates/register.phtml', $pageElements );
}
}