pjblog将验证码改为加减法计算

已为老胡 2008-11-29 AM 974℃ 0条

打开commonfunction.asp,找到

Function getcode()
    getcode = "<img id=""vcodeImg"" src=""about:blank"" onerror=""this.onerror=null;this.src='common/getcode.asp?s='+Math.random();"" alt=""验证码"" title=""看不清楚?换一张"" style=""margin-right:40px;cursor:pointer;width:40px;height:18px;margin-bottom:-4px;margin-top:3px;"" onclick=""src='common/getcode.asp?s='+Math.random()""/>"
End Function
直接替换为:

Function getcode()
    Dim code, code1, codet
        Randomize
        If Int(Rnd * 2 + 1) = 1 Then
                codet = "+"
        Else
                codet = "-"
        End If
    Randomize
    code = Int(Rnd * 100 + 1)
    Randomize
    code1 = Int(Rnd * 100 + 1)
        If codet = "+" Then
                Session("GetCode") = code + code1
                getcode =  code & "+" & code1 & "=?" 
        ElseIf code > code1 Then
                Session("GetCode") = code - code1
                getcode =  code & "-" & code1 & "=?" 
        Else
                Session("GetCode") = code1 - code
                getcode =  code1 & "-" & code & "=?" 
        End if
'    getcode = "<img id=""vcodeImg"" src=""about:blank"" onerror=""this.onerror=null;this.src='common/getcode.asp?s='+Math.random();"" alt=""验证码"" title=""看不清楚?换一张"" style=""margin-right:40px;cursor:pointer;width:40px;height:18px;margin-bottom:-4px;margin-top:3px;"" onclick=""src='common/getcode.asp?s='+Math.random()""/>"
End Function

标签: PJblog

非特殊说明,本博所有文章均为博主原创。

评论啦~