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

From: Date: Fri, 13 May 2005 22:41:34 +0000
Subject: note 52831 added to function.mysql-real-escape-string
Groups: php.notes 
Request: Send a blank email to php-notes+get-89401@lists.php.net to get a copy of this message
@ludvig dot ericson at gmail dot com: I don't see why you wouldn't *especially* escape a password. It should be either *essential* or *useless* to escape a password. Depends on the way you allow NEW registrations. When you escape all NEW passwords too before putting them in the DB, you NEED to escape before calculating the md5 to compare to the md5 in the database. When you filter for any "illegal" characers (which is WAY better IMO) in any NEW passwords before storing them, you are sure you don't have to escape to get a correct match. It is preferrable to ban he chars this function would escape from any new passwords, to make password rememberability greater and overall it's just handier to work with data you are already sure of not having to escape (may sound dangerous, but if your registration script is solid, the data is, period.). It also helps users feel like "hey, there's been thought about this" (although it may annoy at first, they'll appreciate) when their password is refused. Be sure to give them a good explanation (bad rememberability, coder's laziness, etc... :)) ---- 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+52831 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52831&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52831&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52831&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52831&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52831&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+52831&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#89401) next »