📄 admin_vote.asp
字号:
<!--#include file="inc/config.asp"-->
<!--#include file="mdb.asp"-->
<!--#include file="inc/FORMAT.asp"-->
<%
if session("adminlogin")<>sessionvar then
Response.Write("<script language=javascript>alert('你尚未登录,或者超时了!请重新登录');this.top.location.href='admin.asp';</script>")
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
Response.Write("<script language=javascript>alert('你必须填写投票主题!');history.back(1);</script>")
end if
if startdate="" then
startdate=formatdatetime(now(),2)
else
startdate=formatdatetime(startdate,2)
end if
if expiredate="" then
founderr=true
Response.Write("<script language=javascript>alert('你必须填写该投票主题的过期日期!');history.back(1);</script>")
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
Response.Write("<script language=javascript>alert('你必须指定操作的对象!');history.back(1);</script>")
else
vtid=cint(request.form("id"))
end if
if vtname="" then
founderr=true
Response.Write("<script language=javascript>alert('你必须填写投票主题!');history.back(1);</script>")
end if
if startdate="" then
startdate=formatdatetime(now(),2)
else
startdate=formatdatetime(startdate,2)
end if
if expiredate="" then
founderr=true
Response.Write("<script language=javascript>alert('你必须填写该投票主题的过期日期!');history.back(1);</script>")
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
Response.Write("<script language=javascript>alert('你必须指定操作的对象!');history.back(1);</script>")
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
Response.Write("<script language=javascript>alert('非法的对象参数!');history.back(1);</script>")
end if
if itemname="" then
founderr=true
Response.Write("<script language=javascript>alert('你必须填写选项名称!');history.back(1);</script>")
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
Response.Write("<script language=javascript>alert('非法的对象参数!');history.back(1);</script>")
end if
if itemname="" then
founderr=true
Response.Write("<script language=javascript>alert('你必须填写选项名称!');history.back(1);</script>")
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
Response.Write("<script language=javascript>alert('非法的对象参数!');history.back(1);</script>")
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
%>
<HTML><HEAD><TITLE>管理中心</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<LINK href="inc/admin.css" type=text/css rel=StyleSheet>
<META content="MSHTML 6.00.2800.1126" name=GENERATOR>
<script language="javascript" src="inc/PopupCalendar.js" ></script>
<script >
var oCalendarEn=new PopupCalendar("oCalendarEn");
oCalendarEn.Init();
var oCalendarChs=new PopupCalendar("oCalendarChs");
oCalendarChs.weekDaySting=new Array("日","一","二","三","四","五","六");
oCalendarChs.monthSting=new Array("一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月");
oCalendarChs.oBtnTodayTitle="今天";
oCalendarChs.oBtnCancelTitle="取消";
oCalendarChs.Init();
</script>
</HEAD>
<body onkeydown=return(!(event.keyCode==78&&event.ctrlKey)) >
<%if request.querystring("action")="newvote" then%>
<table align="center" width="98%" align="center" border="1" cellspacing="0" cellpadding="4" class=lanyubk style="border-collapse: collapse">
<form name="form1" method="post" action="">
<tr class=lanyuss>
<td colspan="2">
新增投票主题</td>
</tr>
<tr class=lanyuds>
<td width="16%">主题名称</td>
<td width="84%">
<input type="text" name="vt_name" size="50" maxlength="50" class="textarea">
</td>
</tr>
<tr class=lanyuds>
<td width="16%">开始日期</td>
<td width="84%">
<input readonly type="text" name="vt_startdate" id="aa" onclick="getDateString(this,oCalendarChs)" value=""></td>
</tr>
<tr class=lanyuds>
<td width="16%">过期日期</td>
<td width="84%">
<input readonly type="text" name="vt_expiredate" id="aa" onclick="getDateString(this,oCalendarChs)" value=""></td>
</tr>
<tr class=lanyuqs align="center">
<td colspan="2" height="30" bgcolor="#F5F5F5">
<input type="submit" name="Submit" value="确定新增" class="button">
<input type="reset" name="Reset" value="清空重填" class="button">
</td>
</tr>
<input type="hidden" name="action" value="newvote">
<input type="hidden" name="MM_insert" value="true">
</form>
</table>
<%end if
if request.querystring("action")="vote" then
sql="select * from votetopic"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
%>
<table align="center" width="98%" align="center" border="1" cellspacing="0" cellpadding="4" class=lanyubk style="border-collapse: collapse">
<tr class=lanyuss>
<td colspan="3">
投票主题管理</td>
</tr>
<tr class=lanyuqs align="center">
<td width="10%">编号</td>
<td width="60%">投票主题</td>
<td width="30%">操作</td>
</tr>
<%do while not rs.eof%>
<tr class=lanyuds>
<td align="center"><%=rs("vt_id")%> </td>
<td><%=rs("vt_name")%> </td>
<td align="center"><a href="admin_vote.asp?action=vote&caction=edit&id=<%=rs("vt_id")%>">编辑</a>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -