故事接龙10 viewcomment.asp

发表于:2007-06-30来源:作者:点击数: 标签:
%@ Language= VB Script % 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.
<%@ 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
        page=1
    end if
    if Request.Form("submit")="后一个留言" then
        page=request("page") + 1
    end if
    if  Request.Form("submit")="前一个留言" then
        page=request("page")-1
    end if
    rec.AbsolutePage=page
    if page>1 then
        Response.Write "<INPUT type=submit value=前一个留言 id=submit2 name=submit>"
    else
        Response.Write "<INPUT type=submit value=前一个留言 id=submit2 name=submit disabled=true>"
    end if
    if page<rec.PageCount then
        Response.Write "<INPUT type=submit value=后一个留言 id=submit1 name=submit>"
    else
        Response.Write "<INPUT type=submit value=后一个留言 id=submit1 name=submit disabled=true>"
    end if
    Response.Write "<INPUT type=hidden value=" & page & " id=hid3 name=page>"
%>

<P></P>
<TABLE WIDTH=85% BORDER=1 CELLSPACING=1 CELLPADDING=1>
    <TR>
        <TD>这位来自
            <%=rec("userip")%>
             网友投票的留言</TD>
    <TR>
        <TD>
            <%=rec("comment")%></TD>
    </TR>
</TABLE>
<P>
<%
    rec.Close
    set rec=nothing
end if
%>
</FORM></P>
</BODY>
</HTML>

原文转自:http://www.ltesting.net