AUR web interface

Tasklist

FS#2585 - User Existence Check Broken

Attached to Project: AUR web interface
Opened by Simo Leone (neotuli) - Saturday, 16 April 2005, 02:20 GMT
Last edited by Simo Leone (neotuli) - Saturday, 23 April 2005, 17:24 GMT
Task Type Bug Report
Category Backend
Status Closed
Assigned To Simo Leone (neotuli)
Architecture All
Severity Medium
Priority Normal
Reported Version 1.0
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

This IF statement (from web/html/accounts.php) doesn't trip even if the user doesn't exist.

$q = "SELECT Users.*, AccountTypes.AccountType ";
$q.= "FROM Users, AccountTypes ";
$q.= "WHERE AccountTypes.ID = Users.AccountTypeID ";
$q.= "AND Users.ID = ".intval($_REQUEST["ID"]);
$result = db_query($q, $dbh);
if (!result) {
print __("Could not retrieve information for the specified user.");
}

Not sure why... will look into it.
This task depends upon

This task blocks these from closing
 FS#2579 - Add user info page 
Closed by  Simo Leone (neotuli)
Saturday, 23 April 2005, 17:25 GMT
Reason for closing:  Fixed
Additional comments about closing:  committed rev162
Comment by Paul Mattal (paul) - Friday, 22 April 2005, 04:20 GMT
This query returns 0 rows, both on the beta and the production server. It must be something in the db_query function doing something not expected.
Comment by Simo Leone (neotuli) - Saturday, 23 April 2005, 16:48 GMT
Indeed it was doing something unexpected.
It returns a resource on success and FALSE on an error, since the query works and there isn't an error, it returns a resource with 0 rows in it, not false. Therefore, checking for the resources existence will always be true.

Fixed by changing check to this:
if (!mysql_num_rows($result))

If there aren't any rows, it bails like it should.

Committed rev162

Loading...