mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-30 04:40:53 +00:00
updated template for registration and setting up add_user functions
--HG-- branch : rc-botanic-webdev
This commit is contained in:
parent
40ba525e5a
commit
3e2278d692
7 changed files with 280 additions and 220 deletions
|
@ -10,7 +10,7 @@ class Helpers{
|
|||
$smarty = new Smarty;
|
||||
|
||||
// turn smarty debugging on/off
|
||||
$smarty -> debugging = false;
|
||||
$smarty -> debugging = true;
|
||||
// caching must be disabled for multi-language support
|
||||
$smarty -> caching = false;
|
||||
$smarty -> cache_lifetime = 120;
|
||||
|
|
|
@ -1,15 +1,78 @@
|
|||
<?php
|
||||
class Users{
|
||||
|
||||
function add_user(){
|
||||
// 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' => variable_get( 'ryzommanage_game-name', '' ),
|
||||
'WELCOME_MESSAGE' => variable_get( 'ryzommanage_register-welcome', '' ),
|
||||
'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';
|
||||
}
|
||||
return $pageElements;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Function checkUser
|
||||
*
|
||||
* @takes $username
|
||||
* @return string
|
||||
*
|
||||
* Info: Returns a string based on if the username is valid, if valid then "success" is returned
|
||||
*
|
||||
* @return string Info: Returns a string based on if the username is valid, if valid then "success" is returned
|
||||
*/
|
||||
public function checkUser( $username )
|
||||
{
|
||||
|
@ -33,14 +96,10 @@ public function checkUser($username)
|
|||
return "fail";
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Function checkPassword
|
||||
*
|
||||
* @takes $pass
|
||||
* @return string
|
||||
*
|
||||
* Info: Returns a string based on if the password is valid, if valid then "success" is returned
|
||||
*
|
||||
* @return string Info: Returns a string based on if the password is valid, if valid then "success" is returned
|
||||
*/
|
||||
public function checkPassword( $pass )
|
||||
{
|
||||
|
@ -56,14 +115,10 @@ public function checkPassword($pass)
|
|||
return "fail";
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Function confirmPassword
|
||||
*
|
||||
* @takes $pass
|
||||
* @return string
|
||||
*
|
||||
* Info: Verify's $_POST["Password"] is the same as $_POST["ConfirmPass"]
|
||||
*
|
||||
* @return string Info: Verify's $_POST["Password"] is the same as $_POST["ConfirmPass"]
|
||||
*/
|
||||
public function confirmPassword()
|
||||
{
|
||||
|
@ -75,14 +130,10 @@ public function confirmPassword()
|
|||
return "fail";
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Function checkEmail
|
||||
*
|
||||
* @takes $email
|
||||
* @return
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public function checkEmail( $email )
|
||||
{
|
||||
|
@ -178,3 +229,4 @@ public function generateSALT($length = 2)
|
|||
}
|
||||
}
|
||||
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
</tr>
|
||||
|
||||
<tr>
|
||||
<td width="33%" <?php if ($PASSWORD_ERROR == "TRUE"){ echo 'class="error"';}?> id="caption-Password">Desired Password:</td>
|
||||
<td width="33%" {if isset($PASSWORD_ERROR) && $PASSWORD_ERROR eq "TRUE"}class="error"{/if} id="caption-Password">{$password_tag}</td>
|
||||
|
||||
<td width="25%">
|
||||
<input type="password"
|
||||
|
@ -36,27 +36,27 @@
|
|||
maxlength="20"
|
||||
onkeyup=
|
||||
"testPassword(document.Page1.Password.value, 'comment-Password')"
|
||||
onfocus="javascript:showTooltip(' 5-20 characters.', this);" />
|
||||
onfocus="javascript:showTooltip('{$password_message}', this);" />
|
||||
</td>
|
||||
|
||||
<td id="comment-Password" <?php if ($PASSWORD_ERROR == "TRUE"){ echo 'class="error"';}?> width="42%"><?php if ($PASSWORD_ERROR == "TRUE"){ echo $PASSWORD;}?></td>
|
||||
<td id="comment-Password" {if isset($PASSWORD_ERROR) && $PASSWORD_ERROR eq "TRUE"}class="error"{/if} width="42%">{if isset($PASSWORD_ERROR) && $PASSWORD_ERROR eq "TRUE"}{$Password}{/if}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td width="33%"<?php if ($CPASSWORD_ERROR == "TRUE"){ echo 'class="error"';}?> id="caption-ConfirmPass">Confirm Password:</td>
|
||||
<td width="33%" {if isset($CPASSWORD_ERROR) && $CPASSWORD_ERROR eq "TRUE"}class="error"{/if} id="caption-ConfirmPass">{$cpassword_tag}</td>
|
||||
|
||||
<td width="25%"><input type="password"
|
||||
name="ConfirmPass"
|
||||
value=""
|
||||
maxlength="20"
|
||||
onfocus="javascript:showTooltip('Retype your Password', this);" />
|
||||
onfocus="javascript:showTooltip('{$cpassword_message}', this);" />
|
||||
</td>
|
||||
|
||||
<td id="comment-ConfirmPass" <?php if ($CPASSWORD_ERROR == "TRUE"){ echo 'class="error"';}?>width="42%"><?php if ($CPASSWORD_ERROR == "TRUE"){ echo $CPASSWORD;}?></td>
|
||||
<td id="comment-ConfirmPass" {if isset($CPASSWORD_ERROR) && $CPASSWORD_ERROR eq "TRUE"}class="error"{/if} width="42%">{if isset($CPASSWORD_ERROR) && $CPASSWORD_ERROR eq "TRUE"}{$ConfirmPass}{/if}</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="33%" {if isset($CPASSWORD_ERROR) && $CPASSWORD_ERROR eq "TRUE"}class="error"{/if} id="caption-Email">{$email_tag}</td>
|
||||
|
||||
<td width="25%">
|
||||
<input type="text"
|
||||
|
@ -64,24 +64,22 @@
|
|||
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);" />
|
||||
"javascript:showTooltip('{$email_message}', this);" />
|
||||
</td>
|
||||
|
||||
<td id="comment-Email" <?php if ($EMAIL_ERROR == "TRUE"){ echo 'class="error"';}?> width="42%"><?php if ($EMAIL_ERROR == "TRUE"){ echo $EMAIL;}?></td>
|
||||
<td id="comment-Email" {if isset($EMAIL_ERROR) && $EMAIL_ERROR eq "TRUE"}class="error"{/if} width="42%">{if isset($EMAIL_ERROR) && $EMAIL_ERROR eq "TRUE"}{$Email}{/if}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td width=
|
||||
"33%" <?php if ($TAC_ERROR == "TRUE"){ echo 'class="error"';}?>
|
||||
"33%" {if isset($TAC_ERROR) && $TAC_ERROR eq "TRUE"}class="error"{/if}
|
||||
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" >';}; ?>
|
||||
"caption-TaC">{$tac_tag}</span></td>
|
||||
<td id="comment-TaC" {if isset($TAC_ERROR) && $TAC_ERROR eq "TRUE"}class="error"{/if} width="42%">{$tac_message}</td>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
@ -98,22 +96,20 @@
|
|||
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.
|
||||
{$username_tooltip}
|
||||
</div>
|
||||
|
||||
|
||||
<div id="tooltip-Password">
|
||||
5-20 characters.
|
||||
{$password_message}
|
||||
</div>
|
||||
|
||||
<div id="tooltip-ConfirmPass">
|
||||
Retype your Password
|
||||
{$cpassword_message}
|
||||
</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.
|
||||
{$email_message}
|
||||
</div>
|
||||
|
||||
<div id="tooltip-TaC"></div>
|
|
@ -4,5 +4,19 @@
|
|||
[register]
|
||||
title = "RYZOM CORE INGAME REGISTRATION"
|
||||
welcome_message = "Welcome! Please fill in the following fields to get your new Ryzom Core account:"
|
||||
|
||||
username_tag = "Desired Username:"
|
||||
username_tooltip = "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."
|
||||
|
||||
password_tag = "Desired Password:"
|
||||
password_message = "Password must be 5-20 characters."
|
||||
|
||||
cpassword_tag = "Confirm Password:"
|
||||
cpassword_message = "Retype your Password"
|
||||
|
||||
email_tag = "Email Address (to which a confirmation email will be sent):"
|
||||
email_message = "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 Ryzom Core account."
|
||||
|
||||
tac_tag = "YES, I agree to the terms of service."
|
||||
tac_message = "You must accept the Terms of Service."
|
||||
|
||||
|
|
|
@ -18,8 +18,6 @@ $DBHOST = 'localhost' ;
|
|||
$NTUserName = 'shard' ;
|
||||
$NTPassword = '' ;
|
||||
|
||||
$SITETITLE = 'Ryzom Core AMS' ;
|
||||
|
||||
$LOGRELATIVEPATH = 'logs/' ;
|
||||
|
||||
// If true= the server will add automatically unknown user in the database
|
||||
|
@ -83,5 +81,3 @@ $NELDB_CONFIG_TABLE = $NELDB_PREFIX . 'config';
|
|||
$BG_IMG = 'imgs/bg_live.png' ;
|
||||
|
||||
$DEFAULT_LANGUAGE = 'en';
|
||||
|
||||
$TEMPLATE_DIR = "";
|
|
@ -1,6 +1,10 @@
|
|||
<?php
|
||||
function add_user(){
|
||||
echo "test";
|
||||
|
||||
//add user locally here
|
||||
|
||||
$return = users::add_user();
|
||||
return $return;
|
||||
}
|
||||
|
||||
function checkUser(){
|
||||
|
|
|
@ -5,7 +5,7 @@ require( '../../ams_lib/libinclude.php' );
|
|||
|
||||
if ( isset( $_POST["function"] ) ){
|
||||
require( "inc/" . $_POST["function"] . ".php" );
|
||||
$_POST["function"]();
|
||||
$return = $_POST["function"]();
|
||||
}
|
||||
|
||||
function loadpage ( $page ){
|
||||
|
@ -16,7 +16,5 @@ $page = 'home';
|
|||
if ( isset( $_GET["page"] ) ){
|
||||
$page = $_GET["page"];
|
||||
}
|
||||
$pageElements = array();
|
||||
$pageElements['USERNAME_ERROR'] = 'TRUE';
|
||||
$pageElements['Username'] = 'testuser';
|
||||
helpers::loadTemplate( 'register' , $pageElements);
|
||||
|
||||
helpers :: loadTemplate( 'register' , $return );
|
||||
|
|
Loading…
Reference in a new issue