📄 usersearch.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"-->
<div align="center">
<center>
<tablewidth="773" height="90" border="0" cellpadding="0" cellspacing="0" bgcolor="#30393D" id="AutoNumber1" style="border-collapse: collapse">
<tr>
<td width="5"> </td>
<td width="741" height="211">
<div align="center">
<center>
<table width="100%" cellspacing="0" style="border-collapse: collapse" cellpadding="0">
<tr>
<td>
<%
'---------------------------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="100%" cellspacing="0" cellpadding="0" style="border-collapse: collapse" bordercolor="#0D5777">
<td bgcolor="#0D5777" 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"><a href=userinf.asp?id=<%=rs("id")%> target=_blank><%=rs("UserName")%></a>
<%if DateValue(rs("addDate"))=date() then%>
<img src="images/new.gif">
<%end if%>
<BR>
<a href="javascript:open_window('messager.asp?action=new&touser=<%=rs("UserName")%>','messanger','width=420,height=290')"><font color="#FF0000">
给</font>
<%=rs("UserName")%> <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%> 首页 上一页
<%else%> <a href="<%=filename%>?page=1&keyword=<%=keyword%>&stype=<%=stype%>">首页</a>
<a href="<%=filename%>?page=<%=CurrentPage-1%>&keyword=<%=keyword%>&stype=<%=stype%>">
上一页</a>
<%
end if
if n-currentpage<1 then
%> 下一页 末页
<%else%>
<a href="<%=filename%>?page=<%=CurrentPage+1%>&keyword=<%=keyword%>&stype=<%=stype%>">
下一页</a>
<a href="<%=filename%>?page=<%=n%>&keyword=<%=keyword%>&stype=<%=stype%>">
末页</a>
<%end if%> 页次:<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>
</form>
<%
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="搜索">
</td>
</tr>
</form>
</td>
</tr>
</table>
</table>
</center>
</div></td>
<td width="5"> </td>
</tr>
<tr>
<td width="750" height="1" colspan="3"> </td>
</tr>
</table>
</center>
</div>
<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 + -