Story Solitaire 3 new.asp

Source: Internet
Author: User
Tags visual studio
<%@ Language=vbscript%>
<HTML>
<HEAD>
<meta name= "generator" content= "Microsoft Visual Studio 6.0" >
</HEAD>
<BODY>
<%
If Request.Form ("submit") = "Update voting results" and Request.Form ("PSW") = "ZJ" Then
' Select the best article according to the result of the poll as a follow-up chapter of the Story
Phypath=server. MapPath ("/project4_local")
If Request.Form ("Selchap") <> "" Then
Mfilename=request.form ("Selchap")
Set Fsys=server. CreateObject ("Scripting.FileSystemObject")
For I=1 to 100
If not fsys. FileExists (Phypath & "/chapter" & I & ". html") Then
Destfname= "/chapter" & I & ". html"
Exit For
End If
Next
If Fsys. FileExists (Phypath & "/new1/" & Mfilename) Then
Sourcename= "/new1/" & Mfilename
Fsys. CopyFile Phypath & "/" & Sourcename,phypath & "/" & Destfname
End If
End If
Set Mfile=fsys. OpenTextFile (Phypath & "/story.txt", 8,true)
Set Mfile2=fsys. OpenTextFile (Phypath & "/" & Destfname,1,true)
' Open File Read header
Mcontent=mfile2.readall
' Get the title of the article
Pos1=instr (1,mcontent, "<title>", 1)
Pos2=instr (pos1,mcontent, "</title>", 1)
Title=mid (mcontent,pos1+7,pos2-pos1-7)
' Get the author of the article
Pos1=instr (1,mcontent, "Author:", 1)
Pos2=instr (Pos1,mcontent, "<", 1)
Author=mid (Mcontent,pos1+3,pos2-pos1-3)
Mfile.writeline "/project4_local" & Destfname & "&" "& I &" chapter: "& Title &" (Author: "& Author & ")"
Mfile2.close
Mfile.close
' Delete the article all
Fsys. DeleteFile Phypath & "/new1/*.*"
Set fsys=nothing
' Erase all content in the database
Set Conn=server. CreateObject ("Adodb.connection")
Conn. Connectionstring= "Dsn=vote"
Conn. Open
Conn. Execute ("Delete * from Tbvote")
Conn. Execute ("Delete * from Tbcomment")
Conn. Close
Set conn=nothing
Response.Write "Update poll results <br>"
Response.Write "The new article with the most votes added to the new chapter."
Else
' Update poll results if no password is entered, the prompt is displayed
Response.Write "<font size=4><strong>"
Response.Write "Note:<br> only managers can update articles based on voting results"
Response.Write "</strong></font>"
End If
%>
</BODY>
</HTML>



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.