else if(substr_count($username," ")>0) { die("Spaces are not allowed in names"); } else if(!preg_match("^[A-Za-z0-9]+$^", "$username")) { print "There were invalid characters in the username."; }