If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > query return :: no match

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-29-05, 23:56
wardly wardly is offline
Registered User
 
Join Date: Dec 2004
Posts: 27
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?
Reply With Quote
  #2 (permalink)  
Old 01-30-05, 00:22
r937 r937 is online now
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
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
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 01-30-05, 00:28
wardly wardly is offline
Registered User
 
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)
Reply With Quote
  #4 (permalink)  
Old 01-30-05, 00:33
r937 r937 is online now
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
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
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #5 (permalink)  
Old 01-30-05, 00:37
wardly wardly is offline
Registered User
 
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?
Reply With Quote
  #6 (permalink)  
Old 01-30-05, 00:39
r937 r937 is online now
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
an empty set containing 0 rows

i dunno how you would detect that, i guess it depends on which programming language you're using
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #7 (permalink)  
Old 01-30-05, 00:41
wardly wardly is offline
Registered User
 
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.
Reply With Quote
  #8 (permalink)  
Old 01-30-05, 12:38
guelphdad guelphdad is offline
Registered User
 
Join Date: Mar 2004
Posts: 440
A pickup full of BEAR? Run Rudy, RUN! <lol>
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On