View Single Post
Old Feb 21st, 2008, 11:13 PM   #14
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Re: Sessions Problem

Congrats.

Dameon's right: you shouldn't be pulling all the users out of the database in order to find one. It's slow and not necessary. Try this:

...
$sql = 'SELECT * FROM `users` WHERE username = \'' . mysql_real_escape_string($user) . '\'';

...

$result = mysql_fetch_array($query);
if ($result && ($new_user == $result['username']) && ($new_password == $result['password'])) {
...
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote