Hello everybody!
I designed this function for validating my new users before inserting them in the DB. I also want to modify a little bit his info, puting e-mails in lowers, etc..
My problem is, that perhaps the "Echo" result shows the right way the variable should be, when their are saved in the DB, they have not being changed and they stayed as the user wrote them :S.
This is my code:
[code:1]function ValidacionRegistro(&$user,&$cbUser){
global $_POST, $_PLUGINS;
if(!preg_match ("/^[A-z0-9_-]+$/",$_POST)){
$_PLUGINS->raiseError(0);
$_PLUGINS->_setErrorMSG("Nombre de usuario no válido, éste puede contener únicamente letras, números y los caractéres guión(-) y subguión(_)"«»);
}
$_POST = trim(strtolower($_POST));
$_POST = trim(ucwords($_POST));
$_POST = trim(ucwords($_POST));
$_POST = trim(strtolower($_POST));
echo $_POST; //RESULT: myuser --> OK
echo $_POST; //RESULT: First Name -->OK
echo $_POST; //RESULT: Last Name --> OK
echo $_POST; // RESULT: email@email.com ->OK
return true;
}[/code:1]
Someone who could help me please??
Thanks