
內容簡介
簡述:
這是一個 WordPress 的外掛,它會寄送電子郵件通知網站管理員關於成功或失敗的登入嘗試,其中包含使用者名稱、IP 地址及瀏覽器資訊。
專業解說:
這個 WordPress 外掛透過連接 ‘wp_login’ 及 ‘wp_login_failed’ WordPress 行動,分別觸發 ‘send_login_notification’ 和 ‘send_login_failed_notification’ 函式。成功的登入會由 ‘send_login_notification’ 函式寄出電子郵件通知管理員,失敗的登入會由 ‘send_login_failed_notification’ 函式寄出類似的通知。
‘send_login_notification’ 函式會寄送電子郵件到指定的管理員電子郵件地址,其中包含成功登入的使用者名稱、IP 地址及瀏覽器資訊。而 ‘send_login_failed_notification’ 函式則會寄送類似的電子郵件通知管理員,但報告的是失敗的登入。
這個外掛使用 wp_mail 函式寄出電子郵件,所有訊息會以 HTML 格式呈現以方便閱讀。此外掛同時使用 PHP 內建的跳脫字元函式來防止 XSS (跨站腳本攻擊)等潛在的安全漏洞。
總結來說,這個外掛提供了管理員一個簡便的方法來瞭解網站上使用者的登入狀況,同時確保顯示的敏感資訊是安全的。
外掛標籤
開發者團隊
原文外掛簡介
TLDR:
This is a plugin for WordPress websites that sends email notifications to the website admin for successful and failed login attempts. The email includes details like the username, IP address, and browser information.
Geek description:
This WordPress plugin sends email notifications upon successful and failed logins to the website’s admin. The plugin functions by hooking into the ‘wp_login’ and ‘wp_login_failed’ WordPress actions, and triggering the ‘send_login_notification’ and ‘send_login_failed_notification’ functions respectively.
The ‘send_login_notification’ function sends an email to the admin email address specified in the ‘admin_email’ option. The email includes details such as the successful login username, IP address, and browser information. The ‘send_login_failed_notification’ function sends a similar email to the admin, but for failed login attempts.
The plugin uses the wp_mail function to send the emails, and the messages are formatted as HTML for easy readability. The plugin ensures that the data being displayed, such as the username and IP address, is escaped using PHP’s built-in escape functions. This is done to prevent potential security vulnerabilities, such as XSS (Cross-Site Scripting).
In summary, this plugin provides an easy way for website administrators to stay informed of user login activity on their site, while also ensuring that sensitive information is displayed securely.
