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

📄 search.asp

📁 教育管理系统
💻 ASP
字号:
<!--#include file="articleconn.asp"-->
<!--#include file="home1.asp"-->
<%
   dim rstype
   dim typesql
   dim typeid,typename,zhuid,zhuname
   zhuid=request("zhuid")
   zhuname=request("zhuname")
   typename=request("typename")
   if typename="" then
   typename="查询全部软件"
   end if
   if not isEmpty(request("typeid")) then
   typeid=request("typeid")
   else
   typeid=0
   end if
 set rstype=server.createobject("adodb.recordset")
  typesql="select * from type where zhuid="&zhuid&" and typeid="&typeid&""
 rstype.open typesql,conn,1,1
 rstype.close
'---------------------------search----------------------
name=trim(request("keyword"))
name=replace(name,"'","''")
if typeid=0 then
    sql="select * from learning where title Like '%"& name &"%' or title like title Like '%"& name &"%' or title Like '%"& name &"%'order by articleid desc"
else
   sql="select * from learning where (zhuid="&zhuid&") and (typeid="&typeid&") and (title Like '%"& name &"%' or title like title Like '%"& name &"%' or title Like '%"& name &"%') order by articleid desc"
end if   
set rs=conn.execute(sql)
if name="" then
   response.write"查找字符不能为空串,请重输入查找的信息<a href=""javascript:history.go(-1)"">返回重查</a>"
   response.end
 elseif rs.eof then
   response.write"没有你要查找的信息<a href=""javascript:history.go(-1)"">返回重查</a>"
   response.end
else   
  Set rs= Server.CreateObject("ADODB.Recordset")
  rs.open sql,conn,1,1
end if  
%>  <%
   MaxPerPage=rs1("duo")
   dim totalPut   
   dim CurrentPage
   dim TotalPages
   dim i,j
   if not isempty(request("page")) then
      currentPage=cint(request("page"))
   else
      currentPage=1
   end if
       set rst=server.CreateObject("ADODB.RecordSet") 
   %> 
<html>
<head>
<title>查找结果</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body marginwidth="0" leftmargin="0" bgcolor="#666666" topmargin="0" marginheight="0" >
<center>
  <table width="726" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td>
        <table width="696" border="0" cellspacing="0" cellpadding="0" background="IMAGES/cd.jpg" height="21" class="zbj">
          <tr> 
            <td width="407"><font class=3dfont>查询位置<img src="IMAGES/MORE.GIF" width="29" height="9"><a href="sort.asp?zhuid=<%=zhuid%>"><%=zhuname%></a><img src="IMAGES/MORE.GIF" width="29" height="9"><%=typename%></font> 
            </td>
          </tr>
        </table>
        <table width="95%" border="0" cellspacing="0" cellpadding="0" align="center">
          <tr> 
            <td> <%      
  if rs.eof and rs.bof then
       response.write "<p align='center'> 还 没 有 任 何 软 件</p>"
   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,"search.asp"
            showContent
            showpage1 totalput,MaxPerPage,"search.asp"
       else
          if (currentPage-1)*MaxPerPage<totalPut then
            rs.move  (currentPage-1)*MaxPerPage
            dim bookmark
            bookmark=rs.bookmark
           showpage totalput,MaxPerPage,"search.asp"
            showContent
             showpage1 totalput,MaxPerPage,"search.asp"
        else
	        currentPage=1
           showpage totalput,MaxPerPage,"search.asp"
           showContent
           showpage1 totalput,MaxPerPage,"search.asp"
	      end if
	   end if
   rs.close
   end if
	        
   set rs=nothing  
   conn.close
   set conn=nothing
   sub showContent
       dim i
	   i=0
          do while not rs.eof
