Escaping Chars
| From: | Rob Walls | Date: | Fri, 07 Feb 2003 17:53:14 +0000 |
| Subject: | Escaping Chars | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-134764@lists.php.net to get a copy of this message | ||
I need to get a password value from a form, store it in a database and then
later be able to compare a login password to the one stored in the db.
This works great unless the password contains the '\' char.
magic_quotes_gpc is ON and magic_quotes_runtime is OFF.
As a klude, I tried just removing slashes from the input password using
stripslashes() before storing it in the db and then testing to see if
stripslashes(val from db)=stripslashes(val from form) in the login test to
see if they match. (the user shouldn't even know that slashes are being
striped, so I have to strip them on each input). They still don't match if
a slash is input for the original password storage, but I don't know why.
However, instead of this work-around (that doesn't even work), what I'd
really like to do is allow ANY character in the password, but take care of
all the quoting and escaping along the way (both ways...).
How is the best way to do that?
Thanks,
rob.walls@hill.af.mil