Modify the verification code to an addition operation to effectively prevent advertising information.

Source: Internet
Author: User
It takes a lot of time to clean up comments and comments on the blog every day. Even if I didn't go online for three days, I opened my blog and found more than 90 comments on the ad. I realized that: it is time to improve PJ's verification method. Recently, we have seen that mifly's WP adopts a new verification code in the form of an addition calculation question, which is simple and clear. In addition, for viewers, fill in a one-to-two-digit answer, it is much more comfortable than the 4-to-6-digit verification code.
So I studied the verification code mechanism of PJ a little and made some changes based on similar features of boblog to implement user verification in addition operation form. Of course, the one on WP Algorithm The verification code is randomly generated, and the technical content is much higher than that of my simple small modification. The specific modification effect is as follows:

Modification method:
1. OPEN function. asp in the common directory and find the following in about 50 linesCode:

Program code '*************************************
'Get the registration code
'*************************************
Function getcode ()
Getcode = "End Function

2. replace it with the following code:

Program code '*************************************
'Get the registration code
'*************************************
'Function getcode ()
Getcode = "'End Function

'*************************************
'The registration code is obtained, which is an operational problem
'Newvalidate for pjblog2 by bigheadlyf
'Updated on:
'*************************************
Function getcode ()

Dim quesionnum
Quesionnum = 7' total number of problems. To add a problem, modify this value first.
Dim codeindex
Codeindex = 0

Dim quesionarray (100)
Dim answerarray (100)

Quesionarray (0) = "= 1 + 1" 'list of questions and answers, which can be modified by yourself
Answerarray (0) = "2"
Quesionarray (1) = "= 2 + 2"
Answerarray (1) = "4"
Quesionarray (2) = "= 3 + 4"
Answerarray (2) = "7"
Quesionarray (3) = "= 2 + 4"
Answerarray (3) = "6"
Quesionarray (4) = "= 1 + 2"
Answerarray (4) = "3"
Quesionarray (5) = "= 2 + 3"
Answerarray (5) = "5"
Quesionarray (6) = "= 4 + 4"
Answerarray (6) = "8"

Randomize
Codeindex = int (quesionnum * RND) + 0)
Session ("getcode") = answerarray (codeindex)
Getcode = "<span style =" "margin-Right: 40px;" ">" & quesionarray (codeindex) & "</span>"
End Function

3. Save the file, upload it to the server, and test ~

4. Other modification suggestions:
The question can be set to any question of addition, subtraction, multiplication, division, or other text questions, such as "987x654 = ?" "How many ethnic minorities are there in China ?" Wait, don't let the viewer fail to answer: P.
We recommend that you reduce the width of the verification code input box and set the maximum number of characters to 2.

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.