';
$msg .= 'New Plugin Name: ' . $antihacker_new_plugin;
$msg .= '
';
$msg .= 'Date : ' . $dt . '
';
$msg .= 'Domain: ' . $dom . '
';
$msg .= '
';
$msg .= 'This email was sent from your website ' . $dom .
' by Anti Hacker plugin.
';
$email_from = 'wordpress@' . $dom;
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From: " . $email_from . "\r\n" . 'Reply-To: ' . $ah_admin_email .
"\r\n" . 'X-Mailer: PHP/' . phpversion();
$to = $ah_admin_email;
$subject = 'Alert: New Plugin was installed at: ' . $dom;
wp_mail($to, $subject, $msg, $headers, '');
return 1;
}
$qpluginsnow = antihacker_q_plugins_now();
$qplugins = antihacker_q_plugins();
if ( ($qplugins == 0 and $qpluginsnow > 0) or ($qplugins > $qpluginsnow ) )
{
antihacker_save_name_plugins();
$qplugins = antihacker_q_plugins();
}
if ($qpluginsnow > $qplugins) {
$nplugins = get_site_option('antihacker_name_plugins', '');
$nplugins = explode(PHP_EOL, $nplugins);
$all_plugins = get_plugins();
$all_plugins_keys = array_keys($all_plugins);
if (count($all_plugins) < 1)
return;
$my_plugins_now = '';
$loopCtr = 0;
foreach ($all_plugins as $plugin_item) {
$plugin_title = $plugin_item['Name'];
$my_plugins_now[$loopCtr] = $plugin_title;
$loopCtr++;
}
$antihacker_new_plugin = '';
for ($i = 0; $i < $qpluginsnow; $i++) {
$plugin_name = $my_plugins_now[$i];
if ( ! in_array($plugin_name, $nplugins)) {
$antihacker_new_plugin = $plugin_name;
break;
}
}
add_action('plugins_loaded', 'antihacker_alert_plugin');
antihacker_save_name_plugins();
} // if ($qpluginsnow > $qplugins)
if ($qpluginsnow < $qplugins) {
antihacker_save_name_plugins();
}
} // End Report new plugin installed...
if(is_admin())
{
if(isset($_GET['page'])){
if ($_GET['page'] == 'anti-hacker')
{
add_filter('contextual_help', 'ah_contextual_help', 10, 3);
function ah_contextual_help($contextual_help, $screen_id, $screen)
{
$myhelp = '
Improve system security and help prevent unauthorized access to your account.';
$myhelp .= '
Read the StartUp guide at Anti Hacker Settings page.';
$myhelp .= '
Visit the plugin site for more details.';
$screen->add_help_tab(array(
'id' => 'wptuts-overview-tab',
'title' => __('Overview', 'plugin_domain'),
'content' => '
' . $myhelp . '
', )); return $contextual_help; } } } } function ahfindip() { $ip = ''; $headers = array( 'HTTP_CLIENT_IP', // Bill 'HTTP_X_REAL_IP', // Bill 'HTTP_X_FORWARDED', // Bill 'HTTP_FORWARDED_FOR', // Bill 'HTTP_FORWARDED', // Bill 'HTTP_X_CLUSTER_CLIENT_IP', //Bill 'HTTP_CF_CONNECTING_IP', // CloudFlare 'HTTP_X_FORWARDED_FOR', // Squid and most other forward and reverse proxies 'REMOTE_ADDR', // Default source of remote IP ); for ( $x = 0; $x < 8; $x++ ) { foreach ( $headers as $header ) { if ( ! isset( $_SERVER[$header] ) ) { continue; } $ip = trim( $_SERVER[$header] ); if ( empty( $ip ) ) { continue; } if ( false !== ( $comma_index = strpos( $_SERVER[$header], ',' ) ) ) { $ip = substr( $ip, 0, $comma_index ); } // First run through. Only accept an IP not in the reserved or private range. if($ip == '127.0.0.1') { $ip=''; continue; } if ( 0 === $x ) { $ip = filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE | FILTER_FLAG_NO_PRIV_RANGE ); } else { $ip = filter_var( $ip, FILTER_VALIDATE_IP ); } if ( ! empty( $ip ) ) { break; } } if ( ! empty( $ip ) ) { break; } } if (!empty($ip)) return $ip; else return 'unknow'; } function ah_whitelisted($antihackerip, $amy_whitelist) { for ($i = 0; $i < count($amy_whitelist); $i++) { if (trim($amy_whitelist[$i]) == $antihackerip) return 1; } return 0; } function ah_successful_login($user_login) { global $amy_whitelist; global $my_radio_all_logins; global $antihackerip; global $ah_admin_email; if (ah_whitelisted($antihackerip, $amy_whitelist) and $my_radio_all_logins <> 'Yes' ) { return 1;} $dt = date("Y-m-d H:i:s"); $dom = $_SERVER['SERVER_NAME']; $msg = 'This email was sent from your website '.$dom. ' by the AntiHacker plugin.