WordPress User Registration Increase Authentication Bans Machine Registration

As in the above figure,wordpress The default sends a new user registration and password change email to the administrator. Humanized age, I don’t understand whyWordPress StationNever change this function to an encumbrance, and the online solution to this problem is a modificationwordpressFrame code, remove the email code. I’m not changing it.WordPress FrameI can’t stand a small station that reminds me of how the wars were solved, and I can be sure that every day new users are registered to robots, not real ones, so registration is meaningless, so today I think about a stupid solution.

Ideas:

  1. Every day, people like this are registered to be robots. People scan them in bulk.WordPressBatch registered.
  2. As shown above, my blog has a registration and landing code, but it doesn’t have any egg value, so there are only two possibilities — one through an interface that I don’t know about the WP — to ignore the certification code; the second possibility is that someone else’s software will bring their own authentication codes to separate them from me.
  3. On appeal, I decided that the possibility of bulk registration could be eliminated directly if two certification codes were in place for registration. Although it was possible to do so, it would certainly have been mass and would therefore not be treated specifically because I changed the software to double authentication code, so this idea is feasible unless it really was used.wordpress I don’t know about mass registrations of the registered interface that ignores the authentication codes… and try it for a while first.

Accomplishing the code step:

I’ve already got a photo authentication code, so just add one:

//WordPress新用户注册随机数学验证码

function add_security_question_fields() {

     //获取两个随机数, 范围0~9

    $num1=rand(0,10);

    $num2=rand(0,10);

     //最终网页中的具体内容

    echo "<p><label for='math' class='small'>真人识别:$num1 + $num2 = ? </label><input type='text' name='sum' class='input' value='' size='25'>"

    ."<input type='hidden' name='num1' value='$num1'>"

    ."<input type='hidden' name='num2' value='$num2'></p>";

}

add_action('register_form','add_security_question_fields');

add_action( 'register_post', 'add_security_question_validate', 10, 3 );

function add_security_question_validate( $sanitized_user_login, $user_email, $errors) {

    $sum=$_POST['sum'];//用户提交的计算结果

    switch($sum){

    //得到正确的计算结果则直接跳出

    case $_POST['num1']+$_POST['num2']:break;

    //未填写结果时的错误讯息

    case null:wp_die('<script>alert("错误:请输入真人识别结果!");window.history.go(-1);</script>');break;

    //计算错误时的错误讯息

    default:wp_die('<script>alert("错误:真人识别结果错误,请重试!");window.history.go(-1);</script>');}

}

add_action( 'add_security_question','register_form' );

Add the above code to the end of the subject’s functs.php file. Effect diagram:

未经允许不得转载:萌萌Apprentissage » WordPress User Registration Increase Authentication Bans Machine Registration

Like (0) 打赏

Comments 0

Protected with IP Blacklist CloudIP Blacklist Cloud
  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏

//下一个脚本特效
//下一个脚本