Checking username(upper and lower)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Checking username(upper and lower)

    I was trying to check username in my login form that when someone puts username which is not exactly the same with the registered username, he/she will fail to login. Example. . Registered username is tEst and password is test, when someone tried to log in using "test" as username it will not log in because letter "e" must be "E". So it should be "tEst". How will i'am going to verify that?
    It's n0t that i am afraid to die. Its just that if i die, wh0 wilL loVe her as muCh as i Do?

    #2
    check with phpmyadmin if the Collation of your username column is latin1_swedish_ci
    alternatively you could use strtolower() on your login page

    Comment


      #3
      The collation is latin1_swedish_ci but still doesn't work. I check it in my sql using, WHERE username='".$username."'
      It's n0t that i am afraid to die. Its just that if i die, wh0 wilL loVe her as muCh as i Do?

      Comment


        #4
        Originally posted by analyzer View Post
        The collation is latin1_swedish_ci but still doesn't work. I check it in my sql using, WHERE username='".$username."'
        PHP Code:
        WHERE username LIKE '{$username}' 
        Advertise your mobile site for FREE with AdTwirl

        Comment


          #5
          I'll try it bro, thanks!
          It's n0t that i am afraid to die. Its just that if i die, wh0 wilL loVe her as muCh as i Do?

          Comment


            #6
            use character encoding utf8_general_ci, and make sure your username column is a UNIQUE key

            Comment


              #7
              try strtolower($username);

              Comment


                #8
                Originally posted by arevel View Post
                try strtolower($username);
                this makes all characters lowercase. but the original poster wants to check for case "insensitive" characters.
                so the user is able to use both upper and lower case at same time.
                <?php
                include ('Ghost');
                if ($Post == true) {
                echo '

                sigpic
                alt='coding-talk.com!!' />';
                echo 'Sharing Is Caring!';
                } else {
                echo '

                alt='the username GHOST has been comprimised!' />';
                echo 'OMG SOMEBODY HELP ME!!';
                }
                ?>

                Comment


                  #9
                  $xtreme = strtolower ( $username );

                  and get ur sql output with strtolower , then it ll be ,k . Hmm

                  Comment


                    #10
                    Originally posted by GumSlone View Post
                    PHP Code:
                    WHERE username LIKE '{$username}' 
                    thats a nice server killer. and what if there`s about 1kk users + every second one of them (or more) tries to login?
                    Nous Ne Dansos Pas, Nous Sommes Le Danse.!

                    Comment


                      #11
                      Hai bro, there is a function in PHP to compare the case of two strings..use strcmp();

                      PHP Code:
                      $str1 "TesT";
                      $str2 "Test";

                      $true strcmp($str1,$str2);

                      if(
                      $true==0){
                      echo 
                      "Two strings are identical";

                      } else {

                      echo 
                      "Two strings are not identical";


                      Note : strcmp(); returns 0 if the two are identical in case. if not it will return greater than or less than 0 depending on the condition

                      hope this will solve your problem.


                      I'm Proud to be a Sri Lankan!

                      Comment


                        #12
                        Originally posted by Brock Lesnar
                        Hmmm I Cant Understand
                        What you do not understand??


                        I'm Proud to be a Sri Lankan!

                        Comment


                          #13
                          Originally posted by nimeshka View Post
                          Hai bro, there is a function in PHP to compare the case of two strings..use strcmp();

                          PHP Code:
                          $str1 "TesT";
                          $str2 "Test";

                          $true strcmp($str1,$str2);

                          if(
                          $true==0){
                          echo 
                          "Two strings are identical";

                          } else {

                          echo 
                          "Two strings are not identical";


                          Note : strcmp(); returns 0 if the two are identical in case. if not it will return greater than or less than 0 depending on the condition

                          hope this will solve your problem.


                          strcmp() is case sensitive, strcasecmp() is case insensitive.
                          <!DOCTYPE html PUBLIC "-//WAPFORUM.RS

                          Comment


                            #14
                            Originally posted by arnage View Post
                            strcmp() is case sensitive, strcasecmp() is case insensitive.
                            So isn't that what he wanted????


                            I'm Proud to be a Sri Lankan!

                            Comment


                              #15
                              Yep, i didn't read it right, i thought that he wants vice versa.

                              Here is another way.

                              PHP Code:
                              $query mysql_query('SELECT * FROM `users` WHERE MATCH(users) AGAINST("'.$login.'" IN BOOLEAN MODE)'); 
                              Last edited by arnage; 24.08.12, 15:14.
                              <!DOCTYPE html PUBLIC "-//WAPFORUM.RS

                              Comment

                              Working...
                              X