推薦:解析如何過濾不文明字符% Function badchar(str) badstr=不文明字符列表,用|分開(因發表時不能含有那些字符,所以不能貼出。) badword=split(badstr,|) For i=0 to Ubound(badword) If instr(str,badword(i)) 0 then badchar=True Exit For Else badchar=False End If Next
ASP做一個dig程序中的投票(有的叫頂一下,踩一下),由於代碼較長,只貼出核心部分:投票中的代碼
網頁顯示投票的部分:
<div class=Vote1><script src='/voteResult.asp?id=1&action=view'></script></div>
效果如圖:,然後點投一票,票數增加1,如圖:
voteResult.asp代碼
<%
Response.ContentType=text/html; charset=gb2312
'作者:無情來源: 轉載請保留出處
'鏈接數據庫代碼省略
set rs=server.createobject(adodb.recordset)
sql=(select news_id,vote from dwww_news where news_id=&request(id)&)
rs.open sql,conn,1,1
if not rs.eof and not rs.bof Then '先檢查傳過來的id是否正確
if request(action)=view Then '如果是新聞代碼中傳來的id
if instr(request.Cookies(voteid),request(id)&|)<>0 Then '判斷該id的新聞是否投過票
response.write document.write (<div class='result' id='result_&rs(news_id)&'>&rs(vote)&</div>);
response.write document.write (<span class='result_link' id='result_link_&rs(news_id)&'>投票成功</span>);
else
response.write document.write (<div class='result' id='result_&rs(news_id)&'><a href='javascript:dovote(&request(id)&)'>&rs(vote)&</a></div>);
response.write document.write (<span class='result_link' id='result_link_&rs(news_id)&'><a href='javascript:dovote(&request(id)&)'>投一票</a></span>);
end if
Else '點擊投票處理代碼
if instr(request.Cookies(voteid),request(id)&|)<>0 then
Response.Cookies(voteid)=request(id)&|
Response.Cookies(voteid).Expires=Date()+365
else
Response.Cookies(voteid)=request(id)&|&request.Cookies(voteid)
Response.Cookies(voteid).Expires=Date()+365
end If
分享:ASP調用純真IP庫實例% ' ============================================ ' 返回IP信息Disp_IPAddressData(IP,0) ' ============================================ Function Look_Ip(IP) Dim Wry, IPType, QQWryVersion, IpCounter ' 設置類對象Set Wry = New TQQWry ' 開始搜
共3頁上一頁123下一頁