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?? Quote Link to comment Share on other sites More sharing options...
revraz Posted April 28, 2008 Share Posted April 28, 2008 Try the Regex forum. Quote Link to comment 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} Quote Link to comment Share on other sites More sharing options...
dreamkiller23 Posted April 29, 2008 Author Share Posted April 29, 2008 THANK YOU! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.