<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../Include/conn.asp" -->
<!--#include file="../Include/ConnDatabase.asp" -->
<!--#include file="../Include/NoHackSql.Asp" -->
<%
'=====================================
'天天企业网站管理系统  TianTianCMS
'天天网络科技工作室版权所有
'官方网站http://www.ip126.com
'技术支持论坛 http://bbs.ip126.com/
'QQ:530051328 mail:bbfhq@163.com
'=====================================
%>
<%call SiteInfo
headid=3
Dim Menutitle,so
If request("Range")="TianTianCMS_Products" Then
Menutitle="Product Class"
so="Products"
ElseIf request("Range")="TianTianCMS_Article" Then 
Menutitle="News Class"
so="News"
ElseIf request("Range")="TianTianCMS_Services" Then 
Menutitle="Services Class"
so="Services"
ElseIf request("Range")="TianTianCMS_Download" Then 
Menutitle="DownLoad Class"
so="DownLoad"
ElseIf request("Range")="TianTianCMS_video" Then 
Menutitle="video Class"
so="video"
Else 
Menutitle="Others Class"
so="Others"
End if
datafrom=request("Range")
%>
<!--#include file="Head.Asp" -->

<TABLE width="960" border=0 align="center" cellPadding=0 cellSpacing=0 bgcolor="#FFFFFF">
  <TR>
    <TD height="5"></TD>
  </TR>
  <TR> 
    <TD height="172" ><table width="960" height="100%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr> 
          <td class="tdbg_left"  width="190" height="179" valign="top" > <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td height="34" class="title_left">&nbsp;&nbsp;&nbsp;<img src="../images/smallbook.jpg" width="10" height="10">&nbsp;&nbsp;User Login 
                </td>
              </tr>
              <tr> 
                <td height="5"></td>
              </tr>
              <tr> 
                <td height="10"><table width="88%" border="0" align="center" cellpadding="0" cellspacing="0">
                    <tr> 
                      <td> 
                       
	<iframe src="login.asp"  frameborder="0" border="0px" scrolling="no" class="frame" height="120px" width="160px"></iframe>
                      </td>
                    </tr>
                  </table></td>
              </tr>
              <tr> 
                <td height="5"></td>
              </tr>
            </table>
            <table width="100%" border="0" cellpadding="0" cellspacing="0">
              <tr> 
                <td height="34" class="title_left">&nbsp;&nbsp;&nbsp;<img src="../images/smallbook.jpg" width="10" height="10">&nbsp;&nbsp;<%=Menutitle%></td>
              </tr>
		<tr>
		<td>
 			<%call CallFolderView()%>
			</td>
			</tr>

            </table></td>
          <td width="6"></td>
          <td valign="top"><table Class=border width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
              <tr> 
                <td height="206" valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td class="
title_right" height="32">&nbsp;&nbsp;&nbsp;<img src="../images/smallbook.jpg" width="10" height="10">&nbsp;<%=so%> Search</td>
                    </tr>
			<TR> 
              <TD    
                  height=1> 
 <table width="100%" height="19" border="0" align="center" cellpadding="0" cellspacing="0">
                  <tr> 
                            <td width="80%" height="18" bgcolor="#eeeeee"><%=WebLocation()%></td>
                        <td width="79%" bgcolor="#eeeeee">&nbsp; </td>
                  </tr>
                  <tr> 
                    <td height="1" colspan="2" bgcolor="#999999"></td>
                  </tr>
                </table>
                <table width="100%" border="0" align="center" cellpadding="0" cellspacing="3" bgcolor="#FBFEFF">
                  <tr> 
                    <td height="8"></td>
                  </tr>
                 
                  <tr> 
               <td>
			
	<%=WebContent(trim(request("Keyword")),request("Range"))%>

			</td>
                  </tr>             
                  <tr> 
                    <td height="8"><div align="right"></div></td>
                  </tr>
                </table> 
                      </TD>
            </TR>
                  </table>
                  
                </td>
              </tr>
			  
            </table></td>
        </tr>
      </table></td>
  </tr>
