WebEngine's 6th Anniversary

On December 19th, 2018 we will be celebrating 6 years of WebEngine CMS!
The event is here!

1.0.9.8 [SPANISH] Add PersonalID to register

Lautaro

Administrator
Developer
#2
Claro que si.

1) Agregas el input en la forma de registro:
https://github.com/lautaroangelico/WebEngine/blob/master/modules/register.php

Asegurate de enviar el dato del input que agregaste:
PHP:
$Account->registerAccount($_POST['webengineRegister_user'], $_POST['webengineRegister_pwd'], $_POST['webengineRegister_pwdc'], $_POST['webengineRegister_email'], $_POST['nombre_de_tu_input']);
2) Editas el proceso de registro:
https://github.com/lautaroangelico/WebEngine/blob/master/includes/classes/class.account.php

2.1) La nueva variable:
https://github.com/lautaroangelico/WebEngine/blob/master/includes/classes/class.account.php#L18

PHP:
public function registerAccount($username, $password, $cpassword, $email, $tuNuevaVariable) {
2.2) El personal id es numerico, asi que agregamos un filtro para segurarnos que el usuario esta enviando solo numeros.
PHP:
if(!check_value($tuNuevaVariable)) throw new Exception(lang('error_4',true));
PHP:
if(!Validator::UnsignedNumber($tuNuevaVariable)) throw new Exception('Your personal id must be numeric');

2.3) Lo agregamos al arreglo de datos.
https://github.com/lautaroangelico/WebEngine/blob/master/includes/classes/class.account.php#L56

PHP:
$data = array(
    'username' => $username,
    'password' => $password,
    'name' => $username,
    'serial' => $tuNuevaVariable,
    'email' => $email
);
 

Lautaro

Administrator
Developer
#4
Muy facil:
PHP:
if(!Validator::Length($tuNuevaVariable, 7, 1)) throw new Exception('Your personal id exceeds the length limits.');
 

Lautaro

Administrator
Developer
#6
Asi:
PHP:
if(!Validator::Length($tuNuevaVariable, 7, 7)) throw new Exception('Your personal id exceeds the length limits.');
 
#8
@Lautaro disculpa la molestia tengo un inconveniente necesito que se inserten 6 digitos (000000) antes del codigo real que agreguen los usuarios al momento del registro habria alguna forma de hacerlo? gracias
 
#11
Declare:
PHP:
$varSerialId = "000000";
After insert firstVariable + secondVariable
PHP:
$data = array(
    'username' => $username,
    'password' => $password,
    'name' => $username,
    'serial' => $varSerialID+$tuNuevaVariable,
    'email' => $email
);
or try modify your database.. because I think this error is because of type of Table...

... don't try this method.. won't work
 
Last edited:

Lautaro

Administrator
Developer
#13
Lo podes lograr de la siguiente forma:
PHP:
$data = array(
    'username' => $username,
    'password' => $password,
    'name' => $username,
    'serial' => '000000' . $tuNuevaVariable,
    'email' => $email
);
 
Top