<!--#include file=gdibn.inc-->
<%
Server.ScriptTimeOut=120
dim id
on error resume next 
	page=request("page")
	if page="" then
	page=1
	url="http://www.skycn.com/search.php?ss_name="&request.form("ss_name")&"&sor="&request("sor")
	else
	offset=20*(page-1)
	url="http://www.skycn.com/search.php?offset="&offset&"&ss_name="&request.form("ss_name")&"&sor="&request("sor")
	end if
	searchcode=getHTTPPage(url)
	if err.number=0 then
	start=Instr(searchcode,"找到</b>：")+7
	over=Instr(searchcode,"<b>显示")
	totalnum=mid(searchcode,start,over-start)
	start=Instr(searchcode,"	共")+1
	over=Instr(searchcode,"页 |")
	totalpage=mid(searchcode,start,over-start)
	totalpage=replace(totalpage,"共","")
	start=Instr(searchcode,"</font></td></tr><tr><td align=left>")+17
	over=Instr(searchcode,"</td></tr></td></tr></table>        </td></tr>")
	listcode=mid(searchcode,start,over-start)
	listarr=split(listcode,"<tr><td align=left>")
	for i=1 to ubound(listarr)
	over=Instr(listarr(i),"<tr><td bgcolor=#FFCC00 colspan=4>")
	softlistcode=mid(listarr(i),1,over-1)
	softlistcode=replace(softlistcode,"soft/","soft.asp?id=")
	softlistcode=replace(softlistcode,"article/","article.asp?id=")
	softlistcode=replace(softlistcode,".html","")
	start=Instr(softlistcode,"[<a")+1
	over=Instr(softlistcode,"</a>]<br>")+4
	typecode=mid(softlistcode,start,over-start)
	typestr=right(typecode,15)
	typea=left(typestr,4)
	softlistcode=replace(softlistcode,typecode,typea)
	softcode=softcode&"<tr bgcolor=#F5F5F5><td align=left><img src='images/aer.gif' align='absmiddle'>"&softlistcode
	next
	Erase softlistarr
	else 
		wscript.echo err.description 
	end if
	myCache.makeEmpty()
	set myCache=nothing
%>

<TITLE> 成都169信息港 - 软件搜索</TITLE>
<!--#include file="head.asp"-->
<TABLE width=776 border=0 align="center" cellPadding=3 cellSpacing=0 
borderColorLight=#000000 borderColorDark=#ffffff>
  <TBODY>
    <TR align=middle bgColor=#e6ebf0>
      <TD height="100" align="center" vAlign=top bgcolor="#e6ebf0"><TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
          <TBODY>
            <TR>
              <TD height="25">&nbsp;您现在的位置是：下载特区-&gt; 搜索结果-&gt; 关键词  --<%=request.form("ss_name")%></TD>
            </TR>
          </TBODY>
        </TABLE>
          <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
            <TBODY>
              <TR>
                <TD width="52%" height="29"><table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" height="29">
                    <form name="form1" method="post" action="search.asp">
                      <tr>
                        <td width="17%" height="29"><div align="right" class="style1">
                            <div align="center">搜索软件</div>
                        </div></td>
                        <td width="42%"><input name="ss_name" type="text" size="21" maxlength="40" value=<%=request.form("ss_name")%>>
                        </td>
                        <td width="21%"><select name="sor" >
                            <option value="00" >全部软件</option>
                            <option value="01">国产软件</option>
                            <option value="02">国外软件</option>
                            <option value="03">汉化补丁</option>
                            <option value="wz" >软件资讯</option>
                        </select></td>
                        <td width="20%"><input type="submit" name="Submit" value=" 搜 索 "></td>
                      </tr>
                    </form>
                </table></TD>
                <TD width="48%">　</TD>
              </TR>
            </TBODY>
          </TABLE>
          <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
            <tr>
              <td height="28" background="images/toolbar_bg.gif"><div align="center"><b><font color="#FF0000">软 件 列 表</font></b></div></td>
            </tr>
          </table>
          <TABLE class=bodyad cellSpacing=0 cellPadding=0 width=100% align=center border=0>
            <TBODY>
              <TR>
                <TD height=1 colspan="2" bgColor=#CCCCCC></TD>
              </TR>
              <TR>
                <TD height=21 align="center" valign="top" bgColor=#f6f6f6><table width="100%" border="0" cellpadding="0" cellspacing="1" class=4b bgcolor="#CCCCCC">
                    <tr>
                      <td width="61%" height="23" bgcolor="#F5F5F5"><div align="center">软件名称</div></td>
                      <td width="13%" height="23" align="center" bgcolor="#F5F5F5">整理日期</td>
                      <td width="12%" height="23" align="center" bgcolor="#F5F5F5">人气</td>
                      <td width="14%" height="23" align="center" bgcolor="#F5F5F5">软件大小</td>
                    </tr>
                    <%=softcode%>
                    <tr bgcolor="#FCFCFC">
                      <td colspan="5"><table width="100%">
                          <tr>
                            <td>共搜索到：<b><%=totalnum%></b> 条记录 页次：<b><%=page%></b>/<b><%=totalpage%></b>页 每页<b>20</b></td>
                            <td align="right">分页：
                                <select name="select" onChange='javascript:window.open(this.options[this.selectedIndex].value,"_top")'>
                                  <%

for i=1 to totalpage
if request("page")=i then
response.write "<option value='?page="&i&"&ss_name="&request.form("ss_name")&"&sor="&request("sor")&"' selected>第"&i&"页</option>"
else
response.write "<option value='?page="&i&"&ss_name="&request.form("ss_name")&"&sor="&request("sor")&"' >第"&i&"页</option>"
end if
next

%>
                                </select>
                            </td>
                          </tr>
                      </table></td>
                    </tr>
                </table></TD>
              </TR>
            </TBODY>
        </TABLE></TD>
    </TR>
  </TBODY>
</TABLE>
<!--#include file="foot.asp"-->
</BODY>
</HTML>
<%
	  function getHTTPPage(url) 
		on error resume next 
		dim http 
		set http=Server.createobject("Microsoft.XMLHTTP") 
		Http.open "GET",url,false 
		Http.send() 
		if Http.readystate<>4 then
			exit function 
		end if 
		getHTTPPage=bytes2BSTR(Http.responseBody) 
		set http=nothing
		if err.number<>0 then err.Clear  
	end function 
	Function bytes2BSTR(vIn) 
		dim strReturn 
		dim i1,ThisCharCode,NextCharCode 
		strReturn = "" 
		For i1 = 1 To LenB(vIn) 
			ThisCharCode = AscB(MidB(vIn,i1,1)) 
			If ThisCharCode < &H80 Then 
				strReturn = strReturn & Chr(ThisCharCode) 
			Else 
				NextCharCode = AscB(MidB(vIn,i1+1,1)) 
				strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode)) 
				i1 = i1 + 1 
			End If 
		Next 
		bytes2BSTR = strReturn 
	End Function 
%>
