The php script instance sharing _php instance that the guest login realizes the email reminder in WordPress

Source: Internet
Author: User
Login Email Alert Implementation method
The premise is that the space has the mail function, the test has no mail function method: Login interface Click "Forgot Password", there is mail sent to your email message function.

First, Login success reminder
Just like a bank login reminder, if someone logs into the system, it will send an e-mail to the mailbox, reminding you that someone logged in, if you did not log in, it is necessary to arouse vigilance. Put the following code in the functions.php of the topic:


/***************************************************** function name: Wp_login_  Notify v1.0 by Dh.huahua. Function: There is login WP backstage will email notice bo master ******************************************************/function wp_login_notify () {Date_  Default_timezone_set (' PRC ');  $admin _email = get_bloginfo (' Admin_email '); $to = $admin _email; $subject = ' Your blog space login reminder '; $message = ' 

Hello! Your blog space ('. Get_option ("Blogname"). ') have login!

' . '

Make sure it is your own login to prevent others from attacking! The login information is as follows:

'. '

Login name: '. $_post[' log '. '

' . '

Logon time: '. Date ("Y-m-d h:i:s"). '

' . '

Login IP: '. $_server[' REMOTE_ADDR '. '

'; $WP _email = ' no-reply@ '. Preg_replace (' #^www\.# ', ' ', Strtolower ($_server[' server_name ')); $from = "From: \" ". Get_option (' Blogname '). "\" < $WP _email> "; $headers = "$from \ncontent-type:text/html; Charset= ". Get_option (' Blog_charset '). "\ n"; Wp_mail ($to, $subject, $message, $headers);} Add_action (' Wp_login ', ' wp_login_notify ');

Second, login failure reminder
Someone tried to log into your system, but did not succeed, this repeated attempt to the action itself needs to be recorded, sent to the blogger, so that, as long as the wrong login, will send an e-mail to their own mailbox, the other's attempt to login and login password to your mailbox. Put the following code in the functions.php of the topic:

/***************************************************** function Name: Wp_login_failed_notify v1.0 by DH.huahua. Function: There is error login WP backstage will email notify Bo Master ******************************************************/function wp_login_failed_notify  () {date_default_timezone_set (' PRC ');  $admin _email = get_bloginfo (' Admin_email '); $to = $admin _email; $subject = ' Your blog space login error warning '; $message = '

How are you doing! Your blog space ('. Get_option ("Blogname"). ') have login errors!

' . '

Please make sure it is your own login error to prevent others from attacking! The login information is as follows:

' . '

Login name: '. $_post[' log ']. '

' . '

Login password: '. $_post[' pwd ']. '

' . '

Logon time: '. Date ("Y-m-d h:i:s"). '

' . '

Login IP: '. $_server[' REMOTE_ADDR '. '

'; $WP _email = ' no-reply@ '. Preg_replace (' #^www\.# ', ' ', Strtolower ($_server[' server_name ')); $from = "From: \" ". Get_option (' Blogname '). "\" < $WP _email> "; $headers = "$from \ncontent-type:text/html; Charset= ". Get_option (' Blog_charset '). "\ n"; Wp_mail ($to, $subject, $message, $headers);} Add_action (' wp_login_failed ', ' wp_login_failed_notify ');

The effect is as shown, there is a log-in location behind the Qqwry.dat made a query

Modify the background login address
Plug-in method
Many plug-ins can implement such functions, such as protected Wp-login and stealth Login Page, directly download the installation can, here not much introduction.

Code method
If you do not want to use the plugin, copy the following code directly into the functions.php file of the current topic:

Protect Background Login function Login_protection () {   

This will open the login page only if Http://siteurl/wp-login.php?word=fuck is turned on, otherwise it will automatically jump to http://blog.gimhoy.com/

But when bloggers do this, they receive a lot of email reminders every day, so they take a much simpler and more brutal approach: Modify the wp-login.php file name

For example, to change wp-login.php to gimhoy-login.php, but also to open the file, the inside of all the wp-login.php to replace the gimhoy-login.php. So the login address becomes http://siteurl/gimhoy-login.php. Combined with the previous method, it became a http://siteurl/gimhoy-login.php?word=fuck.

Simple and rude, aim to achieve.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.