im looking for solution on how to check the password combination... here is the example: - $text = "onlyalphanumericcharacters012345"; if (ereg('[^A-Za-z0-9]', $text)) { echo "This contains characters other than letters and numbers"; } else { echo "This contains only letters and numbers"; } PHP: but the problem here is - i want the code only accept with these kind of combination: - a) alphabet + number b) alphabet + symbol c) number + symbol can anyone help me? thanks alot
You might also want to define what symbols are allowed. Keep in mind with alt codes and everything else you can get a lot more symbols than you see on the face of your keyboard.
i want the general accepted symbol that used by many sites to make password more stronger. but that is not the biggest problem. can you show me how to do the combination?
You're best bet is to have it do three separate regexes, I would think. Something like: <? $password = "onlyalphanumericcharacters012345"; if (ereg('^([A-Za-z0-9]){8,20}$', $password) || (ereg('<alpha+symbol regex>', $password) || (ereg('<number+symbol regex>', $password)) echo 'This password is in the correct format'; else echo 'This password is not in the correct format'; ?> PHP: I would help with the last two regexes, but I'm way too tired, so hopefully another member can help me out. But the code surrounding it will check that it passes for ONE of the regexes, otherwise it will fail.
maybe my question is not very clear and i want to apologize for that... let me explain once again... what i really want is the code that can check where the input must have a) must have Alphabet + must have Number (if the input only one of these two, it will return false) b) must have Alphabet + must have Symbol (the condition same as A(above)) c) must have Number + must have Symbol (the condition same as A(above)) d) can have ALL as for the Symbol, im not sure what is the basic one that usually been used by other website but i know some of them accept symbol as password characters to increase security (hard for hacker to guess the password)