鲁门网站系统

源代码在线查看: savevote.asp

软件大小: 785 K
上传用户: anlan001
关键词: 网站
下载地址: 免注册下载 普通下载 VIP

相关代码

				
				
				
								if request("id")"del" then
				err=0
				title=request("title")
				if title="" then
				err=1
				error=error+"标题不能为空\n"
				end if
				a=0
				for i=1 to request("xg").count
				if request("xg")(i)="" then
				exit for
				end if
				a=a+1
				next
				if a=0 then
				err=1
				error=error+"选择内容不能为空\n"
				end if
				if err=1 then
				response.write "alert('"&error&"');"
				response.write "history.back(1);"
				response.end
				end if
				
				kg=int(request.form("kg"))
				overtime=request("years")&"-"&request("months")&"-"&request("days")&" "&request("hours")&":"&request("minutes")&":"&request("seconds")
				end if
				
				if request("id")="xg" then
				conn.execute("update class set title='"&title&"',style='"&request("style")&"',kg="&kg&",overtime='"&overtime&"' where id="&request("classid"))
				for i=1 to request("yc").count
				if request("xg")(i)"" then
				conn.execute("update [vote] set vote='"&request("xg")(i)&"',color='"&request("color")(i)&"' where id="&request("yc")(i))
				elseif request("xg")(i)="" then
				conn.execute("delete from [vote] where id="&request("yc")(i))
				end if
				next
				for i=1 to request("xz").count
				if request("xz")(i)"" then
				conn.execute("insert into vote (vote,color,class) values ('"&request("xz")(i)&"','"&request("color")(i)&"',"&request("classid")&")")
				end if
				next
				response.write "alert('修改投票成功');"
				response.write "location.href='votelist.asp';"
				elseif request("id")="del" then
				conn.execute("delete from vote where class="&request("classid"))
				conn.execute("delete from class where id="&request("classid"))
				response.write "alert('删除投票成功');"
				response.write "location.href='votelist.asp';"
				else
				conn.execute("insert into class (title,style,ren,kg,overtime) values ('"&title&"','"&request("style")&"','"&request.cookies("admin")&"',"&kg&",'"&overtime&"')")
				set rs=server.createobject("adodb.recordset")
				sql="select top 1 * from class where title='"&title&"' order by id desc"
				rs.open sql,conn,3,1
				classid=rs("id")
				rs.close
				set rs=nothing
				for i=1 to request("xg").count
				if request("xg")(i)"" then
				conn.execute("insert into vote (vote,color,class) values ('"&request("xg")(i)&"','"&request("color")(i)&"',"&classid&")")
				else
				exit for
				end if
				next
				response.write "alert('添加投票成功');"
				response.write "location.href='step1.asp';"
				end if
				conn.close
				set conn=nothing
				%>			

相关资源