%> 
              <table border="0" cellspacing="0" cellpadding="0" bgcolor="#000000" align="center" width="95%">
                <tr>
                  <td>
                    <table width="100%" border="0" cellspacing="1" cellpadding="0" align="center">
                      <tr> 
                        <td width="80" bgcolor="#333333"><font class="3dfont">软件名称:</font></td>
                        <td bgcolor="#666666"><font class=3dfont><a href="soft.asp?id=<%=rs("articleid")%>&typeid=<%=rs("typeid")%>&zhuid=<%=rs("zhuid")%>"><%=rs("title")%></a> 
                          <%if RS("dateandtime")>=date() then response.write("&nbsp;&nbsp;&nbsp;<image src=images/new.gif>")%> 
                          <%if RS("best") = true then response.write("&nbsp;&nbsp;&nbsp;<image src=images/tui.gif alt=站长推崇>")%> 
                          </font></td>
                      </tr>
                      <tr> 
                        <td width="80" bgcolor="#333333">软件简介:</td>
                        <td bgcolor="#666666"><%=cutstr(rs("content"),150)%></td>
                      </tr>
                    </table>
                  </td>
                </tr>
              </table>
              <br>
              <%i=i+1
	      if i>=MaxPerPage then exit do
	      rs.movenext
	   loop
   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 "<table border=""0"" cellspacing=""1"" width=""100%"">"
  response.write "<tr><td width=""38%"">"
  Response.Write "共有软件:<font face=""arial"" color=""red"">"&totalnumber&"</font>个 <font face=""arial"" color=""red"">"&CurrentPage&"/"&n&"</font>页</td>"
  response.write "<td width=""36%""><div align=""right"">"
  if CurrentPage<2 then
    response.write "<font color='999966'>首页 上一页</font>&nbsp;"
  else
    response.write "<a href="&filename&"?typeid="&typeid&"&zhuid="&zhuid&"&page=1&keyword="&name&"&typename="&typename&"&zhuname="&zhuname&">首页</a>&nbsp;"
    response.write "<a href="&filename&"?typeid="&typeid&"&zhuid="&zhuid&"&keyword="&name&"&page="&CurrentPage-1&"&typename="&typename&"&zhuname="&zhuname&">上一页</a>&nbsp;"
  end if
  if n-currentpage<1 then
    response.write "<font color='999966'>下一页 尾页</font>"
  else
       response.write "<a href="&filename&"?typeid="&typeid&"&zhuid="&zhuid&"&keyword="&name&"&typename="&typename&"&zhuname="&zhuname&"&page="&(CurrentPage+1)
    response.write ">下一页</a> <a href="&filename&"?typeid="&typeid&"&zhuid="&zhuid&"&page="&n&"&keyword="&name&"&typename="&typename&"&zhuname="&zhuname&">尾页</a>"
  end if
  Response.Write "</div></td></tr></table>"
end function 
function showpage1(totalnumber,maxperpage,filename)
  dim n
  if totalnumber mod maxperpage=0 then
     n= totalnumber \ maxperpage
  else
     n= totalnumber \ maxperpage+1
  end if
   Response.Write "<table border=""0"" cellspacing=""1"" width=""100%"">"
  response.write "<tr><td align=""left""><td width=""64%"">"
  gotopage
  response.write "<td width=""36%""><div align=""right"">"
  if CurrentPage<2 then
    response.write "<font color='999966'>首页 上一页</font>&nbsp;"
  else
    response.write "<a href="&filename&"?typeid="&typeid&"&zhuid="&zhuid&"&page=1&keyword="&name&"&typename="&typename&"&zhuname="&zhuname&">首页</a>&nbsp;"
    response.write "<a href="&filename&"?typeid="&typeid&"&zhuid="&zhuid&"&page="&CurrentPage-1&"keyword="&name&"&typename="&typename&"&zhuname="&zhuname&">上一页</a>&nbsp;"
  end if
  if n-currentpage<1 then
    response.write "<font color='999966'>下一页 尾页</font>"
  else
       response.write "<a href="&filename&"?typeid="&typeid&"&zhuid="&zhuid&"keyword="&name&"&page="&(CurrentPage+1)&typename="&typename&"&zhuname="&zhuname&"
    response.write ">下一页</a> <a href="&filename&"?typeid="&typeid&"&zhuid="&zhuid&"&page="&n&"keyword="&name&"&typename="&typename&"&zhuname="&zhuname&">尾页</a>"
  end if
  Response.Write "</div></td></tr></table>"
end function 
sub gotopage%> 
              <form action=<%response.write ""&filename&"?typeid="&typeid&"&zhuid="&zhuid&"&keyword="&name&"&typename="&typename&"&zhuname="&zhuname&""%> method="POST" id=form2 name=form2>
                转到 
                <input type="Text" name="page" value="<%if request("page")="" then%>1<%else%><%=request("page")%><%end if%>" size="1" maxlength="4" style="font-size:9pt;background-color:#666666;border-left: 1px solid #000000; border-right: 1px solid #000000; border-top: 1px solid #000000; border-bottom: 1px solid #000000">
                <input type="Image" src="images/go.gif" tppabs="" width="20" height="20" align="absmiddle" title="执行" id=Image1 name=Image1>
              </form>
              <%end sub
