网站后台里搜索的问题!
<!--#include file="const.asp"-->
<%PageName="search"%>
<%on error resume next%>
<%CheckAdmin1%>
<!--#include file="../User/path.asp"-->
<%
keyword=trim(request("keyword"))
keyword=replace(keyword,"'","''")
stype=request("stype")
if keyword="" then
errmsg=errmsg+"查找字符不能为空,请重输入查找的信息<a href=""javascript:history.go(-1)"">返回重查</a>"
call error()
Response.End
end if
%>
<!--#include file="Top.Asp"-->
<link href="Images/Admin_Style.Css" rel="stylesheet" type="text/css">
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="100%" valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="100%" height="19" align=center valign="bottom">
<b>...::: 搜 索 结 果 :::...</b></td>
<td width="0%" bgcolor="#FFB5D2"></td>
</tr>
<tr>
<td width="100%" colspan="2">
<%
'---------------------------search----------------------
Set rs= Server.CreateObject("ADODB.Recordset")
if stype="Singer" then
sql="select * from Nclass"
elseif stype="Music" then
sql="select * from Musiclist"
elseif stype="Special" then
sql="select * from Special"
elseif stype="User" then
sql="select * from User"
else
end if
rs.open sql,conn,1,1
if stype="Singer" then
rs.filter = "Nclass Like '%"& keyword &"%'"
end if
if stype="Music" then
rs.filter = "MusicName like '%"&keyword&"%'"
end if
if stype="Special" then
rs.filter = "Name Like '%"& keyword &"%'"
end if
if stype="user" then
rs.filter = "UserName like '%"& keyword &"%'"
end if
rs.open sql,conn,1,1
if not isempty(request.QueryString("page")) then
currentPage=cint(request.QueryString("page"))
else
currentPage=1
end if
if rs.eof and rs.bof then
if stype="Singer" then
response.write "<p align='center'><br><br>Sorry, 未 找 到 你 想 要 的 演 员<br><br><a href=""javascript:history.go(-1)"">点 此 返 回</a><br><br></p>"
elseif stype="Music" then
response.write "<p align='center'><br><br>Sorry, 未 找 到 你 想 要 的 唱 段<br><br><a href=""javascript:history.go(-1)"">点 此 返 回</a><br><br></p>"
elseif stype="Special" then
response.write "<p align='center'><br><br>Sorry, 未 找 到 你 想 要 的 专 辑<br><br><a href=""javascript:history.go(-1)"">点 此 返 回</a><br><br></p>"
elseif stype="User" then
response.write "<p align='center'><br><br>Sorry, 未 找 到 你 想 找 的 用 户<br><br><a href=""javascript:history.go(-1)"">点 此 返 回</a><br><br></p>"
end if
else
totalPut=rs.recordcount
MaxPerPage=10
PageUrl="Search.asp"
if currentpage<1 then currentpage=1
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,PageUrl
showContent
showpage totalput,MaxPerPage,PageUrl
search
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showpage totalput,MaxPerPage,PageUrl
showContent
showpage totalput,MaxPerPage,PageUrl
search
else
currentPage=1
showpage totalput,MaxPerPage,PageUrl
showContent
showpage totalput,MaxPerPage,PageUrl
search
end if
end if
rs.close
end if
sub showContent
i=0
%>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<td><div align="center">
<!-----------------------搜索演员----------------------------->
<%if stype="Singer" then%>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
<tr class="title">
<td width="45%" height=22 align=center>演员</td>
<td width="20%" height=22 align=center>修改</td>
<td width="20%" height=22 align=center>生成HTM</td>
<td width="15%" height=22 align=center>删除</td>
</tr>
<%
Set Trs= Server.CreateObject("ADODB.Recordset")
do while not rs.eof
i=i+1
Tsql="SELECT * FROM MusicList where Nclassid="+cstr(rs("Nclassid"))
Trs.open Tsql,conn,1,1
TotalMNum=Trs.recordcount
Trs.close
Tsql="SELECT * FROM Special where Nclassid="+cstr(rs("Nclassid"))
Trs.open Tsql,conn,1,1
TotalSNum=Trs.recordcount
Trs.close
Tsql="SELECT * FROM Nclass where Nclassid="+cstr(rs("Nclassid"))
Trs.open Tsql,conn,1,1
Trs.close
%>
<form method="POST" action="Admin_Nclass_Err.Asp?act=rename&NClassid=<%=rs("NClassid")%>" id=Nform<%=k%> name=Nform<%=k%>>
<tr>
<td class=tdbg> <%=i%>. <a href="Admin_Allspecial.Asp?Classid=<%=rs("Classid")%>&SClassid=<%=rs("SClassid")%>&NClassid=<%=rs("NClassid")%>"><%=rs("Nclass")%></a></td>
<td class=tdbg align=center><a href="Admin_Nclass_Add.Asp?nclassid=<%=rs("NClassid")%>">修改演员资料</a>
<td class=tdbg align=center><a title="生成 <%=rs("nclass")%> 专辑列表文件" href="make_special.asp?263=<%=rs("nclassid")%>"><font color=blue>生成HTM</font></a></td>
<td class=tdbg align=center><a title="慎重! 删除后可是不能恢复了哦!" href='Admin_Nclass_Err.Asp?act=del&NClassid=<%=rs("NClassID")%>'>删除</a></td>
</tr>
</form>
<%
if i>=MaxPerPage then exit do
rs.movenext
loop
set Trs=nothing
%>
</table>
<!-----------------------搜索唱段----------------------------->
<%elseif stype="Music" then%>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
<tr class="title">
<td width="40%" height=22 align=center>唱段名字</td>
<td width="24%" height=22 align=center>所属演员</td>
<td width="6%" height=22 align=center>唱词</td>
<td width="9%" height=22 align=center>推荐</td>
<td width="9%" height=22 align=center>修改</td>
<td width="9%" height=22 align=center>删除</td>
</tr>
<%do while not rs.eof%>
<tr>
<td class=tdbg width="40%"> <%=(i+1)%>.<%=rs("MusicName")%></td>
<td class=tdbg width="24%" align=center><%=rs("singer")%> <a href="Admin_Allspecial_Edit.Asp?Classid=<%=rs("Classid")%>&SClassid=<%=rs("SClassid")%>&NClassid=<%=rs("NClassid")%>&specialid=<%=rs("specialid")%>">[进入添加唱段]</a></td>
<td class=tdbg width="6%" align=center><a href="Admin_Word_Edit.Asp?id=<%=rs("id")%>">唱词</a></td>
<td class=tdbg width="9%" align=center><a href="Admin_Allmusic_Err2.Asp?act=SetIsGood&id=<%=rs("id")%>&classid=<%=classid%>&SClassid=<%=SClassid%>&Nclassid=<%=Nclassid%>&page=<%=CurrentPage%>"><%if rs("IsGood")=true then%><font color=red>撤销</font><%else%>推荐<%end if%></a></td>
<td class=tdbg width="9%" align=center><a href="Admin_Allmusic_Ok.Asp?id=<%=rs("id")%>&AskClassid=<%=classid%>&AskNClassid=<%=Nclassid%>&page=<%=CurrentPage%>">修改</a></td>
<td class=tdbg width="9%" align=center><a href="Admin_Allmusic_Data.Asp?id=<%=rs("id")%>&classid=<%=classid%>&SClassid=<%=SClassid%>&Nclassid=<%=Nclassid%>&page=<%=CurrentPage%>">删除</a></td>
</tr>
<%
i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop
%>
</table>