Not allowing characters
Moderator: General Moderators
Not allowing characters
I don't want my users to sign up with a period in their screenname. I've tried a bunch of stuff to no avail. Someone lend me a pointer?
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
what do you want to perform if these illegal characters are found? A preg_match() or looping over a string of illegal characters doing checks on each could tell you if one was in the string. Alternately, you could just replace them with nothing, for example, using str_replace() or preg_replace()..
I would like to alert the user that it's not allowed. preg_match would require a regex, right?
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
correct.
Code: Select all
if(preg_match('#\.#',$string))
{
// there's a period
}
else
{
// there isn't a period
}