« 用rsync实现网站镜像和备份 | (回到Blog入口) | 增加页面LOADING功能! »

BLOG中是否需要加验证码

为了安全性,实现了BLOG验证码功能,但实际BLOG中很少有用验证码的,只是在一些。NET和PHP开发的BLOG见过,有时觉的BLOG加验证码对用户来说有点麻烦下面代码是http://www.guoblog.com/实现验证码的方法,有兴趣大家试验一下。
code.asp
[code]<%
Option explicit
Response.Buffer = True

为了安全性,实现了BLOG验证码功能,但实际BLOG中很少有用验证码的,只是在一些。NET和PHP开发的BLOG见过,有时觉的BLOG加验证码对用户来说有点麻烦下面代码是http://www.guoblog.com/实现验证码的方法,有兴趣大家试验一下。
code.asp
[code]<%
Option explicit
Response.Buffer = True
With Response
.Expires = -1
.AddHeader "Pragma","no-cache"
.AddHeader "cache-ctrol","no-cache"
End With
NumCode
Function NumCode()
Response.Expires = -1
Response.AddHeader "Pragma","no-cache"
Response.AddHeader "cache-ctrol","no-cache"
dim zNum,i,j
dim Ados,Ados1
Randomize timer
zNum = cint(8999*Rnd+1000)
Session("GetCodebbs") = zNum
dim zimg(4),NStr
NStr=cstr(zNum)
For i=0 to 3
zimg(i)=cint(mid(NStr,i+1,1))
Next
dim Pos
set Ados=Server.CreateObject("Adodb.Stream")
Ados.Mode=3
Ados.Type=1
Ados.Open
set Ados1=Server.CreateObject("Adodb.Stream")
Ados1.Mode=3
Ados1.Type=1
Ados1.Open
Ados.LoadFromFile(Server.mappath("body.Fix"))
Ados1.write Ados.read(1280)
for i=0 to 3
Ados.Position=(9-zimg(i))*320
Ados1.Position=i*320
Ados1.write ados.read(320)
next
Ados.LoadFromFile(Server.mappath("head.fix"))
Pos=lenb(Ados.read())
Ados.Position=Pos
for i=0 to 9 step 1
for j=0 to 3
Ados1.Position=i*32+j*320
Ados.Position=Pos+30*j+i*120
Ados.write ados1.read(30)
next
next
Response.ContentType = "image/BMP"
Ados.Position=0
Response.BinaryWrite Ados.read()
Ados.Close:set Ados=nothing
Ados1.Close:set Ados1=nothing
End Function
%>
[/code]
使用方法:

关于

此页面包含了发表于2005年1月 4日 13:58的 Blog 上的单篇日记。

此 Blog 的前一篇日记是 用rsync实现网站镜像和备份

此 Blog 的后一篇日记是 增加页面LOADING功能!

更多信息可在 主索引 页和 归档 页看到。

Creative Commons License
此 Blog 中的日记遵循以下授权 Creative Commons(创作共用)授权.
Powered by
Movable Type 6.3.2