Código PHP:
//Miramos que el nombre no este repetido, no sea demasiado corto o largo (entre 3 y 25 chars) y que tenga caracteres permitidos.
$name_result = $this->database->Query("SELECT name FROM users WHERE name='$name'");
$data['name_available'] = ($this->database->numRows($name_result) > 0) ? false : true;
$data['valid_name'] = (strlen($name) < 3 || strlen($name) > 25 || eregi("[#%\(\)<>{})\^\$]", $name)) ? false : true;
//Verificamos que el email sea valido o no este repetido
$email_result = $this->database->Query("SELECT email FROM users WHERE email='$email'");
$data['email_available'] = ($this->database->numRows($email_result) > 0) ? false : true;
$data['valid_email'] = ((strlen($email) < 5 || !eregi("^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z]+)+$", $email))) ? false : true;