Checking username(upper and lower)

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

  • arnage
    replied
    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.

    Leave a comment:


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

    Leave a comment:


  • arnage
    replied
    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.

    Leave a comment:


  • nimeshka
    replied
    Originally posted by Brock Lesnar
    Hmmm I Cant Understand
    What you do not understand??

    Leave a comment:


  • nimeshka
    replied
    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.

    Leave a comment:


  • Vayne
    replied
    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?

    Leave a comment:


  • $XTREME$
    replied
    $xtreme = strtolower ( $username );

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

    Leave a comment:


  • Ghost
    replied
    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.

    Leave a comment:


  • arevel
    replied
    try strtolower($username);

    Leave a comment:


  • CreativityKills
    replied
    use character encoding utf8_general_ci, and make sure your username column is a UNIQUE key

    Leave a comment:


  • analyzer
    replied
    I'll try it bro, thanks!

    Leave a comment:


  • GumSlone
    replied
    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}' 
    

    Leave a comment:


  • analyzer
    replied
    The collation is latin1_swedish_ci but still doesn't work. I check it in my sql using, WHERE username='".$username."'

    Leave a comment:


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

    Leave a comment:


  • analyzer
    started a topic Checking username(upper and lower)

    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?
Working...
X