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

📄 save_vote.asp

📁 前台完全分离了HTML与ASP
💻 ASP
字号:
<%
'***********************************************
'* Save Vote FUNCTION
'* 你可以对以下内容进行任何修改,但请保留版权,谢谢。
'* 零点设计在线  Power by marquee 2005年6月
'***********************************************
Function addVoteTheme()
	Dim VoteSections,ThemeID
	IF Request.Form("VoteTheme")="" Then
		addVoteTheme = "主题名字未填写"
		Exit Function
	End IF
	IF Request.Form("VoteSections")="" Then
		addVoteTheme = "选项不能为空!"
		Exit Function
	End IF	
	Set tRs = Server.CreateObject("Adodb.Recordset")
	Sql = "select * From ZD_VoteTheme"
	tRs.open Sql,conn,1,3
	tRs.addnew
	tRs("title") = Trim(Request.Form("VoteTheme"))
	tRs("StartTime") = now()
	tRs("EndTime") = FORMATDATETIME(Request.Form("EndTime"),vbShortDate)
	IF Request.Form("currentShow")="true" Then
		conn.execute("update ZD_VoteTheme set currentShow=false")
		conn.execute("delete * from ZD_VoteCount where ID<>0")
		tRs("currentShow")=true
	End IF
	tRs.update
	ThemeID = tRs("id")
	tRs.close
	Set tRs = Nothing

	VoteSections = Split(Request.Form("VoteSections"),",")
	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "select * From ZD_VoteSection"
	Rs.open Sql,conn,1,3
	for i=0 to ubound(VoteSections)
		Rs.addnew
		Rs("ThemeID") = ThemeID
		Rs("title") = Trim(VoteSections(i))
		Rs("hits") = 0
		Rs.update
	Next
	Rs.close
	Set Rs = Nothing
	call SaveLog(Session("member"),"成功添加"&Trim(Request.Form("VoteTheme"))&"主题",now(),"投票主题添加",getIP(),true)
	addVoteTheme = "投票主题添加成功!"
End Function

Function editeVoteTheme(editeID)
	Dim VoteSections,ThemeID
	IF isNumeric(editeID)<>True Then
     Response.Redirect("err.asp?message=非法的传值参数,请勿利用程序漏洞对本站破坏,谢谢。")
    End IF
	IF Request.Form("VoteTheme")="" Then
		editeVoteTheme = "主题名字未填写"
		Exit Function
	End IF
	IF Request.Form("VoteSections")="" Then
		editeVoteTheme = "选项不能为空!"
		Exit Function
	End IF	
	IF Request.Form("currentShow")="true" Then
		conn.execute("update ZD_VoteTheme set currentShow=false")
		conn.execute("delete * from ZD_VoteCount")
	End IF
	conn.execute("delete * from ZD_VoteSection where ThemeID="&editeID)
	Set tRs = Server.CreateObject("Adodb.Recordset")
	Sql = "select * From ZD_VoteTheme where id="&editeID
	tRs.open Sql,conn,1,3
	IF tRs.eof Then
    	response.Redirect("err.asp?message=未找到该记录!记录已删除或者非法的ID号!")
    End IF
	tRs("title") = Trim(Request.Form("VoteTheme"))
	tRs("EndTime") = FORMATDATETIME(Request.Form("EndTime"),vbShortDate)
	IF Request.Form("currentShow")="true" Then
	tRs("currentShow")=true
	End IF
	tRs.update
	ThemeID = tRs("id")
	tRs.close
	Set tRs = Nothing

	VoteSections = Split(Request.Form("VoteSections"),",")
	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "select * From ZD_VoteSection"
	Rs.open Sql,conn,1,3
	for i=0 to ubound(VoteSections)
	 IF VoteSections(i)<>"" Then
		Rs.addnew
		Rs("ThemeID") = ThemeID
		Rs("title") = Trim(VoteSections(i))
		Rs("hits") = 0
		Rs.update
	 End IF
	Next
	Rs.close
	Set Rs = Nothing
	call SaveLog(Session("member"),"成功修改"&Trim(Request.Form("VoteTheme"))&"主题",now(),"投票主题修改",getIP(),true)
	editeVoteTheme = "投票主题修改成功!"
End Function

Function delVote(t_id)
 dim tem_tid
 tem_tid=split(t_id,",")

 for i=0 to ubound(tem_tid)
 sql="delete * from ZD_VoteTheme where id="&tem_tid(i)
 delVote = delVote & "删除投票主题ID为&nbsp;<font color=red>"&tem_tid(i)&"</font>&nbsp;记录成功!<br>"
 conn.execute("delete * from ZD_VoteSection where ThemeID="&tem_tid(i))
 conn.execute(sql)
 next
 call SaveLog(Session("member"),"成功删除ID为"&t_id&"主题",now(),"投票主题删除",getIP(),true)
set DelFileObject=nothing
End Function
%>

⌨️ 快捷键说明

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