📄 vote.asp
字号:
<!--#include file="conn.asp"-->
<!--#include file="inc/char.asp"-->
<%
dim sql
dim rs
dim CurPage
if request("id")="" then
response.write "您没有选择相关动画,请返回"
response.end
end if
If Request.QueryString("CurPage") = "" or Request.QueryString("CurPage") = 0 then
CurPage = 1
Else
CurPage = CINT(Request.QueryString("CurPage"))
End If
display = CurPage
set rs=server.createobject("adodb.recordset")
if request("action")="save" then
grade=request("grade")
if request("content")<>"" then
content=replace(replace(replace(request("content"),"'","‘"),"<","<"),">",">")
if request("username")<>"" then
username=replace(replace(replace(request("username"),"'","‘"),"<","<"),">",">")
end if
if request("useremail")<>"" then
useremail=replace(replace(replace(request("useremail"),"'","‘"),"<","<"),">",">")
end if
end if
downid=request("id")
if session("truevote")<>downid then
sql="select * from Dvote where (id is null)"
rs.open sql,conn,1,3
rs.addnew
if request("content")<>"" then
rs("content")=content
end if
if request("username")<>"" then
rs("username")=username
end if
if request("useremail")<>"" then
rs("useremail")=useremail
end if
rs("grade")=grade
rs("downid")=downid
session("truevote")=downid
rs.update
rs.close
else
response.write "<script>alert('对不起!你已经进行了投票!');window.close();</script>"
end if
end if
sql="select * from Dvote where downid="&request("id")&" order by id desc"
rs.open sql,conn,1,1
if rs.bof and rs.eof then
V_num=0
pingrade=0
else
V_num=rs.recordcount
pingrade=allgrade()/V_num
function allgrade()
dim tmprs
tmprs=conn.execute("Select sum(grade) As grades from Dvote where downid="&request("id")&"")
allgrade=tmprs("grades")
set tmprs=nothing
if isnull(allgrade) then allgrade=0
end function
end if
%>
<HTML><HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<TITLE>评论投票</TITLE>
<link rel="stylesheet" href="style.css">
</HEAD>
<BODY topmargin="0" leftmargin="0">
<div align="center">
<center>
<table border=0 cellpadding=0 cellspacing=0 width=100% bgcolor="#FF6600" style="border-collapse: collapse" bordercolor="#111111">
<tbody>
<tr bgcolor="#FFFFFF">
<td align=left height="16" colspan="2">
<table width="100%" border="0" cellspacing="1" cellpadding="0" height="16" style="border-collapse: collapse">
<tr>
<td>
<%if rs.eof and rs.bof then%><p align="center"><img border="0" src="images/nopl.gif" width="127" height="40"><%
else
'定义每页纪录条数
RS.PageSize=3
Dim TotalPages
TotalPages = RS.PageCount
If CurPage>RS.Pagecount Then
CurPage=RS.Pagecount
end if
RS.AbsolutePage=CurPage
rs.CacheSize = RS.PageSize
Dim Totalcount
Totalcount =INT(RS.recordcount)
StartPageNum=1
do while StartPageNum+10<=CurPage
StartPageNum=StartPageNum+10
Loop
EndPageNum=StartPageNum+9
If EndPageNum>RS.Pagecount then EndPageNum=RS.Pagecount
%></td>
</tr>
<tr>
<td>
<table board=0 width=100% cellspacing="1" cellpadding="5" border="0" style="border-collapse: collapse">
<tr>
<td width="18%" bgcolor="#ADE373" align="center">发表人</td>
<td width="37%" bgcolor="#ADE373" align="center">内 容</td>
<td width="33%" bgcolor="#ADE373" align="center">时 间</td>
<td width="12%" bgcolor="#ADE373" align="center">打 分</td>
</tr><%
I=0
p=RS.PageSize*(Curpage-1)
do while (Not RS.Eof) and (I<RS.PageSize)
p=p+1
%>
<tr>
<td width="18%" bgcolor="#EFEFEF" align="center" title="给<%=rs("username")%>写信"><a href="mailto:<%=rs("useremail")%>"><%if len(rs("username"))>4 then%><%=left(rs("username"),4)%><%else%><%=rs("username")%><%end if%></a></td>
<td width="37%" bgcolor="#EFEFEF" align="center" title="<%=rs("content")%>"><%if len(rs("content"))>9 then%><%=left(rs("content"),9)%>...<%else%><%=rs("content")%><%end if%></td>
<td width="33%" bgcolor="#EFEFEF" align="center"><%=rs("addtime")%></td>
<td width="12%" bgcolor="#EFEFEF" align="center"><%=rs("grade")%> 分</td>
</tr>
<%
I=I+1
RS.MoveNext
Loop
%><tr>
<td width="100%" bgcolor="#EFEFEF" align="center" colspan="4">共:(<font color="red"><b><%=V_num%></b></font>)人投票 平均:(<font color="red"><b><%=formatnumber(pingrade,1)%></b></font>)分 页:<b><font color="#009900"><%=CurPage%></font>/<%=TotalPages%></b> 页数:<a href="vote.asp?CurPage=<%=StartPageNum-1%>&id=<%=request("id")%>"><</a> <% For I=StartPageNum to EndPageNum
if I<>CurPage then %><a href="vote.asp?CurPage=<%=I%>&id=<%=request("id")%>">
<%=I%></a>
<% else %>
<%=I%>
<% end if %>
<% Next %>
<% if EndPageNum<RS.Pagecount then %>
<a href="vote.asp?CurPage=<%=EndPageNum+1%>&id=<%=request("id")%>">
更多</a><%end if%> | <a href="vote.asp?id=<%=request("id")%>">刷新</a></td>
</tr><%
end if
%>
</table>
</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
</center>
</div>
</BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -