Nathan,

Thank you ... very thorough.

Best
R.C.
""Nathan Nobbe"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> i hate posting the same answer to a given question thats already been
> posted, but i had this all typed in when chris submitted his answer, so
here
> it is again..
>
> On Wed, Jun 18, 2008 at 10:36 PM, R.C. <[EMAIL PROTECTED]> wrote:
>
> > I have coded a php page that accepts a password.  What is the code to
make
> > sure the password entered is NOT case-sensitive?
>
>
> when you store the password, you can store it as all upper or all
lowercase,
> then when comparing against the stored value, do the same operation to the
> value supplied from the user, and compare those.  and you dont have to
> modify the original value if you dont want to, when you store it.  just
> remember to alter both the stored value and the user-supplied value when
> doing comparisons.
>
> /// here is an example comparison
> // get password value from db for user, put it in $storedPassword
> // suppose the value the user supplied in a form is in variable
> $userSuppliedPassword
> // now for the case insensitive comparison
> if(strtolower($storedPassword) == strtolower($userSuppliedPassword))
>   // passwords are the same
> else
>   // passwords are different
>
> also note in the above example, there is no encryption of the password,
> which you almost certainly want to have ;)
>
> -nathan
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to