Just wondering what function I should be using to check if a username has spaces in it when a user registers on a form?
I've got this for the invalid characters:
Code: Select all
function check_username($str)
{
//returns 1 if valid email, 0 if not
/* if(ereg("^.+@.+\..+$", $str))
return 1;
else
return 0; */
if (preg_match('/[a-z]+/i',$str))
{
return "1";
}
else
{
return "0";
}
}I'd appreciate any direction.
Thanks,
Rob