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