Changeset 2808130
- Timestamp:
- 10/31/2022 05:00:46 PM (3 years ago)
- Location:
- monitor-login/trunk
- Files:
-
- 3 edited
-
README.txt (modified) (4 diffs)
-
monitorlogin.php (modified) (1 diff)
-
src/App.php (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
monitor-login/trunk/README.txt
r2803974 r2808130 1 1 === Monitor Login === 2 2 Contributors: aixeiger 3 Tags: monitor, login, access, access login, monitor login, email, login notifications, notifications 3 Tags: monitor, login, access, access login, monitor login, email, login notifications, notifications, themes, plugins 4 4 Tested up to: 6.0 5 Stable tag: 0.1. 25 Stable tag: 0.1.3 6 6 Requires PHP: 7.4 7 7 License: GPLv2 or later … … 12 12 == Description == 13 13 14 Monitor Login helps you to monitor the user access login to your website, every time than a user log into your website, you will receive a very simply email with the Username, IP address, Browser, Platform and Internet service provider, this help you to maintain informed of where a usually a user login and help you to indentify if a user password is leaked if a login contain data from foreign ip addresses or internet service providers. 14 Monitor Login helps you to monitor the user access login to your website, every time than a user log into your website, you will receive a very simply email with the Username, IP address, Browser, Platform and Internet service provider, this help you to maintain informed of where a usually a user login and help you to indentify if a user password is leaked if a login contain data from foreign ip addresses or internet service providers. And the plugin activation/deactivation/delete notications are included too, as the Theme switch notifications, this can be enabled or disabled in the configurations plugins section 15 15 16 16 ## How works … … 22 22 * And set the new email and save 23 23 * On the first installation the email will be the same as the wordpress installation 24 * On the first installation the plugin notifications will be enabled by default 25 * Change in this section if you don't want to receive plugins notifications 26 * On update by default the plugin notifications are disabled 24 * On the first installaiton the plugins and themes notifications are enabled by default 25 * for enable or disable plugins or themes notifications change in this section 27 26 28 27 ## Changelog … … 30 29 0.1.1 Add support for notifications for enable/disable/deleted plugins activity 31 30 0.1.2 25-10-2022 Add support for detect login gate: wp-login.php or XML_RPC, and detect if the user is behind a proxy or vpn 31 0.1.3 31-10-2022 Add support for detect theme switching -
monitor-login/trunk/monitorlogin.php
r2803974 r2808130 5 5 * Author: TocinoDev 6 6 * Author URI: https://tocino.mx 7 * Version: 0.1. 27 * Version: 0.1.3 8 8 * Tested up to: 6.0 9 9 * Requires PHP: 7.4 -
monitor-login/trunk/src/App.php
r2803974 r2808130 19 19 add_action('deactivated_plugin', array($this, 'send_deactivate_plug_alert'), 20, 2); 20 20 add_action('deleted_plugin', array($this, 'send_deleted_plug_alert'), 20, 2); 21 add_action('switch_theme', array($this, 'send_switch_theme_alert'), 20, 3); 22 //add_action('after_switch_theme', array($this, 'send_switch_theme_alert'), 20, 2); 21 23 } 22 24 … … 130 132 $mailto, 131 133 "[Alert] Login access to your website: ".esc_html($blogname), 132 $this->get_login_tmpl($blogname, $username, $remote_addr, $gate, $current_browser, $platform, $host, $is_vpn_or_proxy), 134 $this->get_login_tmpl( 135 $blogname, 136 $username, 137 $remote_addr, 138 $gate, 139 $current_browser, 140 $platform, 141 $host, 142 $is_vpn_or_proxy 143 ), 133 144 array('Content-Type: text/html; charset=UTF-8') 134 145 ); … … 167 178 $mailto, 168 179 "[Alert] Plugin activation on your website: ".esc_html($blogname), 169 $this->get_plug_tmpl("activated", $blogname, $plugin, $user->user_login, $remote_addr, $current_browser, $platform, $host, $is_vpn_or_proxy), 180 $this->get_plug_tmpl( 181 "activated", 182 $blogname, 183 $plugin, 184 $user->user_login, 185 $remote_addr, 186 $current_browser, 187 $platform, 188 $host, 189 $is_vpn_or_proxy 190 ), 170 191 array('Content-Type: text/html; charset=UTF-8') 171 192 ); … … 204 225 $mailto, 205 226 "[Alert] Plugin deactivation on your website: ".esc_html($blogname), 206 $this->get_plug_tmpl("deactivated", $blogname, $plugin, $user->user_login, $remote_addr, $current_browser, $platform, $host, $is_vpn_or_proxy), 227 $this->get_plug_tmpl( 228 "deactivated", 229 $blogname, 230 $plugin, 231 $user->user_login, 232 $remote_addr, 233 $current_browser, 234 $platform, 235 $host, 236 $is_vpn_or_proxy 237 ), 207 238 array('Content-Type: text/html; charset=UTF-8') 208 239 ); … … 241 272 $mailto, 242 273 "[Alert] Plugin deleted on your website: ".esc_html($blogname), 243 $this->get_plug_tmpl("deleted", $blogname, $plugin, $user->user_login, $remote_addr, $current_browser, $platform, $host, $is_vpn_or_proxy), 274 $this->get_plug_tmpl( 275 "deleted", 276 $blogname, 277 $plugin, 278 $user->user_login, 279 $remote_addr, 280 $current_browser, 281 $platform, 282 $host, 283 $is_vpn_or_proxy 284 ), 285 array('Content-Type: text/html; charset=UTF-8') 286 ); 287 } 288 289 /** 290 * @param string $new_name 291 * @param WP_Theme $new_theme 292 * @param WP_Theme $old_theme 293 */ 294 public function send_switch_theme_alert($new_name, $new_theme, $old_theme) 295 //public function send_switch_theme_alert($new_theme, $old_theme) 296 { 297 $monitorthemes = get_option('monitorlogin_themes'); 298 if($monitorthemes == 'no') 299 return; 300 301 $mailto = get_option('monitorlogin_email'); 302 if(!$mailto) 303 return; 304 305 $old_name = $old_theme->get('Name'); 306 307 $user = wp_get_current_user(); 308 $blogname = get_bloginfo('name'); 309 $gate = $this->get_gate(); 310 $remote_addr = filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP); 311 $browser = new Browser(); 312 $current_browser = $browser->getBrowser(); 313 $platform = $browser->getPlatform(); 314 $host = $this->get_host($remote_addr); 315 $is_vpn_or_proxy = $this->is_vpn_or_proxy($host); 316 317 wp_mail( 318 $mailto, 319 "[Alert] Switch theme on your website: ".esc_html($blogname), 320 $this->get_theme_tmpl( 321 $blogname, 322 $new_name, 323 $old_name, 324 $user->user_login, 325 $remote_addr, 326 $current_browser, 327 $platform, 328 $host, 329 $is_vpn_or_proxy 330 ), 244 331 array('Content-Type: text/html; charset=UTF-8') 245 332 ); … … 365 452 } 366 453 454 private function get_theme_tmpl($blogname, $new_name, $old_name, $username, $remote_addr, $current_browser, $platform, $host, $is_vpn_or_proxy) 455 { 456 ob_start(); 457 ?> 458 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 459 <html xmlns="http://www.w3.org/1999/xhtml"> 460 <head> 461 <meta name="viewport" content="width=device-width, initial-scale=1.0" /> 462 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 463 <meta name="color-scheme" content="light"> 464 <meta name="supported-color-schemes" content="light"> 465 <style> 466 .body{ 467 background: #f0f0f1; 468 color: #718096; 469 width: 100%; 470 text-align: center; 471 } 472 .container{ 473 width: 100%; 474 } 475 .data{ 476 width: 570px; 477 margin: 0 auto; 478 background-color: #dde5ed; 479 padding: 10px 20px; 480 margin-top: 20px; 481 } 482 .text-center{ 483 text-align: center; 484 } 485 @media(max-width: 480px){ 486 .data{ 487 width: 100%; 488 } 489 } 490 </style> 491 </head> 492 <body> 493 <div class="container"> 494 <div class="data"> 495 <p>The active theme has switched from <strong><?php echo esc_html($old_name); ?></strong> to <strong><?php echo esc_html($new_name); ?></strong> on your wordpress website: <strong><?php echo esc_html($blogname); ?></strong></p> 496 <p>By the User: <strong><?php echo esc_html($username); ?></strong></p> 497 <p>From the IP: <strong><?php echo esc_html($remote_addr); ?></strong></p> 498 <p>Browser: <strong><?php echo esc_html($current_browser); ?></strong></p> 499 <p>Platform: <strong><?php echo esc_html($platform); ?></strong></p> 500 <p>Internet service provider: <strong><?php echo esc_html($host); ?></strong></p> 501 <?php if($is_vpn_or_proxy): ?> 502 <p><strong>[WARNING]</strong> The user is behind a Proxy or VPN</p> 503 <?php endif; ?> 504 <p class="text-center">Monitor Login.</p> 505 </div> 506 </div> 507 </body> 508 </html> 509 <?php 510 return ob_get_clean(); 511 } 512 367 513 public function install() 368 514 { 369 515 update_option('monitorlogin_email', get_option('admin_email')); 370 516 update_option('monitorlogin_plugs', 'yes'); 517 update_option('monitorlogin_themes', 'yes'); 371 518 } 372 519 … … 375 522 delete_option('monitorlogin_email'); 376 523 delete_option('monitorlogin_plugs'); 524 delete_option('monitorlogin_themes'); 377 525 } 378 526 … … 381 529 register_setting('monitorlogin_settings', 'monitorlogin_email'); 382 530 register_setting('monitorlogin_settings', 'monitorlogin_plugs'); 531 register_setting('monitorlogin_settings', 'monitorlogin_themes'); 383 532 } 384 533 … … 399 548 $monitoremail = get_option('monitorlogin_email'); 400 549 $monitorplugs = get_option('monitorlogin_plugs'); 550 $monitorthemes = get_option('monitorlogin_themes'); 401 551 ?> 402 552 <div class="wrap"> … … 422 572 </select> 423 573 </div> 574 <div style="margin-top: 25px;"> 575 <p>Themes switching notifications</p> 576 </div> 577 <div> 578 <select name="monitorlogin_themes"> 579 <option value="no" <?php if($monitorthemes == 'no'){echo 'selected="selected"';} ?>>No</option> 580 <option value="yes" <?php if($monitorthemes == 'yes'){echo 'selected="selected"';} ?>>Yes</option> 581 </select> 582 </div> 424 583 </div> 425 584 <?php submit_button('save'); ?>
Note: See TracChangeset
for help on using the changeset viewer.