Phpcms How to add a verification code to the V9 Form Wizard

Source: Internet
Author: User

The form thought relatively simple, so did not add the verification code function. Similar tutorials on the web are mostly inaccurate. So personally tested, found the following method is available. Hope to have the help of friends who need.

1 The first page that invokes the form joins the verification code. Form JS Call Template The default is \phpcms\templates\default\formguide\show_js.html.

Find this line of code in this file, about 23 lines

<tr> <th width= ">{if $info [' Star ']} <font color=" Red ">*</font>{/if} {$info [' name ']} & lt;/th> <td>{$info [' form ']} {$info [' Tips ']}</td> </tr>{/loop}

Add a line of code below.

<TR><TD style= "text-align:right;" > Verification Code </TD><TD colspan= "2" ><span title= "click to replace the Captcha" style= "Cursor:pointer;" ><input type= "text" id= "code" name= "code" size= "8" class= "Input-text" >{form::checkcode (' code_img ', ' 4 ', ' 14 ' ,}</span>) Please enter the verification code in the image </td></tr>

2 found this file \phpcms\modules\formguide\index.php

This needs to be modified in two places.

1) Find this line of code on the third line.

Defined (' In_phpcms ') or exit (' No permission resources. '); Define (' Cache_model_path ', Phpcms_path. Caches '. Directory_separator. ' Caches_model '. Directory_separator. ' Caches_data '. Directory_separator);

Then add the following two lines of code to the back

$session _storage = ' session_ '. Pc_base::load_config (' System ', ' session_storage ');p C_base::load_sys_class ($session _ storage);

2) Find the following line of code

if (Isset ($_post[' Dosubmit ')) {$tablename = ' form_ '. $r [' tablename ']; $this->m_db->change_table ($tablename);

Then add the following code below

if (!empty ($_session[' code ')) {//judgment code $code = isset ($_post[' Code ')) && trim ($_post[' code ')? Trim ($_post[' C   Ode ']): ShowMessage (L (' Input_code '), http_referer);   if ($_session[' code ']! = Strtolower ($code)) {ShowMessage (L (' Code_error '), http_referer); }  }


Phpcms How to add a verification code to the V9 Form Wizard

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.