關(guān)于阻止灌水留言的一個(gè)方法(隨機(jī)生成的4位認(rèn)證碼)_ASP教程
推薦:asp生成HTM靜態(tài)列表分頁(yè)(含代碼,已測(cè)試成功)!--#include file=conn.asp-- htmlheadTITLE分頁(yè)測(cè)試/TITLELINK href=inc/style.css type=text/css rel=stylesheet/head %strHead=strHeadhtml strHead=strHeadhead strHead=strHeadTITLE分頁(yè)測(cè)試/TITLE strHead=strHeadLINK href=inc/style.cs
原理:在每次提交留言的時(shí)候,要輸入隨機(jī)生成的4位認(rèn)證碼.
以下代碼用在ASP
生成隨機(jī)4位數(shù):
<%
dim key
randomize timer
key=Int((8999)*Rnd +1000)
%>
在表單里顯示:
認(rèn)證碼:<%=key%>
<input type="text" name="rekey" size="8" maxlength="4">
<input value="<%=key%>" type="hidden" name="key">
表單提交后檢查:
key=Request.Form("key")
rekey=Request.Form("rekey")
if rekey<>key then
Response.Write("<script language=javascript>alert('請(qǐng)輸入正確的認(rèn)證碼!');history.back()</script>")
response.End()
end if
分享:解讀ASP程序執(zhí)行SQL語(yǔ)句時(shí)防止注入攻擊的問(wèn)題以下是一個(gè)簡(jiǎn)單的用戶(hù)更改密碼的代碼 --------------------- username=request(user_name) pwd=request(pwd) username=replace(username,’,’’) pwd=replace(pwd,’,’’) sql=updatetbl_testsetpwd=’pwd’whereuid=’username’ setrs=
- asp FSO 讀寫(xiě)文件本文件實(shí)現(xiàn)代碼
- asp中isNull、isEmpty和空字符串的區(qū)別
- asp獲取用戶(hù)真實(shí)IP地址的方法
- asp連接sqlserver數(shù)據(jù)庫(kù)實(shí)現(xiàn)代碼
- asp中正則表達(dá)式過(guò)濾html代碼函數(shù)
- asp中g(shù)et post提交表單區(qū)別
- 網(wǎng)頁(yè)模板:ASP內(nèi)建對(duì)象Request
- xmlhttp的open方法使用詳解
- ASP的常用的自定義函數(shù)大全
- asp中用for循環(huán)的一個(gè)小技巧
- eWebEditor v3.8 列目錄
- ASP無(wú)組件分頁(yè)實(shí)現(xiàn)思路及代碼
- 相關(guān)鏈接:
復(fù)制本頁(yè)鏈接| 搜索關(guān)于阻止灌水留言的一個(gè)方法(隨機(jī)生成的4位認(rèn)證碼)
- 教程說(shuō)明:
ASP教程-關(guān)于阻止灌水留言的一個(gè)方法(隨機(jī)生成的4位認(rèn)證碼)
。