關(guān)于阻止灌水留言的一個(gè)方法(隨機(jī)生成的4位認(rèn)證碼)_ASP教程
推薦:asp生成HTM靜態(tài)列表分頁(含代碼,已測試成功)!--#include file=conn.asp-- htmlheadTITLE分頁測試/TITLELINK href=inc/style.css type=text/css rel=stylesheet/head %strHead=strHeadhtml strHead=strHeadhead strHead=strHeadTITLE分頁測試/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('請輸入正確的認(rèn)證碼!');history.back()</script>")
response.End()
end if
分享:解讀ASP程序執(zhí)行SQL語句時(shí)防止注入攻擊的問題以下是一個(gè)簡單的用戶更改密碼的代碼 --------------------- username=request(user_name) pwd=request(pwd) username=replace(username,’,’’) pwd=replace(pwd,’,’’) sql=updatetbl_testsetpwd=’pwd’whereuid=’username’ setrs=
- asp FSO 讀寫文件本文件實(shí)現(xiàn)代碼
- asp中isNull、isEmpty和空字符串的區(qū)別
- asp獲取用戶真實(shí)IP地址的方法
- asp連接sqlserver數(shù)據(jù)庫實(shí)現(xiàn)代碼
- asp中正則表達(dá)式過濾html代碼函數(shù)
- asp中g(shù)et post提交表單區(qū)別
- 網(wǎng)頁模板:ASP內(nèi)建對象Request
- xmlhttp的open方法使用詳解
- ASP的常用的自定義函數(shù)大全
- asp中用for循環(huán)的一個(gè)小技巧
- eWebEditor v3.8 列目錄
- ASP無組件分頁實(shí)現(xiàn)思路及代碼
- 相關(guān)鏈接:
- 教程說明:
ASP教程-關(guān)于阻止灌水留言的一個(gè)方法(隨機(jī)生成的4位認(rèn)證碼)
。