Hi, I’m completely new to php and mysql and I’m stuck.
Thanks for any help you can give me
James
Hi, I’m completely new to php and mysql and I’m stuck.
Thanks for any help you can give me
James
K.I.S.S. - Keep it simple (silly or stupid depending on you)
Psuedocode
/* SQL to Select everything where the user and password are equal to the input.*/
SELECT * FROM table WHERE user = $user AND pass = PASSWORD($pass);
/* run the */
query
/* how many rows are in the result */
$valid = mysql_num_rows of query
/*if there is more then 0 then the user and his password work */
if ($valid > 0)
{
// do your thing
}
Hope that helps.
You can get mysql to run its PASSWORD() function on any string by sending the query "SELECT PASSWORD(’{$mystring}’) "
Lig’s approach is a more complete suggestion for the practical username/password case, though.