i want that my password field should contain both capital and small letters?please suggest me wat condition as i need to apply? thanks
$a="ssssssdss"; echo ( preg_match("/[a-z]/",$a) && preg_match("/[A-Z]/",$a) ) ? "it's good" : "it's bad"; PHP:
md5 the password in the database. Then when they try to log in, verify that the query returns a result. "SELECT 1 WHERE user=" . $user . " AND password = " . md5($password);
Read the OP wrong. I thought he was asking about checking the password. MySQL isn't case sensitive by default so md5 is the easy way to make passwords case sensitive. If you verify case changes in the input but then do "SELECT 1 WHERE user=$user and password=$password" you didn't accomplish anything. You could also use Javascript to check the password. You just compare the original string to the all uppercase version of the string and the all lower case version of the string. If either of those match then the password is either all lowercase or all uppercase and you can simply alert the user before wasting time processing their input on the server side.
so using md5, show me how you intend to check for both upper and lowercase characters in the input before it is hashed.
heh, you changed the post 3 minutes after i responded.... either way, a pattern match is the best way to go. be it in php or javascript. <?php // $a = input if ( preg_match("/[a-z]/",$a) && preg_match("/[A-Z]/",$a) ) { // it's good } else { // it's bad } PHP: javascript: // a = input if (a.match(/[a-z]/) && a.match(/[A-Z]/)) { // it's good } else { // it's bad }