note 56279 added to function.mysql-real-escape-string

From: Date: Mon, 29 Aug 2005 16:16:40 +0000
Subject: note 56279 added to function.mysql-real-escape-string
Groups: php.notes 
Request: Send a blank email to php-notes+get-94342@lists.php.net to get a copy of this message
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; } } ---- Manual Page -- http://www.php.net/manual/en/function.mysql-real-escape-string.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+56279 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56279&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56279&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56279&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56279&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56279&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56279&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+56279&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#94342) next »