Sina App Engine (SAE) Introductory Tutorial (4)-Saevcode (CAPTCHA service) use

Source: Internet
Author: User

Resources
    • Saevcode API Documentation
Using tutorials

All the verification code principle is to generate a vcode string, stored in the session, and the user's input to compare and judge, the following is a complete example of the use of code services:


Home index.html

<HTML><title>Sae Vcode Demo</title><Body>        <formAction= "check.php">                <inputtype= "text"name= "Vcode"><imgsrc= "vcode.php">                <inputtype= "Submit"value= "Submit">        </form></Body></HTML>

Script to generate the captcha vcode.php

<?PHPSession_Start();$vcode=NewSaevcode ();if($vcode===false)        Var_dump($vcode->errno (),$vcode-errmsg ()); $_session[' vcode '] =$vcode-answer ();$question=$vcode-question ();$imgdata=file_get_contents($question[' Img_url ']);Header("Content-type:image/jpg");Echo($imgdata);?>

User submits verification Code judgment script check.php

<? PHP $vcode $_request [' Vcode ']; Session_Start (); if ($_session$vcode) {        echo ' vcode error ';} Else {        echo "Vcode right";}
This example shows the address

http://lazydemo.sinaapp.com/saevcode/

Code Packaging

Http://lazydemo.sinaapp.com/saevcode/saevcode.zip

Sina App Engine (SAE) Introductory Tutorial (4)-Saevcode (CAPTCHA service) use

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.