[thelist] best way to check for valid user/password in PHP
Anthony Baratta
Anthony at Baratta.com
Thu Jan 9 13:34:01 CST 2003
At 11:26 AM 1/9/2003, Tom Dell'Aringa wrote:
>I'm having a bit of trouble with checking vs. a valid username and
>password in my PHP script. The password check seems to work but the
>username check does not. Here is my code:
>
>-------------------------------------------
>$result = @mysql_query("SELECT password, username FROM reguser WHERE
>username = '$username'");
Why don't you just pass both via SQL and see if you get a row returned?
SELECT <UserInfo> FROM reguser
WHERE username = '$username' AND password = '$password'
if you have data, success. no data, not a valid login.
--
Anthony Baratta
President
Keyboard Jockeys
"Conformity is the refuge of the unimaginative."
More information about the thelist
mailing list