</table>
<!--#include file="Foot.Asp"-->
<%
'调用显示节点------------------------------
Function CallFolderView()
%>
<% if request("Range")="TianTianCMS_Products" Then%>
<%=ProductCategory(0) %>
<%ElseIf request("Range")="TianTianCMS_Article" Then%>
<%call CallFolderViewNews()%>
<%ElseIf request("Range")="TianTianCMS_Services" Then %>
<%call FolderViewServices()%>
<%ElseIf request("Range")="TianTianCMS_video" Then %>
<%call FolderViewvideo()%>
<%ElseIf request("Range")="TianTianCMS_Download" Then%>
<%=WebMenuDown(0,0,2)%>
<%
End if
End Function




function WebLocation()'搜索结果列表===================================
WebLocation="&nbsp;<a href=""index.asp"">Home</a>&gt;&gt;"&VbCrLf

  if request("Range")="Void" then
	WebLocation=WebLocation&"<center>Error</center>"
    exit Function
  elseif trim(request("Keyword")) ="" Then
    WebLocation=WebLocation&"<font color=""red"">keyword not value </font>"
  elseif request("Range")="TianTianCMS_Products" Then
    WebLocation=WebLocation&"Product - Keyword[<font color=""red"">"&trim(request("Keyword"))&"</font>]"
  elseif request("Range")="TianTianCMS_Article" Then
    WebLocation=WebLocation&"News - Keyword[<font color=""red"">"&trim(request("Keyword"))&"</font>]"
  elseif request("Range")="TianTianCMS_Download" Then
  elseif request("Range")="TianTianCMS_video" Then
    WebLocation=WebLocation&"video - Keyword[<font color=""red"">"&trim(request("Keyword"))&"</font>]"
    WebLocation=WebLocation&"Product - Keyword[<font color=""red"">"&trim(request("Keyword"))&"</font>]"
  elseif request("Range")="TianTianCMS_Services" Then
    WebLocation=WebLocation&"Services - Keyword[<font color=""red"">"&trim(request("Keyword"))&"</font>]"
  end if
end Function

