⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usersearch.asp

📁 疯狂DJ联盟-v2.0 1.修改了V1.0的几个错误. 2.首页生成HTM 大大加快了访问速度 3.歌曲播放页面全部调用HTM播放器.减轻了服务器的负担. 4.增加了站内统计,全部访问次数
💻 ASP
字号:
<%PageName="usersearch"%>
<!--#include file="conn.asp"-->
<!--#include file="const.asp"-->

<%
keyword=trim(request.form("keyword"))
keyword=replace(keyword,"'","''")
stype=request.form("stype")
if keyword="" then
	response.write "<script language=javascript>alert('查找字符不能为空,请重新输入查找的信息,按确定返回重查!!!');history.back(1);</script>"
	response.end
end if
%>
<!--#include file="top.asp"-->
<table width="773" height="90" border="0" cellpadding="0" cellspacing="0" bgcolor="#30393D" id="AutoNumber1" style="border-collapse: collapse" align="center">
      <tr>
      <td width="5">&nbsp;      </td>
        <td  height="211">  
          <%
'---------------------------search----------------------
Set rs= Server.CreateObject("ADODB.Recordset")
if stype="username" then
	sql="select * from user where username Like '%"& keyword &"%' order by id desc"
	atype="用户名"
elseif stype="truename" then 
	sql="select * from user where truename Like '%"& keyword &"%' order by id desc"
	atype="真实姓名"
elseif stype="email" then
	sql="select * from user where email Like '%"& keyword &"%' order by id desc"
	atype="电子邮件"
elseif stype="oicq" then
	sql="select * from User where oicq Like '%"& keyword &"%' order by id desc"
	atype="OICQ是"
elseif stype="Address" then
    sql="select * from User where Address Like '%"& keyword &"%' order by id desc"
    atype="所在地区"
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
response.write "<script language=javascript>alert('未找到"&atype&"是"&keyword&"任何会员!');history.back(1);</script>"
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="1" width="98%" cellspacing="0" cellpadding="0" style="border-collapse: collapse" bordercolor="#0D5777" align="center">
              <td align="center" bordercolor="#0D5777"> 
                <table border="1" width="100%" cellspacing="0" cellpadding="0" class="TableLine" bordercolorlight="<%=MainBColor%>" bgcolor="#000000" style="border-collapse: collapse" bordercolor="#093D53">
                <tr bgcolor="#FFB400"> 
                  <td width="66" height=21 align=center bgcolor="#0D5777">ID</td>
                  <td width="135" height=21 align=center bgcolor="#0D5777">会员</td>
                  <td width="66" height=21 align=center bgcolor="#0D5777">性别</td>
                  <td width="135" height=21 align=center bgcolor="#0D5777">信箱</td>
                  <td width="129" height=21 align=center bgcolor="#0D5777">主页</td>
                  <td width="94" height=21 align=center bgcolor="#0D5777">OICQ</td>
                  <td width="47" height=21 align=center bgcolor="#0D5777">资料</td>
                </tr>
                <%
i=0
do while not rs.eof
	i=i+1
%>
                <tr bgcolor="#FFFFFF"> 
                  <td align=center width="66" bgcolor="#171A1C"> 
                    <%'=rs("id")%>
                    <%=totalPut-(i+MaxPerPage*(currentpage-1)-1)%> </td>
                  <td align=center width="135" bgcolor="#171A1C"><br>
                    <a href="javascript:open_window('messager.asp?action=new&touser=<%=rs("UserName")%>','messanger','width=420,height=290')"><font color="#FF0000"> 
                    给</font> <font color="ffffff"><%=rs("UserName")%></font> <font color="#FF0000"></font><font color="#FF0000">发短消息</font></a> 
                  </td>
                  <td align=center width="66" bgcolor="#171A1C"> 
                    <%if rs("sex")=1 then%>
                    <%else%>
                    <font color="<%=AlertFColor%>">女</font> 
                    <%end if%>
                  </td>
                  <td align=center width="135" bgcolor="#171A1C"><%=rs("Email")%> </td>
                  <td align=center width="129" bgcolor="#171A1C"><a href="<%=rs("UserWebUrl")%>" target="_blank"><%=rs("UserWebName")%></a> </td>
                  <td align=center width="94" bgcolor="#171A1C"><%=rs("oicq")%> </td>
                  <td align=center width="47" bgcolor="#171A1C"> 
                    <input title="查看用户的祥细资料" style="border:0px solid #1A8CFF; FONT-SIZE: 12px; COLOR: #828F9B; BACKGROUND-COLOR: #171A1C; TEXT-DECORATION: underline" type=button name="Look" value="查看" onClick="javascript:open_window('userinf.asp?id=<%=rs("id")%>','UserInfo','width=500,height=480')">
                  </td>
                </tr>
                <%
	if i>=MaxPerPage then exit do
rs.movenext
loop
%>
              </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
%>
              <form method=Post action="<%=filename%>?keyword=<%=keyword%>&stype=<%=stype%>">
                <center>
                  共找到<font color="red"><b><%=totalnumber%></b></font>项记录 
                  <%if CurrentPage<2 then%>
                  &nbsp;首页 上一页&nbsp; 
                  <%else%>
                  &nbsp;<a href="<%=filename%>?page=1&keyword=<%=keyword%>&stype=<%=stype%>"><font color="#FFFFFF">首页</font></a>&nbsp; 
                  <a href="<%=filename%>?page=<%=CurrentPage-1%>&keyword=<%=keyword%>&stype=<%=stype%>"> 
                  <font color="#FFFFFF">上一页</font></a>&nbsp; 
                  <%
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%>
                  &nbsp;页次:<strong><font color="red"><%=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>
                  <br>
                </center>
              </form>
              <center>
                <%        
end function
function Search
%>
                <%end function%>
                <form name=form1 method=post action=usersearch.asp>
                  搜索: 
                  <select name="stype" size="1">
                    <option value="username" selected>注 册 名</option>
                    <option value="truename">真实姓名</option>
                    <option value="email">电子信箱</option>
                    <option value="oicq">OICQ</option>
                    <option value="Address">所在地区</option>
                  </select>
                  <input size=10 type="text" value="输入关键字" onClick="Javascript:this.value=''" onFocus=this.select() onMouseOver=this.focus() name=keyword maxlength="30">
                  <input type="submit" align="absmiddle" width="20" height="20" title="查询" id=Image1 name=Image1 value="搜索">
                  </form>
              </center>
            </td>
            </tr>
          </table>
      </table>

<!--#include file="friendsite.asp"-->

     <%
set rs=nothing
conn.close
set conn=nothing
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -