gusucode.com > 学校共青团组织网站源代码 > 学校共青团组织网站源代码/626/admin/admin_tp2.asp

    <%
if session("dj")<>"1" then
   Response.Write "<BR><BR><BR><BR><center>权限不足,你没有此功能的管理权限"
   Response.end
end if
%>
<!--#include file = admin_chk.asp -->
<!--#include file = admin_conn.asp -->
<!--#include file = titleb.asp -->
<html>

<head>
<meta http-equiv="Content-Language" content="zh-cn">
<!--#include file = language.asp -->
<title></title>
<STYLE type="text/css">
<!--
a:link       {text-decoration: none; font-family: AdobeSm; color: #000000 }
a:visited    {text-decoration: none; color: #000000 }
A:hover      {COLOR: green; FONT-FAMILY: "宋体,MingLiU"; TEXT-DECORATION: underline}
body         {font-size: 9pt; font-family: 宋体,MingLiU, Arial;color: #000000}
TD           {FONT-SIZE: 9pt; FONT-FAMILY: "宋体,MingLiU, Arial";color: #000000;table-layout:fixed;word-break:break-all}
p            {FONT-SIZE: 9pt; FONT-FAMILY: "宋体,MingLiU, Arial";color: #000000}
input        {FONT-SIZE: 9pt; FONT-FAMILY: "宋体,MingLiU, Arial";color: #000000}
body         {margin-top: 0; margin-bottom: 0;margin-left:0;margin-right:0; color: #000000}
select       {FONT-SIZE: 9PT;}
option       {FONT-SIZE: 9pt;}
textarea     {FONT-SIZE: 9pt;}
-->
</STYLE>
<script language="JavaScript">
<!--
function FP_jumpMenu(el,frm,sel) {//v1.0
 var href=el.options[el.selectedIndex].value; if(sel) el.selectedIndex=0;
 if('_new'==frm) open(href); else eval(frm+".location='"+href+"'");
}
// -->
</script>
</head>
<%
id=trim(Request("id"))
up=trim(Request("up"))
down=trim(Request("down"))
tpid=trim(Request("tpid"))
delid=trim(Request("delid"))
editid=trim(Request("editid"))
saveid=trim(Request("saveid"))
tpxx=trim(Request("tpxx"))
endtime=trim(Request("endtime"))
DD=trim(Request("DD"))
DDSL=trim(Request("DDSL"))
sj=date()
eendtime=date()

if ddsl<>"" and tpid<>"" then
	conn.Execute "update [tp] set [ddsl]="&ddsl&" where id="&clng(tpid)
end if

sql="select * from [tp] where id="&tpid&" order by id desc"
set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open sql,conn,1,1
if rs.recordcount<>0 then
	title=rs("title")
	endtime=rs("endtime")
	ddsl=rs("ddsl")
	DD=rs("DD")
	if ddsl="" then ddsl=0
end if
rs.close:set rs=nothing

if delid<>"" then
	conn.Execute "delete from [tptitle] where ID="&CInt(delid)
end if

if editid="" and saveid="" and tpxx<>"" then
	conn.Execute "insert into [tptitle] ([tpxx],[tpid],[tps]) values('"&tpxx&"',"&tpid&",0)"
	Response.Redirect "admin_tp2.asp?tpid="&tpid
elseif editid<>"" and saveid="" and tpxx="" then
	set rs = Server.CreateObject("ADODB.RecordSet")
	rs.Open "select * from [tptitle] where id="&editid&" order by id desc",conn,1,1
	if rs.recordcount<>0 then
		etpxx=rs("tpxx")
	end if
	rs.close:set rs=nothing
elseif saveid<>"" and tpxx<>"" then
	conn.Execute "update [tptitle] set [tpxx]='"&tpxx&"' where id="&clng(saveid)
	Response.Redirect "admin_tp2.asp?tpid="&tpid
elseif id<>"" and up="1" then
	conn.Execute "update [tptitle] set [tps]=tps+1 where id="&clng(id)
elseif id<>"" and down="1" then
	conn.Execute "update [tptitle] set [tps]=tps-1 where id="&clng(id)
	set rs = Server.CreateObject("ADODB.RecordSet")
	rs.Open "select * from [tptitle] where id="&id&" order by id desc",conn,1,3
	if rs.recordcount<>0 then
		if rs("tps")<0 then
			rs("tps")=0
			rs.update
		end if
	end if
	rs.close:set rs=nothing
end if
%>
<body>
<br><center>
<form method="POST" action="admin_tp2.asp?tpid=<%=tpid%>&saveid=<%=editid%>">
	选项:<input type="text" name="tpxx" size="40" value='<%=etpxx%>'> <input type="submit" value="保存" name="B1">
</form>
</center>
<center>
<%
set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open "select * from [tptitle] where tpid="&tpid&" order by id asc",conn,1,1
%>
<div align="center">
	<table border="0" cellpadding="0" cellspacing="0" width="700" id="table2">
		<tr>
		<%
			if DD=2 then
		%>
			<td>必选数量:
			<select size="1" onchange="FP_jumpMenu(this,'window',false)" id="id1" name="D1">
			
			<option value="?DDSL=0&TPID=<%=TPID%>" <% if ddsl=0 then Response.Write " selected " %>>不限制</option>
			<%
				if ddsl="" then ddsl=0
				for i=1 to rs.recordcount
			%>
			<option value="?DDSL=<%=i%>&TPID=<%=TPID%>" <% if ddsl=i then Response.Write " selected " %>>至少必选<%=I%>项</option>
			<%
				next
			%>
			</select>(仅多项选择时有效)</td>
		<%
			end if
		%>
			<td>结束时间:<%=endtime%> <a href=admin_tp.asp>[返回]</a></td>
		</tr>
	</table>
</div>

</center><br>
<div align="center">
	<table border="1" cellpadding="2" width="700" id="table1" style="border-collapse: collapse" bordercolor="#C0C0C0">
		<tr>
			<td height="25" background="../images/bj3.jpg" align="center" width="467"><a href=admin_tp.asp><%=title%></a></td>
			<td height="25" background="../images/bj3.jpg" align="center" width="115">投票数</td>
			<td height="25" background="../images/bj3.jpg" align="center" width="101">操作</td>
		</tr>
<%

set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open "select * from [tptitle] where tpid="&tpid&" order by id asc",conn,1,1
while not rs.eof
%>
		<tr>
			<td width="467"><%=rs("tpxx")%></td>
			<td width="115"> <a href="admin_tp2.asp?tpid=<%=tpid%>&id=<%=rs("id")%>&up=1" title='加一个投票数'>↑</a><a href="admin_tp2.asp?tpid=<%=tpid%>&id=<%=rs("id")%>&down=1" title='减一个投票数'>↓</a> <%=rs("tps")%></td>
			<td align=center width="101">
			<a href="admin_tp2.asp?editid=<%=rs("id")%>&tpid=<%=tpid%>">修改</a> <a onclick='{if(confirm("您确定删除吗?此操作将不能恢复!")){return true;}return false;}' href="admin_tp2.asp?delid=<%=rs("id")%>&tpid=<%=tpid%>">删除</a></td>
		</tr>
<%
rs.movenext
wend
rs.close:set rs=nothing
%>
	</table>
</div>

</body>

</html>
<%
conn.close:set conn=nothing
%>