stop-spammers-classic/modules/chkhyphens.php
2025-09-13 16:55:35 -06:00

32 lines
No EOL
762 B
PHP

<?php
if ( !defined( 'ABSPATH' ) ) {
status_header( 404 );
exit;
}
class chkhyphens extends be_module {
public function process( $ip, &$stats=array(), &$options=array(), &$post=array() ) {
if ( array_key_exists( 'email', $post ) ) {
$email = $post['email'];
if ( !empty( $email ) ) {
$email = substr( $email, 0, strpos( $email, '@' ) );
if ( substr_count( $email, "-" ) > 1 ) {
return 'Too many hyphens in: ' . $email;
}
}
}
if ( array_key_exists( 'user_email', $post ) ) {
$email = $post['user_email'];
if ( !empty( $email ) ) {
$email = substr( $email, 0, strpos( $email, '@' ) );
if ( substr_count( $email, "-" ) > 1 ) {
return 'Too many hyphens in: ' . $email;
}
}
}
return false;
}
}
?>