Recommended: parsing how to filter uncivilized characters % Function badchar(str) badstr=Uncivilized character list, separate with | (because the characters cannot be contained when publishing, it cannot be posted.) 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 makes a voting in a dig program (some are called top and step on). Because the code is long, only the core part is posted: the code in the voting
The page shows the vote:
<div class=Vote1><script src='/voteResult.asp?id=1&action=view'></script></div>
The effect is as shown in the figure: Then click to vote, and the number of votes will increase by 1, as shown in the figure:
voteResult.asp code
<%
Response.ContentType=text/html; charset=gb2312
'Author: Wuqing Source: Please keep the source when reprinting
'Link database code omitted
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 'First check whether the id is correct
if request(action)=view Then 'If it is the id from the news code
if instr(request.Cookies(voteid),request(id)&|)<>0 Then 'Judge whether the news of the id has voted on
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)&'>Voting successfully</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)&)'>vote</a></span>);
end if
Else 'Click to vote to process code
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
Share: ASP calls pure IP library example % ' =================================================== ' Return IP information Disp_IPAddressData(IP,0) ' ==================================================== Function Look_Ip(IP) Dim Wry, IPType, QQWryVersion, IpCounter ' Set Class Object Set Wry = New TQQWry ' Start search
3 pages in total Previous page 123 Next page