added in-game template file

--HG--
branch : rc-botanic-webdev
This commit is contained in:
Botanic 2013-06-05 23:39:33 -07:00
parent 4d3acc9cc0
commit 0a3020e971
3 changed files with 202 additions and 71 deletions

View file

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