dreamkiller23 Posted April 28, 2008 Share Posted April 28, 2008 I'm making an admin page that can add new users to my database the admin enters their ID, their lastname, firstname, phone number, etc. ALSO the admin enters their password BUT i want their password to be at least 6 characters with the first character being a letter. The password should have at least one upper-cased letter, a number, and a symbol (% or # or ~)... $pattern = '(^[a-zA-Z][A-Z]+[0-9]+[/%/#/`]+)'; $pwd = stripslashes({$_POST['pwd_field']}); if (ereg($pattern,{$_POST['pwd_field']})) { echo "nope. bad pwd."; } i just can get the $pattern right. any ideas?? Link to comment https://forums.phpfreaks.com/topic/103320-form-password-checking/ Share on other sites More sharing options...
revraz Posted April 28, 2008 Share Posted April 28, 2008 Try the Regex forum. Link to comment https://forums.phpfreaks.com/topic/103320-form-password-checking/#findComment-529152 Share on other sites More sharing options...
roopurt18 Posted April 28, 2008 Share Posted April 28, 2008 $pattern = '/^[a-zA-Z]([a-zA-Z0-9]|[:punct:]){5}$/'; If you want the PW to be between 6 and Y chars in length, change {5} to {5,Y} Link to comment https://forums.phpfreaks.com/topic/103320-form-password-checking/#findComment-529185 Share on other sites More sharing options...
dreamkiller23 Posted April 29, 2008 Author Share Posted April 29, 2008 THANK YOU! Link to comment https://forums.phpfreaks.com/topic/103320-form-password-checking/#findComment-529507 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.