Current time: 05-23-2012, 06:22 AM Hello There, Guest! (LoginRegister)

Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Accept ñ o Ñ or tildes
06-03-2011, 07:57 AM
Post: #1
Accept ñ o Ñ or tildes
Hola alguien sabe como hacer para que el formulario de registro acepte Ñ y acentos?
Gracias
_______________________________________________________________

Hi anyone knows how to have the registration form accept Ñ and accents?
Thanks

Quote:NyU Hosting Gratis Con Soporte En Español.
Find all posts by this user
Quote this message in a reply
06-03-2011, 01:31 PM
Post: #2
RE: Accept ñ o Ñ or tildes
It should accept it if you reconfigure the database to use the correct encoding. A quick google for me brough up that either of these should work...

"UTF-8" or "ISO-8859-1"

[Image: sig.png]
Visit this user's website Find all posts by this user
Quote this message in a reply
06-03-2011, 04:35 PM
Post: #3
RE: Accept ñ o Ñ or tildes
THT v1.2.3 has a default database encoding of utf8_general_ci. This should be able to handle most international characters.

Kevin Mark - TheHostingTool Lead Developer
Visit this user's website Find all posts by this user
Quote this message in a reply
06-04-2011, 05:34 AM
Post: #4
RE: Accept ñ o Ñ or tildes
Yes that is for encoding characters in the THT, but im answering for the new sign ups in the sign up form if itry to put a name like (begoña) is a female spanish name is marked with a red cross because the (ñ) is not a valid character in regex, but i dont know witch file i have to modify is the ajax.php or is in another file


Attached File(s) Thumbnail(s)
   

Quote:NyU Hosting Gratis Con Soporte En Español.
Find all posts by this user
Quote this message in a reply
06-04-2011, 04:39 PM (This post was last modified: 06-04-2011 04:42 PM by zzbomb.)
Post: #5
RE: Accept ñ o Ñ or tildes
Well why didnt you say so?!? I thought it was a database issue...

