Page 1 of 1

log in problem

Posted: Sat Apr 21, 2007 1:48 pm
by gpong
I make login system and I want to verifying that username can't use blank space or "/" and other symbol. how to solve this problem?? thanks very much

Posted: Sat Apr 21, 2007 2:18 pm
by veridicus
I typically validate usernames with a single regex (preg_match) that checks length and valid characters.

Posted: Mon Apr 23, 2007 11:13 am
by gpong
can you give example how to use it. thanks very much.

Posted: Mon Apr 23, 2007 11:48 am
by John Cartwright
ctype_alpha() && strlen() is what I would use

Posted: Mon Apr 23, 2007 12:06 pm
by Burrito
I'd go the regex route with preg_match()

something like this maybe?

untested:

Code: Select all

$pattern = "/(\/|\s+)/";