function whitelist( $string ) { $whitelist = "[a-z0-9]"; if( eregi( $whitelist, stripslashes($string) ) ) { return true; } return false; }