<%@ 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>
Voting Results:</p>
<%
Set Conn=server. CreateObject ("Adodb.connection")
Conn. Connectionstring= "Dsn=vote"
Conn. Open
' Sort records in descending order of votes
Set Mreturn=conn. Execute ("SELECT * from Tbvote ORDER by votecount Desc")
If not Mreturn.bof then
' If there is a voting record
' Get the name of the article that gets the most votes
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)
' Get the title of the article
Title=mid (txtall,pos1+7,pos2-pos1-7)
Pos1=instr (1,txtall, "Author:")
Pos2=instr (Pos1,txtall, "<")
' Get the name of the author of the article
Author=mid (Txtall,pos1+3,pos2-pos1-3)
Txtfile.close
Set fsys=nothing
Response.Write "Article <font size=4 color=red face= Young Circle >" & title & "</font><br>"
Response.Write "Author:" & author & "<br>"
Response.Write "Get voted:" & Mreturn ("Votecount")
' The names of the posts voted out are passed to the next submission process with a hidden type of control
Response.Write "<input id=hidden1 type=hidden name=selchap value=" & TempStr & ">"
Else
Response.Write "There is no vote yet"
End If
Mreturn.close
Conn. Close
Set conn=nothing
%>
<p><input id=submit1 name=submit type=submit value= update poll results >
Password: <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>
Vote message
<%
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 "Haven't got any messages yet."
Else
Rec. Pagesize=1
If Request.ServerVariables ("http_method") = "Get" Then
' First request, the value of the page is 1
Page=1
End If
If Request.Form ("submit") = "after a message" then
Page=request ("page") + 1
End If
If Request.Form ("submit") = "previous Message" then
Page=request ("page")-1
End If
Rec. Absolutepage=page
If Page>1 Then
Response.Write "<input Type=submit value= before a message id=submit2 name=submit>"
Else
&n