SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: Caps Sensitive

  1. #1
    SitePoint Guru
    Join Date
    Sep 2007
    Posts
    971
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Caps Sensitive

    Hello i am having a problem with my code. The code is part of a php login auth which detects if username and password from form match the database. The problem is username is case sensitive how can i change it so its not case sensitive:



    elseif ( $act == "authmember" ) {

    $membername=$_POST['membername'];
    $memberpassword=$_POST['memberpassword'];

    $query2 = mysql_query("SELECT * FROM member WHERE UserName='$membername' ")
    or die("Could not insert data because ".mysql_error());
    $qry2 = mysql_fetch_array( $query2 );

    if ( $membername == "$qry2[UserName]" AND $memberpassword == "$qry2[Password]" ) {
    echo "login will work";
    }
    else
    {
    echo "not working $membername and $memberpassword";
    }

    }
    Animated Chatrooms - www.121chatrooms.net

  2. #2
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    make the strings lowercase $membername= strtolower($_POST['membername']);
    same with the password.
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  3. #3
    SitePoint Guru
    Join Date
    Sep 2007
    Posts
    971
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the fast reply,

    Just another question i am getting this error:

    Parse error: syntax error, unexpected T_LOGICAL_OR in /home/chatpoin/public_html/~advanced/login.php on line 33

    this is line 33:

    if( !($qry2['UserName']) ) OR ( !($qry3['UserName']) ) {

    Is there another word instead of OR i can use for this statement?
    Animated Chatrooms - www.121chatrooms.net

  4. #4
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    its the way its written thats not quite right.
    PHP Code:
    if(!$qry2['UserName'] OR !$qry3['UserName']) { 
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  5. #5
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    73 Post(s)
    Tagged
    0 Thread(s)
    also be very careful of using OR instead of || . They do not have the same level of precedence.
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.

  6. #6
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by StarLion View Post
    also be very careful of using OR instead of || . They do not have the same level of precedence.
    see http://php.net/manual/en/language.operators.logical.php
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •