部份代码
<%
' 排序动作
if request.querystring("action")="des" then
'向上一个
midd= request.querystring("midd")
Set rs = Server.CreateObject("ADODB.Recordset")
if request.querystring("as")="up" then
if session("lg")="cn" then
sql="select top 1 * from video where desno > "& request.querystring("desid")
else
sql="select top 1 * from video_e where desno > "& request.querystring("desid")
end if
end if
if request.querystring("as")="dom" then
if session("lg")="cn" then
sql="select top 1
* from video where desno < "& request.querystring("desid") &" order
by
desno
desc"
else
sql="select top 1
* from video_e where desno < "& request.querystring("desid")&" order
by
desno
desc"
end if
end if
rs.open sql,conn,1,3
if rs.eof and rs.bof then
if request.querystring("as")="up" then
response.write("<script>alert(""已经到顶"");location.href=""video_List.asp"";</script>")
end if
if request.querystring("as")="dom" then
response.write("<script>alert(""已经到底"");location.href=""video_List.asp"";</script>")
end if
'response.end
else
rsflashid=rs("desno")
rs("desno")=request.querystring("desid")
'response.write
(rs("desno"))
'response.write(rs("id"))
end if
rs.update
rs.close
'response.write
(rs("desno"))
'=========================================================
Set rsa= Server.CreateObject("ADODB.Recordset")
if session("lg")="cn" then
sqla="select * from video where Id="& request.querystring("midd")
else
sqla="select * from video_e where Id="& request.querystring("midd")
end if
rsa.open sqla,conn,1,3
if request.querystring("as")="dom" then
rsa("desno")=rsa("desno")-1
end if
if request.querystring("as")="up" then
rsa("desno")=rsa("desno")+1
end if
rsa.update
rsa.close
Response.Write "<script>alert(""修改成功"");location.href=""video_List.asp"";</script>"
Response.End
end if
%>
<%
const MaxPerPage=15
dim totalPut
dim CurrentPage
dim TotalPages
dim i,j
dim idlist
dim title
title=request("txtitle")
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
if not isempty(request("selAnnounce")) then
idlist=request("selAnnounce")
if instr(idlist,",")>0 then
dim idarr
idArr=split(idlist)
dim id
for i = 0 to ubound(idarr)
id=clng(idarr(i))
call deleteannounce(id)
next
else
call deleteannounce(clng(idlist))
end if
end if
dim sql
dim rs
%>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var checkflag = "false";
function check(field) {
if (checkflag == "false") {
for (i = 0; i < field.length; i++) {
field[i].checked = true;}
checkflag = "true";
return " 不 选 "; }
else {
for (i = 0; i < field.length; i++) {
field[i].checked = false; }
checkflag = "false";
return " 全 选 "; }
}
//
End -->
</script>
<link href="style/admin.css" rel="stylesheet" type="text/css">
<body leftmargin="2" topmargin="8">
<table border="0" width="700" cellspacing="0" cellpadding="3" align="center">
<tr>
<td width="100%" align="center"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<form name="searchsoft" method="POST" action="video_list.asp">
<tr>
<td> 查找产品:
<input name="txtitle" type="text" class=smallInput size="13">
<input type="submit" value="查 询" name="title" class="buttonface">
</td>
</tr>
</form>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<%
if session("lg")="cn" then
SqlSort = "Select * from video_class where parent=0 order by id"
else
SqlSort = "Select * from video_class_e where parent=0 order by id"
end if
Set RsSort = Conn.Execute(SqlSort )
if RsSort.eof and RsSort.bof then
Response.write("<tr><td height=30 align=center>还没有设置分类.......</td><tr>")
response.end
else
%>
<tr>
<td height="30" align="center"><a href="video_list.asp">全部信息</a></td>
<%
do while not RsSort.eof
%>
<td align="center"><a href="video_list.asp?ClassID=<%=RsSort("ID")%>"><font color="#FF0000"><%=RsSort("classname")%></font></a> </td>
<%
if session("lg")="cn" then
sqlsort1="Select * from video_class where parent=" & RsSort("ID")
else
sqlsort1="Select * from video_class_e where parent=" & RsSort("ID")
end if
set rssort1=conn.execute(sqlsort1)
if not rssort1.eof then%>
<%do while not rssort1.eof%>
<td align="center"><a href="video_list.asp?ClassID=<%=RsSort1("ID")%>"><%=RsSort1("classname")%></a> </td>
<%
rssort1.movenext
loop
end if
rssort1.close
set rssort1=nothing
RsSort.movenext
loop
end if
RsSort.close
set RsSort=nothing
%>
</tr>
</table>
<table width="700" border="0" cellspacing="0" cellpadding="0">
<form method=Post action="video_list.asp">
<tr>
<td><%
ClassID=Request("ClassID")
if ClassID<>"" then
if session("lg")="cn" then
sql="select video.id,video.title,video.ucode,video.issue,video.pic,video.mpass,video.desno from video inner join video_class on video.classid=video_class.id where video_class.Id="&classID&" or video_class.parent="& classID &" order by video.desno desc"
else
sql="select video_e.id,video_e.title,video_e.ucode,video_e.issue,video_e.pic,video.mpass,video.desno from video_e inner join video_class_e on video_e.classid=video_class_e.id where video_class_e.Id="&classID&" or video_class_e.parent="& classID &" order by video_e.desno desc"
end if
end if
if title<>"" then
if session("lg")="cn" then
sql="select video.id,video.title,video.ucode,video.issue,video.pic,video.mpass,video.desno from video where title like '%"&trim(title)&"%' or content like '%"&trim(title)&"%' order by desno desc"
else
sql="select video_e.id,video_e.title,video_e.ucode,video_e.issue,video_e.pic,video.mpass,video.desno from video_e where title like '%"&trim(title)&"%' or content like '%"&trim(title)&"%' order by desno desc"
end if
end if
if classId="" and title="" then
if session("lg")="cn" then
sql="select video.id,video.title,video.ucode,video.issue,video.pic,video.mpass,video.desno from video order by desno desc"
else
sql="select * from video_e order by desno desc"
end if
end if
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "<table width='700' border='0' align='center' cellpadding='0' cellspacing='1' bgcolor='#CCCCCC'><tr bgcolor='#FFFFFF'><td align='center' height='28'> 还 没 有 任 何 产 品 </td><tr></table>"
else
totalPut=rs.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
showpage totalput,MaxPerPage,"video_list.asp"
showContent
showpage totalput,MaxPerPage,"video_list.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move
(currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showpage totalput,MaxPerPage,"video_list.asp"
showContent
showpage totalput,MaxPerPage,"video_list.asp"
else
currentPage=1
showpage totalput,MaxPerPage,"video_list.asp"
showContent
showpage totalput,MaxPerPage,"video_list.asp"
end if
end if
rs.close
end if
set rs=nothing
conn.close
set conn=nothing
sub showContent
dim i
i=0
%>
<table width="700" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC">
<tr bgcolor="#EAEAEA">
<td width="45" height="25" align="center">ID</td>
<td width="78" align="center">产品图片</td>
<td width="220" align="center">产品名称</td>
<td width="100" align="center">编号</td>
<td width="100" align="center">发布时间</td>
<td width="80" align="center">排序</td>
<td colspan="3" align="center">操作</td>
</tr>
<%do while not rs.eof%>
<tr bgcolor="#FFFFFF">
<td width="45" height="23"><p align="center"><%=rs("ID")%></td>
<td width="78" align="center"> <a href="video_Edit.asp?id=<%=rs("ID")%>">
<%if lcase(left(Rs("pic"),4))="http" then%>
<img src="<%= Rs("pic")%>" border=0 height="60">
<%else%>
<img src="../ProductFile/<%= Rs("pic")%>" border="0"
height="60">
<%end if%>
</a></td>
<td width="220">
<a href="video_Edit.asp?id=<%=rs("ID")%>">
<%if rs("mpass")=true then response.Write("<font color=#ff0000>") end if%>
<%=rs("title")%>
<%if rs("mpass")=true then response.Write("</font>") end if%>
</a></td>
<td width="100"> <%= rs("ucode")%></td>
<td width="100"> <%= rs("issue")%></td>
<td width="80"><table width="99%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="22" align="right" valign="middle"><img src="images/up.gif" width="16" height="16"></td>
<td align="left" valign="middle"><a href="video_list.asp?action=des&midd=<%=rs("ID")%>&desid=<%=rs("desno")%>&as=up" target="_self">向上</a></td>
</tr>
<tr>
<td height="22" align="right" valign="middle"><img src="images/dom.gif" width="16" height="16"></td>
<td height="22" align="left" valign="middle"><a href="video_list.asp?action=des&midd=<%=rs("ID")%>&desid=<%=rs("desno")%>&as=dom" target="_self">向下</a></td>
</tr>
</table></td>
<td width="46" align="center"><a href="video_Edit.asp?id=<%=rs("ID")%>">修改</a></td>
<td width="47"><p align="center">
<input type='checkbox' name='selAnnounce' value='<%=cstr(rs("ID"))%>' style="border:0px">
</td>
</tr>
<%
i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop
%>
<tr bgcolor="#EAEAEA">
<td colspan="8" align="right" height="30">注:设置唯有会员能看的产品,名称将会显示红色以作区分.
<input name="button" type=button onClick="this.value=check(this.form.selAnnounce)" value=" 全 选 ">
<input name="submit" type='submit' class=buttonface value=' 删 除 '>
</td>
</tr>
</table>
<%
end sub
function showpage(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
response.write "<p align='center'> "
if CurrentPage<2 then
response.write "首页 上一页 "
else
response.write "<a href="&filename&"?ClassID="&ClassID&"&page=1>首页</a> "
response.write "<a href="&filename&"?ClassID="&ClassID&"&page="&CurrentPage-1&">上一页</a> "
end if
if n-currentpage<1 then
response.write "下一页 尾页"
else
response.write "<a href="&filename&"?ClassID="&ClassID&"&page="&(CurrentPage+1)&">"
response.write "下一页</a> <a href="&filename&"?ClassID="&ClassID&"&page="&n&">尾页</a>"
end if
response.write " 页次:<strong>"&CurrentPage&"/"&n&"</strong>页"
response.write " 共<b>"&totalnumber&"</b>篇文章 <b>"&maxperpage&"</b>篇文章/页"
end function
sub deleteannounce(id)
CheckAdmin1
if session("lg")="cn" then
sql="delete from video where ID="&cstr(id)
else
sql="delete from video_e where ID="&cstr(id)
end if
conn.execute sql
if err.Number<>0 then
err.clear
response.write "删 除 失 败 !<br>"
else
'response.write "操作成功!<br>"
end if
End sub
%>
</td>
</tr>
</form>
</table></td>
</tr>
</table>