mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-27 09:36:15 +00:00
Damn its early in the morning :D Oh well! Register works with a callback function. shows which fields are correctly filled in and which not yet. It runs quite smooth. Off to bed now!
This commit is contained in:
parent
bcc19a09d4
commit
6e621e1677
5 changed files with 102 additions and 75 deletions
|
@ -84,10 +84,10 @@ class Users{
|
|||
return "Username must be 5 or more characters.";
|
||||
}elseif ( !preg_match( '/^[a-z0-9\.]*$/', $username ) ){
|
||||
return "Username can only contain numbers and letters.";
|
||||
}elseif ( sql :: db_query( "SELECT COUNT(*) FROM {users} WHERE name = :name", array(
|
||||
/*}elseif ( sql :: db_query( "SELECT COUNT(*) FROM {users} WHERE name = :name", array(
|
||||
':name' => $username
|
||||
) ) -> fetchField() ){
|
||||
return "Username " . $username . " is in use.";
|
||||
return "Username " . $username . " is in use.";*/
|
||||
}else{
|
||||
return "success";
|
||||
}
|
||||
|
@ -139,12 +139,12 @@ class Users{
|
|||
public function checkEmail( $email )
|
||||
{
|
||||
if ( isset( $email ) ){
|
||||
if ( !validEmail( $email ) ){
|
||||
if ( !Users::validEmail( $email ) ){
|
||||
return "Email address is not valid.";
|
||||
}elseif ( db_query( "SELECT COUNT(*) FROM {users} WHERE mail = :mail", array(
|
||||
/*}elseif ( db_query( "SELECT COUNT(*) FROM {users} WHERE mail = :mail", array(
|
||||
':mail' => $email
|
||||
) ) -> fetchField() ){
|
||||
return "Email is in use.";
|
||||
return "Email is in use.";*/
|
||||
}else{
|
||||
return "success";
|
||||
}
|
||||
|
@ -153,8 +153,8 @@ class Users{
|
|||
}
|
||||
return "fail";
|
||||
}
|
||||
public function validEmail( $email )
|
||||
{
|
||||
|
||||
public function validEmail( $email ){
|
||||
$isValid = true;
|
||||
$atIndex = strrpos( $email, "@" );
|
||||
if ( is_bool( $atIndex ) && !$atIndex ){
|
||||
|
@ -196,6 +196,7 @@ class Users{
|
|||
}
|
||||
return $isValid;
|
||||
}
|
||||
|
||||
public function generateSALT( $length = 2 )
|
||||
{
|
||||
// start with a blank salt
|
||||
|
|
|
@ -11,19 +11,23 @@ welcome_message = "Welcome! Please fill in the following fields to get your new
|
|||
|
||||
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."
|
||||
username_default = "Username"
|
||||
|
||||
password_tag = "Desired Password"
|
||||
password_tooltip = "Pick a hard to guess password (5-20 characters)."
|
||||
password_message = "Password must be 5-20 characters."
|
||||
password_default = "Password"
|
||||
|
||||
cpassword_tag = "Confirm Password"
|
||||
cpassword_tooltip = "Retype your Password"
|
||||
cpassword_message = "Retype your Password"
|
||||
cpassword_default = "Re-enter Password"
|
||||
|
||||
email_tag = "Email Address"
|
||||
email_tooltip = "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."
|
||||
email_default = "Email"
|
||||
|
||||
tac_tag = "YES, I agree to the terms of service."
|
||||
tac_tag = "YES, I agree to the <a href="toc.php">terms of service.</a>"
|
||||
tac_message = "You must accept the Terms of Service."
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
require( '../../../ams_lib/libinclude.php' );
|
||||
|
||||
|
||||
function add_user(){
|
||||
|
|
|
@ -2,17 +2,24 @@
|
|||
|
||||
require( '../config.php' );
|
||||
require( '../../ams_lib/libinclude.php' );
|
||||
//default page
|
||||
$page = 'login';
|
||||
|
||||
|
||||
if ( isset( $_POST["function"] ) ){
|
||||
require( "inc/" . $_POST["function"] . ".php" );
|
||||
$return = $_POST["function"]();
|
||||
$tempReturn = $_POST["function"]();
|
||||
$functionReturn = array_merge($tempReturn,$_POST);
|
||||
if ( isset($_POST["callBack"])){
|
||||
$page = $_POST["callBack"];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function loadpage ( $page ){
|
||||
require_once( 'autoload/' . $page . '.php' );
|
||||
}
|
||||
|
||||
$page = 'login';
|
||||
if ( isset( $_GET["page"] ) ){
|
||||
$page = $_GET["page"];
|
||||
}
|
||||
|
@ -21,7 +28,12 @@ if ( isset( $_GET["page"] ) ){
|
|||
if($page == 'login' || $page == 'register'){
|
||||
$no_visible_elements = 'TRUE';
|
||||
}
|
||||
// temporary set permission to 2 which = admin mode
|
||||
|
||||
if ( isset($functionReturn) ){
|
||||
$return = array_merge(array( 'permission' => 1, 'no_visible_elements' => $no_visible_elements ),$functionReturn);
|
||||
}else{
|
||||
$return = array( 'permission' => 1, 'no_visible_elements' => $no_visible_elements );
|
||||
}
|
||||
//print_r($return);
|
||||
|
||||
helpers :: loadTemplate( $page , $return );
|
||||
|
|
|
@ -12,57 +12,65 @@
|
|||
<div class="alert alert-info">
|
||||
{$welcome_message}
|
||||
</div>
|
||||
<form id="signup" class="form-vertical" method="post" action="users::add_user()">
|
||||
<legend>Register Account</legend>
|
||||
<form id="signup" class="form-vertical" method="post" action="index.php">
|
||||
<legend>{$title}</legend>
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label">Username</label>
|
||||
<div class="control-group {if isset($USERNAME_ERROR) and $USERNAME_ERROR eq "TRUE"}error{else if
|
||||
isset($USERNAME) and $USERNAME eq "success"}success{else}{/if}">
|
||||
<label class="control-label">{$username_tag}</label>
|
||||
<div class="controls">
|
||||
<div class="input-prepend">
|
||||
<span class="add-on"><i class="icon-user"></i></span>
|
||||
<input type="text" class="input-xlarge" id="Username" name="Username" placeholder="Username">
|
||||
<input type="text" class="input-xlarge" id="Username" name="Username" placeholder="{$username_default}" {if isset($Username)}value="{$Username}"{/if}>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label">Password</label>
|
||||
<div class="control-group {if isset($PASSWORD_ERROR) and $PASSWORD_ERROR eq "TRUE"}error{else if
|
||||
isset($PASSWORD) and $PASSWORD eq "success"}success{else}{/if}">
|
||||
<label class="control-label">{$password_tag}</label>
|
||||
<div class="controls">
|
||||
<div class="input-prepend">
|
||||
<span class="add-on"><i class="icon-lock"></i></span>
|
||||
<input type="Password" id="Password" class="input-xlarge" name="Password" placeholder="Password">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label">Confirm Password</label>
|
||||
<div class="controls">
|
||||
<div class="input-prepend">
|
||||
<span class="add-on"><i class="icon-lock"></i></span>
|
||||
<input type="Password" id="ConfirmPass" class="input-xlarge" name="ConfirmPass" placeholder="Re-enter Password">
|
||||
<input type="Password" id="Password" class="input-xlarge" name="Password" placeholder="{$password_default}" {if isset($Password)}value="{$Password}"{/if}>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label">Email</label>
|
||||
<div class="control-group {if isset($CPASSWORD_ERROR) and $CPASSWORD_ERROR eq "TRUE"}error{else if
|
||||
isset($CPASSWORD) and $CPASSWORD eq "success"}success{else}{/if}">
|
||||
<label class="control-label">{$cpassword_tag}</label>
|
||||
<div class="controls">
|
||||
<div class="input-prepend">
|
||||
<span class="add-on"><i class="icon-lock"></i></span>
|
||||
<input type="Password" id="ConfirmPass" class="input-xlarge" name="ConfirmPass" placeholder="{$cpassword_default}" {if isset($ConfirmPass)}value="{$ConfirmPass}"{/if}>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group {if isset($EMAIL_ERROR) and $EMAIL_ERROR eq "TRUE"}error{else if
|
||||
isset($EMAIL) and $EMAIL eq "success"}success{else}{/if}">
|
||||
<label class="control-label">{$email_tag}</label>
|
||||
<div class="controls">
|
||||
<div class="input-prepend">
|
||||
<span class="add-on"><i class="icon-envelope"></i></span>
|
||||
<input type="text" class="input-xlarge" id="Email" name="Email" placeholder="Email">
|
||||
<input type="text" class="input-xlarge" id="Email" name="Email" placeholder="{$email_default}" {if isset($Email)}value="{$Email}"{/if}>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<div class="control-group {if isset($TAC_ERROR) and $TAC_ERROR eq "TRUE"}error{else if
|
||||
isset($TAC) and $TAC eq "success"}success{else}{/if}">
|
||||
<div class="controls">
|
||||
<div class="input-prepend">
|
||||
<input type="checkbox" class="input-xlarge" id="TaC" name="TaC" placeholder="Email">{$tac_tag}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="function" value="add_user">
|
||||
<input type="hidden" name="callBack" value="register">
|
||||
<div class="control-group">
|
||||
<label class="control-label"></label>
|
||||
<div class="controls">
|
||||
|
@ -70,6 +78,9 @@
|
|||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
|
Loading…
Reference in a new issue