I guess you could do something like this...
Replace lines 66 to 204 with the following code. in the ajax.php file.
Code:
if(!preg_match("/^([0-9a-zA-ZÁÉÍÓÚáéíóuñÑ])+$/",$main->getvar['user'])) {
            echo 0;
            return;
        }
        if(!$main->getvar['user']) {
            $_SESSION['check']['user'] = false;
           echo 0;
        }
        else {
            $query = $db->query("SELECT * FROM `<PRE>users` WHERE `user` = '{$main->getvar['user']}'");
            if($db->num_rows($query) == 0) {
                $_SESSION['check']['user'] = true;
                echo 1;    
            }
            else {
                $_SESSION['check']['user'] = false;
                echo 0;    
            }
        }
    }
    public function passcheck() {
        global $main;
        if($main->getvar['pass'] == ":") {
            $_SESSION['check']['pass'] = false;
           echo 0;
           return;
        }
        else {
            $pass = explode(":", $main->getvar['pass']);
            if($pass[0] == $pass[1]) {
                $_SESSION['check']['pass'] = true;
                echo 1;    
            }
            else {
                $_SESSION['check']['pass'] = false;
                echo 0;    
            }
        }
    }
    public function emailcheck() {
        global $main, $db;
        if(!$main->getvar['email']) {
           $_SESSION['check']['email'] = false;
           echo 0;
           return;
        }
        $query = $db->query("SELECT * FROM `<PRE>users` WHERE `email` = '{$main->getvar['email']}'");
        if($db->num_rows($query) != 0) {
           $_SESSION['check']['email'] = false;
           echo 0;
           return;
        }
        else {
            if($main->check_email($main->getvar['email'])) {
                $_SESSION['check']['email'] = true;
                echo 1;
            }
            else {
                $_SESSION['check']['email'] = false;
                echo 0;
            }
        }
    }

    public function firstnamecheck() {
        global $main;
        if(!preg_match("/^([a-zA-ZÁÉÍÓÚáéíóuñÑ\.\'\ \-])+$/",$main->getvar['firstname'])) {
            $_SESSION['check']['firstname'] = false;
            echo 0;
        }
        else {
            $_SESSION['check']['firstname'] = true;
            echo 1;
        }
    }
    
    public function lastnamecheck() {
        global $main;
        if(!preg_match("/^([a-zA-ZÁÉÍÓÚáéíóuñÑ\.\'\ \-])+$/",$main->getvar['lastname'])) {
            $_SESSION['check']['lastname'] = false;
            echo 0;
        }
        else {
            $_SESSION['check']['lastname'] = true;
            echo 1;
        }
    }
    
    public function addresscheck() {
        global $main;
        if(!preg_match("/^([0-9a-zA-ZÁÉÍÓÚáéíóuñÑ\.\ \-])+$/",$main->getvar['address'])) {
            $_SESSION['check']['address'] = false;
            echo 0;
        }
        else {
            $_SESSION['check']['address'] = true;
            echo 1;
        }
    }
    
    public function citycheck() {
        global $main;
        if (!preg_match("/^([a-zA-ZÁÉÍÓÚáéíóuñÑ ])+$/",$main->getvar['city'])) {
            $_SESSION['check']['city'] = false;
            echo 0;            
        }
        else {
            $_SESSION['check']['city'] = true;
            echo 1;
        }
    }        
    
    public function statecheck() {
        global $main;
        if (!preg_match("/^([a-zA-ZÁÉÍÓÚáéíóuñÑ\.\ -])+$/",$main->getvar['state'])) {
            $_SESSION['check']['state'] = false;
            echo 0;
        }
        else {
            $_SESSION['check']['state'] = true;
            echo 1;
        }
    }                
    
    public function zipcheck() {
        global $main;
        if(strlen($main->getvar['zip']) > 7) {
            echo 0;
            return;
        }
        else {
            if (!preg_match("/^([0-9a-zA-ZÁÉÍÓÚáéíóuñÑ\ \-])+$/",$main->getvar['zip'])) {
                $_SESSION['check']['zip'] = false;
                echo 0;
            }
            else {
                $_SESSION['check']['zip'] = true;
                echo 1;
                }
            }
    }

Oh also. I think it would be a great idea to make implementation of this easier in future versions. Perhaps write a few functions to improve regular expression checking across multiple languages and requirements or something. Idk. But yea, my fix is sorta Hackish.

Oh and i did not text this code.. so if you get lots of errors... WOOPS. lol. i have no idea if this will actually work Tongue Theoretically it should >.<

[Image: sig.png]
Visit this user's website Find all posts by this user
Quote this message in a reply
06-04-2011, 09:15 PM
Post: #6
RE: Accept ñ o Ñ or tildes
That code work only in the username if i put begoña is working but in the address i put Dr. Ibañez N 4 2 IZQ and not accept it, by the way if a new customer do sign up with the name begoña in username when he/she try to login it takes error, is because in the database it stores like begoña instead of begoña and when THT is trying to get the username it not match.

But is ok im not going to try any more i just put a warning in signup form

thanks

Quote:NyU Hosting Gratis Con Soporte En Español.
Find all posts by this user
Quote this message in a reply
06-04-2011, 09:31 PM
Post: #7
RE: Accept ñ o Ñ or tildes
(06-04-2011 09:15 PM)draculia Wrote:  That code work only in the username if i put begoña is working but in the address i put Dr. Ibañez N 4 2 IZQ and not accept it, by the way if a new customer do sign up with the name begoña in username when he/she try to login it takes error, is because in the database it stores like begoña instead of begoña and when THT is trying to get the username it not match.

But is ok im not going to try any more i just put a warning in signup form

thanks

Hmmm. Alright. That is strange. Perhaps this will get improved in future versions

[Image: sig.png]
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 3 Guest(s)