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