日期:2013-06-12  浏览次数:20787 次

<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>
<FORM action="new.asp" target=mainFrame method=post id=form1 name=form1>
<P>
投票结果:</P>
<%
    set conn=server.CreateObject("adodb.connection")
    conn.ConnectionString="dsn=vote"
    conn.Open
    '按投票记数降序方式排列记录
    set mreturn=conn.Execute("select * from tbvote order by votecount desc")
    if not mreturn.bof then
    '如果存在投票记录
        '取得获得投票数最多的文章的文件名
        tempstr=mreturn("votechapter")
        phypath=server.MapPath("/project4_local")
        set fsys=server.CreateObject("scripting.filesystemobject")
        set txtfile=fsys.OpenTextFile(phypath & "/new1/" & tempstr,1)
        txtall=txtfile.readall
        pos1=instr(1,txtall,"<title>",1)
        pos2=instr(1,txtall,"</title>",1)
        '取得文章的标题
        title=mid(txtall,pos1+7,pos2-pos1-7)
        pos1=instr(1,txtall,"作者:")
        pos2=instr(pos1,txtall,"<")
        '取得文章作者的名字
        author=mid(txtall,pos1+3,pos2-pos1-3)
        txtfile.close
        set fsys=nothing
        Response.Write "文章<font size=4 color=red face=幼圆>" & title & "</font><br>"
        Response.Write "作者:" & author & "<br>"
        Response.Write  "获得投票:" & mreturn("votecount")
        '将投票评选出来的文章名用hidden类型的控件传递到下次提交处理
        Response.Write "<INPUT id=hidden1 type=hidden name=selchap value=" & tempstr & ">"
    else
        Response.Write "目前还没有投票"
    end if
    mreturn.close
    conn.Close
    set conn=nothing
%>
<P><INPUT id=submit1 name=submit type=submit value=更新投票结果>
口令:<INPUT type="password" id=password1 name=psw style="HEIGHT: 21px; WIDTH: 90px">
</P>
</FORM>
<HR>
<FORM action="viewcomment.asp" method=POST id=form2 name=form2>
投票留言
<%
set rec=server.CreateObject("adodb.recordset")
rec.ActiveConnection="dsn=vote"
rec.Source="select * from tbcomment"
rec.Open ,,1,1
if rec.BOF then
    Response.write "还没有任何留言"
else
    rec.PageSize=1
    if Request.ServerVariables("http_method")="GET" then
        '第一次请求,页面的值为1