?? admin_vote.asp
字號:
<!--#include file="config.asp"-->
<!--#include file="conn.asp"-->
<!--#include file="format.asp"-->
<!--#include file="error.asp"-->
<!--#include file="body/incjs.asp"-->
<!--#include file="body/adminmenu.asp"-->
<!--#include file="body/foot.asp"-->
<!--#include file="body/adminvote_body.asp"-->
<title><%=webname%>-投票管理</title>
<script language="javascript">
if(top.frames.length == 0)
{
document.location = "login.asp";
}
else
{
if(parent.ryan_bar)
{
}
else
{
parent.location = "login.asp";
}
}
</script>
<%
dim founderr,errmsg
founderr=false
errmsg=""
if session("adminlogin")<>sessionvar then
founderr=true
errmsg=errmsg+"<br>"+"<li>你尚未登錄,或者超時了!請<a href='admin.asp'>重新登錄</a>!"
call diserror()
response.end
else
if request.form("MM_insert") then
if request.form("action")="newvote" then
dim vtname,startdate,expiredate
vtname=trim(replace(request.form("vt_name"),"'",""))
startdate=request.form("vt_startdate")
expiredate=request.form("vt_expiredate")
if vtname="" then
founderr=true
errmsg=errmsg+"<br>"+"<li>你必須填寫投票主題!"
end if
if startdate="" then
startdate=formatdatetime(now(),2)
else
startdate=formatdatetime(startdate,2)
end if
if expiredate="" then
founderr=true
errmsg=errmsg+"<br>"+"<li>你必須填寫該投票主題的過期日期!"
else
expiredate=formatdatetime(expiredate,2)
end if
if founderr then
call diserror()
response.end
else
sql="select * from votetopic"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
rs.addnew
rs("vt_name")=vtname
rs("vt_startdate")=startdate
rs("vt_expiredate")=expiredate
rs.update
rs.close
set rs=nothing
response.redirect "admin_vote.asp?action=vote"
end if
end if
if request.form("action")="editvote" then
dim vtid
vtname=trim(replace(request.form("vt_name"),"'",""))
startdate=request.form("vt_startdate")
expiredate=request.form("vt_expiredate")
if request.form("id")="" then
founderr=true
errmsg=errmsg+"<br>"+"<li>你必須指定操作的對象!"
else
vtid=cint(request.form("id"))
end if
if vtname="" then
founderr=true
errmsg=errmsg+"<br>"+"<li>你必須填寫投票主題!"
end if
if startdate="" then
startdate=formatdatetime(now(),2)
else
startdate=formatdatetime(startdate,2)
end if
if expiredate="" then
founderr=true
errmsg=errmsg+"<br>"+"<li>你必須填寫該投票主題的過期日期!"
else
expiredate=formatdatetime(expiredate,2)
end if
if founderr then
call diserror()
response.end
else
sql="select * from votetopic where vt_id="&vtid
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
rs("vt_name")=vtname
rs("vt_startdate")=startdate
rs("vt_expiredate")=expiredate
rs.update
rs.close
set rs=nothing
response.redirect "admin_vote.asp?action=vote"
end if
end if
if request.form("action")="delvote" then
if request.form("id")="" then
founderr=true
errmsg=errmsg+"<br>"+"<li>你必須指定操作的對象!"
else
vtid=cint(request.form("id"))
end if
if founderr then
call diserror()
response.end
else
sql="select * from votetopic where vt_id="&vtid
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
rs.delete
rs.close
set rs=nothing
response.redirect "admin_vote.asp?action=vote"
end if
end if
if request.form("action")="newitem" then
dim itemname
vtid=cint(request.form("id"))
itemname=trim(replace(request.form("item_name"),"'",""))
if vtid<1 then
founderr=true
errmsg=errmsg+"<br>"+"<li>非法的對象參數!"
end if
if itemname="" then
founderr=true
errmsg=errmsg+"<br>"+"<li>你必須填寫選項名稱!"
end if
if founderr then
call diserror()
response.end
else
sql="select * from voteitem"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
rs.addnew
rs("item_name")=itemname
rs("vt_id")=vtid
rs.update
rs.close
set rs=nothing
response.redirect "admin_vote.asp?action=vote&caction=edit&id="&vtid
end if
end if
if request.form("action")="edititem" then
dim itemid
itemid=cint(request.form("id"))
itemname=trim(replace(request.form("item_name"),"'",""))
if itemid<1 then
founderr=true
errmsg=errmsg+"<br>"+"<li>非法的對象參數!"
end if
if itemname="" then
founderr=true
errmsg=errmsg+"<br>"+"<li>你必須填寫選項名稱!"
end if
if founderr then
call diserror()
response.end
else
sql="select * from voteitem where item_id="&itemid
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
rs("item_name")=itemname
rs.update
rs.close
set rs=nothing
response.redirect "admin_vote.asp?action=vote&caction=edit&id="&request.form("vtid")
end if
end if
if request.form("action")="delitem" then
itemid=cint(request.form("id"))
if itemid<1 then
founderr=true
errmsg=errmsg+"<br>"+"<li>非法的對象參數!"
end if
if founderr then
call diserror()
response.end
else
sql="select * from voteitem where item_id="&itemid
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
rs("item_name")=itemname
rs.delete
rs.close
set rs=nothing
response.redirect "admin_vote.asp?action=vote&caction=edit&id="&request.form("vtid")
end if
end if
end if
call adminvote_body()
call endpage()
end if
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -