I'm looking to improve this class - any suggestions? It checks for empty, name, email, and password. The regex for email is very simple. A very lengthy article from the Linux Journal for improving upon this is here. The character set for password I borrowed from the NASA signup page. For name I allow letters, periods, and dashes. Testing for empty was developed with in this SO Post
class check
{
static function empty_user($a)
{
return (int)!in_array('',$a,TRUE);
}
static function name($a)
{
return preg_match('/^[a-zA-Z-\.]{1,40}$/',$a);
}
static function email($a)
{
return preg_match('/^[a-zA-Z0-9._s-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{1,4}$/',$a);
}
static function pass($a)
{
return preg_match('/^[a-zA-Z0-9!@#$%^&*]{6,20}$/',$a);
}
}