note 56279 deleted from function.mysql-real-escape-string by sean
| From: | sean@php.net | Date: | Mon, 29 Aug 2005 16:19:52 +0000 |
| Subject: | note 56279 deleted from function.mysql-real-escape-string by sean | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-94343@lists.php.net to get a copy of this message | ||
Note Submitter: webdesign at benking dot com
Reason: bad code
----
I have found this to be an effective way of preventing invalid logins;
# you will need to have your DB connection setup first
# also, this assumes only unique user names exist
function auth_user($user,$pass) {
$query = "SELECT pass FROM users WHERE user = '$user'");
$select = mysql_query($query);
if(mysql_num_rows($select) > 0 && pg_result($select,0,0) == '$pass') { return
1; } else { return 0; }
}