Add Google's reCAPTCHA verification code to the site to enhance validation

Source: Internet
Author: User

First Step Registration

The second step is to embed the code in the relevant web page after getting to the API

First, type the code into the template, which is the form submission page report.php the template

<tr>
<td height= "" ">Captcha</td>
<td height=" ><?php
Requir E_once ('.. /.. /..          /skin/google/recaptchalib.php ');
$publickey = "Fill in your application for the Apikey 、、、 public Key";
echo recaptcha_get_html ($publickey);
?></td>
</tr>

The next step is to post to the relevant page and add the code

E/enews/index.php at the top of the code

 <?php require_once ('.. /..
/skin/google/recaptchalib.php ');
  $privatekey = "Write your application key here";   $RESP = Recaptcha_check_answer ($privatekey,                                   $_server["REMOTE_ADDR"],                                   $_post["Recaptcha_challenge_field"],                              

    $_post["Recaptcha_response_field"]);   if (! $resp->is_valid) {    die ("incorrect!! <a href= ' # ' onclick= ' Javascript:history.back (-1); ' 
>click to Back!</a> ".          "(reCAPTCHA said:".) $resp->error.
")");  } 

The last thing you need to download here is a file that is used in the file above recaptchalib.php

Put it in the relevant file directory, OK?

The next few days to see if the effect is not slightly.

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.