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 = '';
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
$ip = trim($ip);
if (!empty($ip))
return $ip;
else
return 'unknow';
}
function whitelisted($ip, $amy_whitelist)
{
for ($i = 0; $i < count($amy_whitelist); $i++) {
if (trim($amy_whitelist[$i]) == $ip)
return 1;
}
return 0;
}
function successful_login($user_login)
{
global $amy_whitelist;
global $my_radio_all_logins;
global $ip;
global $admin_email;
if (whitelisted($ip, $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. ';
$msg .= 'Date : ' . $dt . ' ';
$msg .= 'Ip: ' . $ip . ' ';
$msg .= 'Domain: ' . $dom . ' ';
$msg .= 'Role: ' . $user_login;
$msg .= ' ';
$msg .= 'Add this IP to your withelist to stop this email and change your Notification Settings.';
$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: ' . $user_login . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$to = $admin_email;
$subject = 'Login Successful at: '.$dom;
wp_mail( $to, $subject, $msg, $headers, '' );
return 1;
}
function ah_activated()
{
$ip = ahfindip() ;
global $my_whitelist;
if(is_admin())
{
if (empty($my_whitelist)) {
if ( get_site_option( 'my_whitelist') !== false ) {
$return = update_site_option('my_whitelist', $ip);
}
else
{
$return = add_site_option('my_whitelist', $ip);
}
}
}
}
function email_display()
{ ?>
My Wordpress user email: