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

📄 new.asp

📁 ASP+SQL Server动态网站开发从基础到实践教程
💻 ASP
字号:
<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>
<% 
if Request.Form("submit")="更新投票结果" and Request.Form("psw")="zj" then
	'根据投票结果选定最好的文章作为故事的后续章节
	phypath=server.MapPath("../chap12")
	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)
	'打开文件读取标题
	mcontent=mfile2.readall
	'取得文章的标题
	pos1=instr(1,mcontent,"<title>",1)
	pos2=instr(pos1,mcontent,"</title>",1)
	title=mid(mcontent,pos1+7,pos2-pos1-7)
	'取得文章的作者
	pos1=instr(1,mcontent,"作者:",1)
	pos2=instr(pos1,mcontent,"<",1)
	author=mid(mcontent,pos1+3,pos2-pos1-3)
	mfile.writeline "../chap12/" & destfname & "	" & "第" & i & "章:" & title & "(作者:" & author & ")"
	mfile2.close
	mfile.close
	'将文章全部删除
	fsys.DeleteFile phypath & "/new1/*.*"
	set fsys=nothing
	'清除数据库里所有的内容
	set conn=server.CreateObject("adodb.connection")
	conn.ConnectionString="Provider=microsoft.jet.oledb.4.0;data source=" & server.mappath("../chap12/vote.mdb")
	conn.Open
	conn.Execute("delete * from tbvote")
	conn.Execute("delete * from tbcomment")
	conn.Close 
	set conn=nothing
	Response.Write "更新投票结果<br>"
	Response.Write "得票最多的新文章加入到新的一章中去了"
else
'更新投票结果如果没有输入口令,则显示提示信息
	Response.Write "<font size=4><strong>" 
	Response.Write "注意:<br>只有管理者才能根据投票结果更新文章"
	Response.Write "</strong></font>"
end if
%>
</BODY>
</HTML>

⌨️ 快捷键说明

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