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

📄 vote.asp

📁 8款下载系统源代码 2003-3-11 21:37:45 433 949k · 都很常见: 猛虎山庄、燕衔泥(飞扬的软件第二版用的就是他
💻 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"),"'","‘"),"<","&lt;"),">","&gt;")
		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
			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">
<meta name="keywords" content="软件icq,http://www.softicq.com">
<LINK href="style.css" rel=stylesheet>
<title>评论投票</title>
</head>
<body leftMargin=0 topMargin=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>
</body>
</html>
<%
	rs.close
	set rs=nothing
	conn.close
	set conn=nothing
%>

⌨️ 快捷键说明

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