how can i check if the password is more than 6 letters using php, this is for my registration form. :)) thanks
cheers!!! :)) excuse my dumbess, im kind of new to this
getaway
2010-10-14 22:10:58
haha dont worry about it, we were all new and dumb once :)
Sabeen Malik
2010-10-14 22:11:54
looooool :)) thanks
getaway
2010-10-14 22:18:08
I'm not sure I'd do the `trim()`. It might be useful if people are likely to paste passwords rather than typing them, but it might prevent enterprising users from putting a space on the end of their password.
staticsan
2010-10-14 22:35:32
thanksm can i just ask you how do you check for unwanted characters in the username, i only want letters, numbers, and underscores, and no spaces obviously
getaway
2010-10-14 22:45:44
Was on my way out, saw your comment and did a quick search, this should help `if((ereg("^[a-zA-Z0-9_\-]+$", $your_variable_here)) { // value username }`
Sabeen Malik
2010-10-14 22:51:58
@staticsan .. i think you have a very valid point, my main reason of using it was to disallow people from just entering 6 spaces in there. something to think about for getaway :)
Sabeen Malik
2010-10-14 22:53:20
cheers! thank your a genius sebeeen
getaway
2010-10-14 23:06:02
Lazy users are more likely to type `123456` or `password` as a bad password rather than six spaces. If you want to prevent bad passwords, you should do it properly: check for all the things that make a password "strong", assign points for each check and then require a minimum point score corresponding to most checks passing.
staticsan
2010-10-14 23:16:18
+1
A:
I think you will find this very usefull:
http://www.phpro.org/tutorials/Validating-User-Input.html
Good luck, Please tell me if you need any help with it!
Trufa
2010-10-14 22:11:17
I would definitely go with Sabeen´s answer, if you want to read further, read my answer. :)
Trufa
2010-10-14 22:14:53