mirror of
https://gh.wpcy.net/https://github.com/webguyio/stop-spammers-classic.git
synced 2026-05-24 23:55:55 +08:00
30 lines
No EOL
919 B
PHP
30 lines
No EOL
919 B
PHP
<?php
|
|
// this is specific to my website - needs to be made generic
|
|
// originally designed to block admin login attempts
|
|
|
|
if ( !defined( 'ABSPATH' ) ) {
|
|
status_header( 404 );
|
|
exit;
|
|
}
|
|
|
|
class chkadmin extends be_module {
|
|
public function process( $ip, &$stats = array(), &$options = array(), &$post = array() ) {
|
|
$login = $post['author']; // sticks login name into author
|
|
$pwd = $post['pwd'];
|
|
if ( stripos( $login, 'admin' ) === false ) {
|
|
return false;
|
|
}
|
|
// no users or authors named admin
|
|
// do a look up to see if there is an author named admin
|
|
if ( !function_exists( 'get_users' ) ) {
|
|
return false;
|
|
} // non-WP?
|
|
if ( get_user_by( 'login', $login ) ) {
|
|
return false;
|
|
} // false alarm - really is a person admin
|
|
// this may cause problems when a legitimate new user wants to include the string admin in their username
|
|
return 'Admin Login or Registration Attempt: ' . $login;
|
|
}
|
|
}
|
|
|
|
?>
|