?? savevote.asp
字號:
<!--#include file="const.asp"-->
<!--#include file="conn.asp"-->
<%
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("xz").count
if request("xz")(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 "<script>alert('"&error&"');</script>"
response.write "<script>history.back(1);</script>"
response.end
end if
end if
if request("id")="xg" then
conn.execute("update class set title='"&title&"',style='"&request("style")&"' where id="&request("classid"))
conn.execute("delete from vote where class="&request("classid"))
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")&")")
else
exit for
end if
next
response.write "<script>alert('修改投票成功');</script>"
response.write "<script>location.href='votelist.asp';</script>"
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 "<script>alert('刪除投票成功');</script>"
response.write "<script>location.href='votelist.asp';</script>"
else
conn.execute("insert into class (title,style,ren) values ('"&title&"','"&request("style")&"','"&session("admin")&"')")
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("xz").count
if request("xz")(i)<>"" then
conn.execute("insert into vote (vote,color,class) values ('"&request("xz")(i)&"','"&request("color")(i)&"',"&classid&")")
else
exit for
end if
next
response.write "<script>alert('添加投票成功');</script>"
response.write "<script>location.href='step1.asp';</script>"
end if
conn.close
set conn=nothing
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -