⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vote.asp

📁 程序介绍: 1、内嵌式投票系统
💻 ASP
字号:
<%
''''''''''''''''''''''''''''''''''''''''''''
'
'  TXSite / 通用网站系统
'
'  版本    :v1.8.20
'
'  制作人  :milp(milp@21cn.com)
'
'  版权所有:源码之家(http://www.21tx.com)
'
'  主页地址:http://www.21tx.com
'            http://www.bestnets.net
'            http://www.soucn.com
'
'  技术支持:http://www.21tx.com/bbs
'
''''''''''''''''''''''''''''''''''''''''''''
Option Explicit
%>
<!--#include file="conn.asp"-->
<%
dim CurPage,display,V_num,pingrade,grade,content,mainid,StartPageNum,EndPageNum,I,p
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
if request("action")="save" then
grade=request("grade")
if request("content")<>"" then
content=replace(replace(replace(request("content"),"'","‘"),"<","&lt;"),">","&gt;")
end if
mainid=request("id")
if session("truevote")<>mainid then
sql="select * from vote where (id is null)"
rs.open sql,conn,1,3
rs.addnew
if request("content")<>"" then
rs("content")=content
end if
rs("grade")=grade
rs("mainid")=mainid
session("truevote")=mainid
rs.update
rs.close
else
response.write "<script>alert('对不起!你已经进行了投票!');window.close();</script>"
end if
end if
sql="select * from vote where mainid="&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 vote where mainid="&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">
<LINK href="style.css" rel=stylesheet>
<title>文章及下载评论投票</title>
</head>
<body bgcolor="#99ccff" leftMargin=0 marginheight="0" marginwidth="0">
        <table border="0" width="100%" cellspacing="0" cellpadding="1">
          <tr>  
            <td align=center bgcolor=#CCCCFF height=20>为您喜爱的内容打分评论<br>
    </td>
          </tr>
          <tr>  
            <td align=center>
目前共有<%=V_num%>人打分,综合评分为<%=formatnumber(pingrade,1)%><br>
    </td>
          </tr>
          <tr>
            <td align=center>
            <form method=post action="vote.asp">
      <input type="hidden" name="action" value="save">
              <input name=grade type=radio value=1>
              <font color="#FFFFFF"> <font color="#000000">1</font></font>
              <input name=grade type=radio value=2>
              <font color="#FFFFFF"> <font color="#000000">2</font></font>
              <input checked name=grade type=radio value=3>
              <font color="#000000">3</font>
              <input name=grade type=radio value=4>
              <font color="#000000">4</font>
              <input name=grade type=radio value=5>
              <font color="#000000">5</font>
              <input name=id type=hidden value='<%=Request("id")%>'><br>
      简短评论:<input name=content type=text size="30" class="smallinput" maxlength="100">&nbsp;<input type=submit value="提交" name="cmdok" class="buttonface">
            </form>
    </td>
          </tr>
          <tr>  
            <td align=center bgcolor=#CCCCFF height=20>已发表评论
    </td>
          </tr>
          <tr>  
            <td align=center>
<%if rs.eof and rs.bof then%>
暂时没有评论
<%
else
'定义每页纪录条数
RS.PageSize=10
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
%>
<table board=0 width=100%>
<%
I=0
p=RS.PageSize*(Curpage-1)
do while (Not RS.Eof) and (I<RS.PageSize)
p=p+1
%> 
<tr>
<td width=90%>

<font color="green">☉ </font><%=rs("content")%>&nbsp;&nbsp;[打分:<%=rs("grade")%>]</td></tr>
<%
I=I+1
RS.MoveNext
Loop
%>
</table> 

<table width="100%" border="0" cellspacing="0" cellpadding="3" align="center">
  <tr>
    <td>页次: <font color="#CC0000"><%=CurPage%></font>/<%=TotalPages%></td>
    <td align="right">
     页数: <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%> <b>|</b> <a href="vote.asp?id=<%=request("id")%>">刷 新</a>&nbsp;</td>
  </tr>
</table>
<%
end if
%>
    </td>
          </tr>
</table>
<script language=javascript src="count.asp?id=8"></script>
</body>
</html>
<%Call objend()%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -