推荐:解析如何过滤不文明字符% 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下一页