It has been recently launched. I have been troubled by spam and comments when I can post comments, and I have never found a good solution. In fact, wordpress has some powerful plug-ins that can prevent spam, such as Akismet, but this can only keep my mouth shut, so I have been looking for a relatively good solution recently.
I saw a good approach on Bigik.cn today, Bigik uses user verification in the form of addition operations to solve this problem. Now reprint the method. Of course, this method is not very perfect, and I found that some spam will come in.
How to use:
Program code
The code copy is as follows:
Functiongetnum()
DimQuesionNum
QuestionNum=7' Total number of questions. If you want to add a question, please modify this value first.
DimCodeIndex
CodeIndex=0
DimQuesionArray(100)
DimAnswerArray(100)
QuestionArray(0)="=1+1"'The list of questions and answers can be modified by yourself
AnswerArray(0)="2"
QuestionArray(1)="=2+2"
AnswerArray(1)="4"
QuestionArray(2)="=3+4"
AnswerArray(2)="7"
QuestionArray(3)="=2+4"
AnswerArray(3)="6"
QuestionArray(4)="=1+2"
AnswerArray(4)="3"
QuestionArray(5)="=2+3"
AnswerArray(5)="5"
QuestionArray(6)="=4+4"
AnswerArray(6)="8"
Randomize
CodeIndex=Int((QuesionNum*Rnd)+0)
Session("Getnum")=AnswerArray(CodeIndex)
getnum="<spanstyle=""margin-right:40px;"">"&QuesionArray(CodeIndex)&"</span>""
EndFunction
Calling method:
The code copy is as follows:
<%response.writegetnum()%>
Other revision suggestions:
The questions can be set to arbitrary questions of addition, subtraction, multiplication and division or other text questions, such as "987x654=?", "How many ethnic minorities are there in China?", etc. Just don't let the viewers not be able to answer: P.
It is recommended to change the width of the verification code input box to be smaller and set the maximum number of input characters to 2.