function showpage1(totalnumber,maxperpage,filename)
  dim n
  if totalnumber mod maxperpage=0 then
     n= totalnumber \ maxperpage
  else
     n= totalnumber \ maxperpage+1
  end if
  Response.Write "<table border=""0"" cellspacing=""1"" width=""100%"">"
  response.write "<tr><td align=""left""><td width=""64%"">"
  gotopage  
  response.write "<td width=""36%""><div align=""right"">"
  if CurrentPage<2 then
    response.write "<font color='999966'>首页 上一页</font>&nbsp;"
  else
    response.write "<a href="&filename&"?typeid="&typeid&"&zhuid="&zhuid&"&page=1&keyword="&name&"&typename="&typename&"&zhuname="&zhuname&">首页</a>&nbsp;"
    response.write "<a href="&filename&"?typeid="&typeid&"&zhuid="&zhuid&"&keyword="&name&"&page="&CurrentPage-1&"&typename="&typename&"&zhuname="&zhuname&">上一页</a>&nbsp;"
  end if
  if n-currentpage<1 then
    response.write "<font color='999966'>下一页 尾页</font>"
  else
       response.write "<a href="&filename&"?typeid="&typeid&"&zhuid="&zhuid&"&keyword="&name&"&typename="&typename&"&zhuname="&zhuname&"&page="&(CurrentPage+1)
    response.write ">下一页</a> <a href="&filename&"?typeid="&typeid&"&zhuid="&zhuid&"&page="&n&"&keyword="&name&"&typename="&typename&"&zhuname="&zhuname&">尾页</a>"
  end if
  Response.Write "</div></td></tr></table>"
end function 
 function showpage4(totalnumber,maxperpage,filename)
  dim n
  if totalnumber mod maxperpage=0 then
     n= totalnumber \ maxperpage
  else
     n= totalnumber \ maxperpage+1
  end if
  response.write "<form method=Post action="&filename&"?typeid="&typeid&"&typename="&typename&"&zhuname="&zhuname&"&keyword="&name&" id=form2 name=form2>"
  response.write "<p align='center'>&gt;&gt;分页&nbsp;"
  if CurrentPage<2 then
    response.write "<font color='999966'>首页 上一页</font>&nbsp;"
  else
    response.write "<a href="&filename&"?typeid="&typeid&"&zhuid="&zhuid&"&page=1&keyword="&name&"&typename="&typename&"&zhuname="&zhuname&">首页</a>&nbsp;"
    response.write "<a href="&filename&"?typeid="&typeid&"&zhuid="&zhuid&"&keyword="&name&"&page="&CurrentPage-1&"&typename="&typename&"&zhuname="&zhuname&">上一页</a>&nbsp;"
  end if
  if n-currentpage<1 then
    response.write "<font color='999966'>下一页 尾页</font>"
  else
       response.write "<a href="&filename&"?typeid="&typeid&"&zhuid="&zhuid&"&keyword="&name&"&typename="&typename&"&zhuname="&zhuname&"&page="&(CurrentPage+1)
    response.write ">下一页</a> <a href="&filename&"?typeid="&typeid&"&zhuid="&zhuid&"&page="&n&"&keyword="&name&"&typename="&typename&"&zhuname="&zhuname&">尾页</a>"
  end if
   response.write "&nbsp;页次:<strong><font color=red>"&CurrentPage&"</font>/"&n&"</strong>页 "
    response.write "&nbsp;共<b>"&totalnumber&"</b>个软件 <b>"&maxperpage&"</b>个软件/页 "
   response.write " 转到:<input type='text' name='page' size=4 maxlength=10 class=smallInput value="&currentpage&">"
   response.write "<input class=buttonface type='submit'  value=' 确定 '  name='cndok'></span></p></form>"
end function 
%> </td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
  </center>
</body> </html><%function cutstr(tempstr,tempwid) 
if len(tempstr)>tempwid then 
cutstr=left(tempstr,tempwid)&" ......" 
else 
cutstr=tempstr 
end if 
end function%>                

⌨️ 快捷键说明

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