SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2000
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello,

    I have a database where I store my members username and password. I've noticed that searching the database for

    $username='MyUsername' and $password='MyPassword'

    will give the same results as searching for

    $username='myusername' and $password='mypassword'

    I don't mind the username being case-insensitive, but I need the password search to be case-sensitive! Does anyone know how to accomplish this?

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think for that you probably will have to retrieve the data and then validate the password using php so you can do a case-sensitive comparison.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2000
    Location
    Allentown PA
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually you can force MySQL to think the data is binary, hence being case sensitive, using the BINARY cast operator. The following should work:

    BINARY username='MyUsername' and BINARY password='MyPassword'

  4. #4
    SitePoint Evangelist Umair.ms's Avatar
    Join Date
    Sep 2000
    Location
    Lahore, Pakistan
    Posts
    567
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    An alternative method is to retrieve username and password and compare them using a 'strcmp' statement.
    TinyPlanet.org
    Discuss and Debate World Events, Politics and Religion.
    Interact and Share your Views with People around the Globe.


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
  •