note 56282 deleted from function.mysql-real-escape-string by aidan
| From: | aidan@php.net | Date: | Sat, 04 Feb 2006 12:06:31 +0000 |
| Subject: | note 56282 deleted from function.mysql-real-escape-string by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-102984@lists.php.net to get a copy of this message | ||
Note Submitter: webdesign at benking dot com
----
# I find this method effective for preventing invalid logins. Keep in mind you must setup DB
connection first and this code assumes only unique user names exist.
function auth_user($user,$pass) {
$select = mysql_query("SELECT pass FROM users WHERE user = '$user'");
if(mysql_num_rows($select) > 0 && mysql_result($select,0,0) == $pass) { return 1; }
else { return 0; }
}