📄 search.asp
字号:
<%PageName="search"%>
<!--#include file="conn.asp"-->
<!--#include file="const.asp"-->
<!--#include file="function.asp"-->
<!--#include file="INC\CHAR.INC"-->
<%
keyword=trim(request.form("keyword"))
keyword=replace(keyword,"'","''")
stype=request.form("stype")
if keyword="" then
errmsg="<li>查找字符不能为空串,请重输入查找的信息<a href=""javascript:history.go(-1)"">返回重查</a></li>"
call error()
response.end
end if
%>
<!--#include file="top.asp"-->
<table width="773" border="0" cellpadding="0" cellspacing="0" bordercolor="#111111" bgcolor="#30393D" style="border-collapse: collapse" align="center">
<tr>
<td width="5" valign="top" align="center">
<td align="center" colspan="2">
<table width="98%" align="center">
<tr>
<td>
<%
'---------------------------search----------------------
Set rs= Server.CreateObject("ADODB.Recordset")
if stype="music" then
sql="select * from Musiclist where MusicName Like '%"& keyword &"%' order by id desc"
elseif stype="Special" then
sql="select * from Special where Name Like '%"& keyword &"%' order by Specialid desc"
elseif stype="SpecialIntro" then
sql="select * from Special where Intro Like '%"& keyword &"%' order by Specialid desc"
elseif stype="User" then
sql="select * from user where username Like '%"& keyword &"%' order by id desc"
else
end if
rs.open sql,conn,1,1
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
if rs.eof and rs.bof then
if stype="music" then
response.write "<script language=javascript>alert('Sorry, 未 找 到 你 想 要 找 的 舞 曲!');history.back(1);</script>"
elseif stype="Special" then
response.write "<script language=javascript>alert('Sorry, 未 找 到 你 想 要 找 的 专 辑!');history.back(1);</script>"
elseif stype="SpecialIntro" then
response.write "<script language=javascript>alert('Sorry, 未 找 到 你 想 要 找 的 专 辑 简 介!');history.back(1);</script>"
elseif stype="User" then
response.write "<script language=javascript>alert('Sorry, 未 找 到 你 想 要 找 的 会 员!');history.back(1);</script>"
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>
<!-----------------------搜索舞曲----------------------------->
<%if stype="music" then%>
<div align="center">
<center>
<table border="1" width="100%" cellspacing="0" cellpadding="0" class="TableLine" style="border-collapse: collapse" bordercolor="2E5667">
<tr>
<td width="163" height=22 align=center bgcolor="2E5667" >舞曲名字</td>
<td width="101" height=22 align=center bgcolor="2E5667" >更新日期</td>
<td width="59" height=22 align=center bgcolor="2E5667" >点击</td>
<td width="77" height=22 align=center bgcolor="2E5667" >试听</td>
<td width="153" height=22 align=center bgcolor="2E5667" >所属专辑</td>
<td width="76" height=22 align=center bgcolor="2E5667" > </td>
<td width="72" height=22 align=center bgcolor="2E5667" >收藏</td>
</tr>
<%
i=0
do while not rs.eof
i=i+1
%>
<tr>
<td width="163"><%=i%>.<%=rs("musicname")%> </td>
<td align=center width="101"><%=rs("dateandtime")%> </td>
<td align=center width="59"><%=rs("hits")%> </td>
<td align=center width="77">
<%
musictype=rs("musictype")
if musictype=1 then
%>
<a href="javascript:open_window('songreal.asp?id=<%=rs("id")%>','Listen','width=280,height=360')">
<img src="images/playreal.gif" border="0" alt="试听 使用RealPlayer播放" ></a>
<%else if musictype=2 then%>
<a href="javascript:open_window('songmedia.asp?id=<%=rs("id")%>','Listen','width=280,height=360')">
<img src="images/playmedia.gif" border="0" alt="试听 使用MediaPlayer播放" ></a>
<%else if musictype=3 then%>
<a href="javascript:open_window('songflash.asp?id=<%=rs("id")%>','Listen','width=280,height=360')">
<img src="images/playflash.gif" border="0" alt="试听 使用Flash6.0播放" ></a>
<%end if%>
<%end if%>
<%end if%>
</td>
<td align=center width="153"><a href=showspecial.asp?specialid=<%=rs("specialid")%>><font color="#FFFFFF">查看所属专辑所有舞曲</font></a></td>
<td align=center width="76"> </td>
<td align=center width="72"><a href="UserCollect.asp?action=add&id=<%=rs("id")%>" target="Collect"><img src="images/heart.gif" border=0 alt="收藏"></a></td>
</tr>
<%
if i>=MaxPerPage then exit do
rs.movenext
loop
%>
</table>
</center>
</div>
<!-----------------------搜索专辑----------------------------->
<%elseif stype="Special" then%>
<div align="center">
<center>
<table border="1" width="100%" cellspacing="0" cellpadding="0" class="TableLine" style="border-collapse: collapse" bordercolor="#2E5667">
<tr>
<td width="30%" height=22 align=center bgcolor="#2E5667" >专辑</td>
<td width="17%" height=22 align=center bgcolor="#2E5667" >更新日期</td>
<td width="7%" height=22 align=center bgcolor="#2E5667" >收录歌曲</td>
<td width="9%" height=22 align=center bgcolor="#2E5667" >点击</td>
</tr>
<%
Set Trs= Server.CreateObject("ADODB.Recordset")
do while not rs.eof
i=i+1
Tsql="SELECT * FROM MusicList where Specialid="+cstr(rs("Specialid"))
Trs.open Tsql,conn,1,1
TotalMNum=Trs.recordcount
Trs.close
%>
<tr>
<td width="30%"><%=i%>.<a href="ShowSpecial.asp?specialid=<%=rs("Specialid")%>"><%=rs("Name")%></a></td>
<td width="17%" align=center><%=DateValue(rs("dateandtime"))%> </td>
<td width="7%" align=center><%=TotalMNum%> </td>
<td width="9%" align=center><%=rs("Hits")%> </td>
</tr>
<%
if i>=MaxPerPage then exit do
rs.movenext
loop
Set Trs=nothing
%>
</table>
</center>
</div>
<!-----------------------搜索专辑简介----------------------------->
<%elseif stype="SpecialIntro" then%>
<div align="center">
<center>
<table border="1" width="100%" cellspacing="0" cellpadding="0" class="TableLine" style="border-collapse: collapse" bordercolor="#2E5667">
<tr>
<td width="30%" height=22 align=center bgcolor="#2E5667" >专辑</td>
<td width="17%" height=22 align=center bgcolor="#2E5667" >更新日期</td>
<td width="7%" height=22 align=center bgcolor="#2E5667" >收录歌曲</td>
<td width="9%" height=22 align=center bgcolor="#2E5667" >点击</td>
</tr>
<%
Set Trs= Server.CreateObject("ADODB.Recordset")
do while not rs.eof
i=i+1
Tsql="SELECT * FROM MusicList where Specialid="+cstr(rs("Specialid"))
Trs.open Tsql,conn,1,1
TotalMNum=Trs.recordcount
Trs.close
%>
<tr>
<td width="30%"><%=i%>.<a href="ShowSpecial.asp?specialid=<%=rs("Specialid")%>"><%=rs("Name")%></a></td>
<td width="17%" align=center><%=DateValue(rs("dateandtime"))%> </td>
<td width="7%" align=center><%=TotalMNum%> </td>
<td width="9%" align=center><%=rs("Hits")%> </td>
</tr>
<tr>
<td colspan=7>部分简介:<br>
<%if Len(rs("Intro"))<=200 then%>
<%=rs("Intro")%>
<%else%>
<%=Left(rs("Intro"),200)%>...
<%end if%>
</td>
</tr>
<%
if i>=MaxPerPage then exit do
rs.movenext
loop
set Trs=nothing
%>
</table>
</center>
</div>
<!-----------------------搜索会员----------------------------->
<%elseif stype="User" then%>
<div align="center">
<center>
<table border="1" width="100%" cellspacing="0" cellpadding="0" class="TableLine" style="border-collapse: collapse" bordercolor="#2E5667">
<tr>
<td width="10%" height=22 align=center bgcolor="#2E5667" >ID</td>
<td width="20%" height=22 align=center bgcolor="#2E5667" >会员</td>
<td width="10%" height=22 align=center bgcolor="#2E5667" >性别</td>
<td width="30%" height=22 align=center bgcolor="#2E5667" >信箱</td>
<td width="20%" height=22 align=center bgcolor="#2E5667" >主页</td>
<td width="10%" height=22 align=center bgcolor="#2E5667" >OICQ</td>
</tr>
<%
i=0
do while not rs.eof
i=i+1
%>
<tr>
<td align=center>
<%'=rs("id")%>
<%=totalPut-(i+MaxPerPage*(currentpage-1)-1)%> </td>
<td align=center><a style=cursor:hand title="会员详细资料: 试听:<%=rs("Listens")%> 点歌:<%=rs("SMusics")%> 登陆:<%=rs("logins")%> 个人说明: <%if rs("sign")="" or isnull(rs("sign")) then%>无<%else%><%=htmlencode1(rs("sign"))%><%end if%>"><font color="ffffff"><%=rs("UserName")%></font>
</a></td>
<td align=center>
<%if rs("sex")=1 then%>
男
<%else%>
<font color="<%=AlertFColor%>">女</font>
<%end if%>
</td>
<td align=center><%=rs("Email")%> </td>
<td align=center><a href="<%=rs("UserWebUrl")%>"><%=rs("UserWebName")%></a> </td>
<td align=center><%=rs("oicq")%> </td>
</tr>
<%
if i>=MaxPerPage then exit do
rs.movenext
loop
%>
</table>
</center>
</div>
<%end if%>
<%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
%>
<form method=Post action="<%=filename%>?keyword=<%=keyword%>&stype=<%=stype%>">
<center>
<p>共找到<font color="<%=AlertFColor%>"><b><%=totalnumber%></b></font>项记录
<%if CurrentPage<2 then%>
首页 上一页
<%else%>
 <a href="<%=filename%>?page=1&keyword=<%=keyword%>&stype=<%=stype%>"><font color="#FFFFFF">首页</font></a>
