Results 1 to 8 of 8
  1. #1
    Join Date
    Dec 2004
    Posts
    27

    Unanswered: query return :: no match

    I'm not sure if i would post this here or in the PHP forum. But the question is really more of a MySQL question then a PHP question.

    What i'm trying to do is run a query for a login script using PHP and would like to know exactly what didn't match (assuming something didn't mach). For example you submit a username and a password but the password was incorrect, however the username was found.

    i know how to perform the checks in php, but when you send a query to check them you'll get a false return from mysql. Is there a way to find out exactly what was false, the username or password?

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    easy

    the query selects based on matching username only

    no return means there is no user by that name

    then the php script compares passwords

    of course, you do not tell the person signing in which one was wrong, do you
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Dec 2004
    Posts
    27
    i don't think i follow, here's exactly how its setup,

    the user enters his username and password > submits the form.

    PHP takes the password and runs it through a md5 function i have (adds a bit of more security using base64,md5 and seeding it). the username is run through htmlspecialchars,stripslashes and trim.

    Then they are sent off to mysql. using a simple username=$username and password=$e_password

    is that what your askin?

    OR

    are you refering to quering the database for the username only and then use php to check the password without sending it? (although i have never thought of doing it that way before)

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    yes, the latter, but you would of course retrieve the password at the same time as you check to see if a row with that username exists
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  5. #5
    Join Date
    Dec 2004
    Posts
    27
    hmm interesting, that's a pretty good idea lol

    I'll have to do that, BUT out of curiosity now is it capable of mysql returning the bad match? what is it that mysql returns if anything more then false?

  6. #6
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    an empty set containing 0 rows

    i dunno how you would detect that, i guess it depends on which programming language you're using
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  7. #7
    Join Date
    Dec 2004
    Posts
    27
    cool, thanks for your help once more man. I'm going to owe you a ickup full of bear one of these days.

  8. #8
    Join Date
    Mar 2004
    Posts
    480
    A pickup full of BEAR? Run Rudy, RUN! <lol>

Posting Permissions

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