function WebContent(Keyword,Range)
  if Range="Void" then
	 response.write "<center>Erroe</center>"
     exit function
  end if
  dim idCount
  dim pages
      pages=12
  dim pagec
  dim page
      page=clng(request("Page"))
  dim pagenc
      pagenc=5
  dim pagenmax
  dim pagenmin
  dim pageprevious
  dim pagenext
  dim datafrom
  dim datawhere
  	  select case Range'定义搜索数据库
	  case "TianTianCMS_Products"
        datafrom="TianTianCMS_Products"
        datawhere="where ViewFlag"&Language&" and ProductName"&Language&" like '%"&KeyWord&"%'"
	  case "TianTianCMS_Article"
        datafrom="TianTianCMS_Article"
        datawhere="where ViewFlag"&Language&" and NewsName"&Language&" like '%"&KeyWord&"%'"
	  case "TianTianCMS_Download"
        datafrom="TianTianCMS_Download"
        datawhere="where ViewFlag"&Language&" and DownName"&Language&" like '%"&KeyWord&"%'"
	  case "TianTianCMS_video"
        datafrom="TianTianCMS_video"
        datawhere="where ViewFlag"&Language&" and videoName"&Language&" like '%"&KeyWord&"%'"
	  case "TianTianCMS_Services"
        datafrom="TianTianCMS_Services"
        datawhere="where ViewFlag"&Language&" and OthersName"&Language&" like '%"&KeyWord&"%'"
      end select
  dim sqlid
  dim Myself,PATH_INFO,QUERY_STRING
      PATH_INFO = request.servervariables("PATH_INFO")
	  QUERY_STRING = request.ServerVariables("QUERY_STRING")'
      if QUERY_STRING = "" then
	    Myself = PATH_INFO & "?"
	  elseif Instr(PATH_INFO & "?" & QUERY_STRING,"Page=")=0 then
	    Myself= PATH_INFO & "?" & QUERY_STRING & "&"
	  else
	    Myself = Left(PATH_INFO & "?" & QUERY_STRING,Instr(PATH_INFO & "?" & QUERY_STRING,"Page=")-1)
	  end if
  dim taxis
      taxis="order by id desc "
  dim i
  dim rs,sql
  set rs = server.createobject("adodb.recordset")
  sql="select count(ID) as idCount from ["& datafrom &"]" & datawhere
  set rs=server.createobject("adodb.recordset")
  rs.open sql,conn,0,1
  idCount=rs("idCount")
  if(idcount>0) then
    if(idcount mod pages=0)then
	  pagec=int(idcount/pages)
   	else
      pagec=int(idcount/pages)+1
    end if
    sql="select id from ["& datafrom &"] " & datawhere & taxis
    set rs=server.createobject("adodb.recordset")
    rs.open sql,conn,1,1
    rs.pagesize = pages
    if page < 1 then page = 1
    if page > pagec then page = pagec
    if pagec > 0 then rs.absolutepage = page
    for i=1 to rs.pagesize
	  if rs.eof then exit for
	  if(i=1)then
	    sqlid=rs("id")
	  else
	    sqlid=sqlid &","&rs("id")
	  end if
	  rs.movenext
    next
  end if
  if(idcount>0 and sqlid<>"") Then
    sql="select * from ["& datafrom &"] where id in("& sqlid &") "&taxis
    set rs=server.createobject("adodb.recordset")
    rs.open sql,conn,0,1
	Response.Write "<table width=""98%"" border=""0"" cellspacing=""0"" cellpadding=""0"">"&VbCrLf
	Response.Write "  <tr height=""32"">"&VbCrLf
	Response.Write "    <td width=""550"" style=""color:#000000; font-weight:bold; background:url(Images/split.gif) no-repeat right center; background-color:#ececec"">&nbsp;&nbsp;&nbsp;&nbsp;Title</td>"&VbCrLf
	Response.Write "    <td align=""center"" bgcolor=""#ececec"" style=""color:#000000; font-weight:bold"">Content</td>"&VbCrLf
	Response.Write "  </tr>"&VbCrLf
    while not rs.eof
  	  select case Range
	  case "TianTianCMS_Products"
  	If ISHTML = 1 Then
		AutoLink = "html/"&ProName&""&Separated&""&rs("ID")&"."&HTMLName&""
	Else
		AutoLink = "ProductShow.asp?ID="&rs("ID")&""
	End If
		Response.Write "  <tr height=""28"">"&VbCrLf
		Response.Write "    <td style=""background:url(Images/bg2.gif) repeat-x left bottom;"">&nbsp;<img src=""../images/arrow_6.gif"" width=""11"" height=""11"" align=""absmiddle"" />&nbsp;&nbsp;<a href="""&AutoLink&""" target=""_blank"">"&Replace(rs("ProductName"&Language&""),Keyword,"<font color=#FF0000>" & Keyword & "</font>") &"</a></td>"&VbCrLf
		Response.Write "    <td align=""center"" style=""background:url(Images/bg2.gif) repeat-x left bottom; color:#999999"">"&FormatDate(rs("UpdateTime"),13)&"</td>"&VbCrLf
		Response.Write "  </tr>"&VbCrLf
	  case "TianTianCMS_Article"
  	If ISHTML = 1 Then
		AutoLink = "html/"&NewName&""&Separated&""&rs("ID")&"."&HTMLName&""
	Else
		AutoLink = "ArticleShow.asp?SortID="&rs("ID")&""
	End If
		Response.Write "  <tr height=""28"">"&VbCrLf
		Response.Write "    <td style=""background:url(Images/bg2.gif) repeat-x left bottom;"">&nbsp;<img src=""../images/arrow_6.gif"" width=""11"" height=""14"" align=""absmiddle"" />&nbsp;&nbsp;<a href="""&AutoLink&""" target=""_blank"">"&Replace(rs("NewsName"&Language&""),Keyword,"<font color=#FF0000>" & Keyword & "</font>")&"</a></td>"&VbCrLf
		Response.Write "    <td align=""center"" style=""background:url(Images/bg2.gif) repeat-x left bottom; color:#999999"">"&FormatDate(rs("Addtime"),13)&"</td>"&VbCrLf
		Response.Write "  </tr>"&VbCrLf
	  case "TianTianCMS_Download"
 	If ISHTML = 1 Then
		AutoLink = "html/"&DownName&""&Separated&""&rs("ID")&"."&HTMLName&""
	Else
		AutoLink = "DownShow.asp?ID="&rs("ID")&""
	End If
		Response.Write "  <tr height=""28"">"&VbCrLf
		Response.Write "    <td style=""background:url(Images/bg2.gif) repeat-x left bottom;"">&nbsp;<img src=""../images/arrow_6.gif"" width=""11"" height=""14"" align=""absmiddle"" />&nbsp;&nbsp;<a href="""&AutoLink&""" target=""_blank"">"&Replace(rs("DownName"&Language&""),Keyword,"<font color=#FF0000>" & Keyword & "</font>")&"</a>("&rs("FileSize")&")</td>"&VbCrLf
		Response.Write "    <td align=""center"" style=""background:url(Images/bg2.gif) repeat-x left bottom; color:#999999"">"&FormatDate(rs("Updatetime"),13)&"</td>"&VbCrLf
		Response.Write "  </tr>"&VbCrLf
	  case "TianTianCMS_Services"
  	If ISHTML = 1 Then
		AutoLink = "html/"&OtherName&""&Separated&""&rs("ID")&"."&HTMLName&""
	Else
		AutoLink = "ServicesShow.asp?ID="&rs("ID")&""
	End If
		Response.Write "  <tr height=""28"">"&VbCrLf
		Response.Write "    <td style=""background:url(Images/bg2.gif) repeat-x left bottom;"">&nbsp;<img src=""../images/arrow_6.gif"" width=""11"" height=""14"" align=""absmiddle"" />&nbsp;&nbsp;<a href="""&AutoLink&""" target=""_blank"">"&Replace(rs("OthersName"&Language&""),Keyword,"<font color=#FF0000>" & Keyword & "</font>")&"</a></td>"&VbCrLf
		Response.Write "    <td align=""center"" style=""background:url(Images/bg2.gif) repeat-x left bottom; color:#999999"">"&FormatDate(rs("UpdateTime"),13)&"</td>"&VbCrLf
		Response.Write "  </tr>"&VbCrLf
      end select
	  rs.movenext
    wend
	Response.Write "</table>"&VbCrLf
  else
    response.write "<center>No relevant information</center>"
	exit function
  end If
  Response.Write "<table width=""98%"" border=""0"" cellspacing=""0"" cellpadding=""0"">"&VbCrLf
  Response.Write "  <tr height=""35"">"&VbCrLf
  Response.Write "    <td align=""center"">"&VbCrLf
  Response.Write "Total:<strong style=""color:red"">"&idcount&"</strong>Records&nbsp;&nbsp;Page:<strong style=""color:red"">"&page&"</strong>/"&pagec&" PageSize:<strong style=""color:red"">"&pages&"</strong>Records" & vbCrLf
  pagenmin=page-pagenc
  pagenmax=page+pagenc
  if(pagenmin<1) then pagenmin=1
  if(page>1) then response.write ("<a href="""& myself &"Page=1"" title=""Return to page 1""><font face=""webdings"" color=""#000000"">9</font></a> ")
  if page-(pagenc*2+1)<=0 then
	pageprevious=1
  else
	pageprevious=page-(pagenc*2+1)
  end if
  if(pagenmin>1) then response.write ("<a href="""& myself &"Page="& pageprevious &""" title=""Page "& pageprevious &"""><font face=""webdings"" color=""#000000"">3</font></a> ")
  if(pagenmax>pagec) then pagenmax=pagec
  for i = pagenmin to pagenmax
	if(i=page) then
	  response.write ("&nbsp;<strong style=""color:red"">"& i &"</strong>&nbsp;")
	else
	  response.write ("[<a href="""& myself &"Page="& i &""">"& i &"</a>]")
	end if
  next
  if page+(pagenc*2+1)>=pagec then
    pagenext=pagec
  else
    pagenext=page+(pagenc*2+1)
  end if
  if(pagenmax<pagec) then response.write (" <a href="""& myself &"Page="& pagenext &""" title=""Go to page"&pagenext&"""><font face=""webdings"" color=""#999999"">:</font></a> ")
  if(page<pagec) then response.write (" <a href="""& myself &"Page="& pagec &""" title=""Go to page"&pagec&"""><font face=""webdings"" color=""#000000"">:</font></a>")
  Response.Write "    </td>"&VbCrLf
  Response.Write "  </tr>"&VbCrLf
  Response.Write "</table>"&VbCrLf
  rs.close
  set rs=nothing
end function
%>