<a href="<%=filename%>?page=<%=CurrentPage-1%>&keyword=<%=keyword%>&stype=<%=stype%>"><font color="#FFFFFF">上一页</font></a>
<%
end if
if n-currentpage<1 then
%>
下一页 末页
<%else%>
<a href="<%=filename%>?page=<%=CurrentPage+1%>&keyword=<%=keyword%>&stype=<%=stype%>"><font color="#FFFFFF">下一页</font></a>
<a href="<%=filename%>?page=<%=n%>&keyword=<%=keyword%>&stype=<%=stype%>"><font color="#FFFFFF">末页</font></a>
<%end if%>
页次:<strong><font color="<%=AlertFColor%>"><%=CurrentPage%>/<%=n%></font></strong>页
转到:
<select name="page" size="1" onChange="javascript:submit()">
<%for i = 1 to n%>
<option value="<%=i%>" <%if cint(CurrentPage)=cint(i) then%> selected <%end if%>>第<%=i%>页</option>
<%next%>
</select>
</p>
</center>
</form>
<center>
<%
end function
function Search
%>
<%end function%>
</center>
</td>
</tr>
</table>
</td>
</tr>
</table>
<tr>
<td valign="top" align="center" colspan="3" height="17">
</tr>
</table>
<div align="center">
<!--#include file="friendsite.asp"-->
</div>
<br>
<%
set rs=nothing
conn.close
set conn=nothing
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -