<?xml version="1.0" encoding="utf-8"?><%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%> 

<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<% Response.ContentType="text/vnd.wap.wml;charset=utf-8" %>
<%
dim cid,key
key=request.QueryString("key")
if(key<>"") then
	key=replace(key,"'","")
	key=replace(key,"0x","")
end if
if(request.QueryString("cid")<>"") then
	cid=Clng(request.QueryString("cid"))
else
	cid=0
end if
%>
<wml>
<template >
        <do  type="prev" name="Prev" label="Prev" >
                <prev ></prev>
        </do>
</template>
<%
Function RemoveHTML(strHTML) 
	if(len(strHTML)<=0) then
		exit Function
	end if
	Dim objRegExp, Match, Matches 
	Set objRegExp = New Regexp 	
	objRegExp.IgnoreCase = True 
	objRegExp.Global = True 
	'取闭合的<> 
	objRegExp.Pattern = "<.+?>" 
	'进行匹配 
	if strHTML<>"" then
		Set Matches = objRegExp.Execute(strHTML)
		For Each Match in Matches 
			strHtml=Replace(strHTML,Match.Value,"") 
		Next 
		RemoveHTML=strHTML 
	else
		RemoveHTML=strHTML
	end if
	Set objRegExp = Nothing 
End Function
dim act,title,content,rs,id,currentpage,totalpage,totalnum
dim Price,City,ContactMan,QQ,Tel,PubDate,ExpireDate,PubIp,Hits,HomePage
const recpage=6
if(request.QueryString("page")<>"") then
	currentpage=Clng(request.QueryString("page"))
else 
	currentpage=1
end if
act=request.QueryString("act")
title="济南淘网"
content=""
if(act<>"" and act="show") then
	if(request.QueryString("id")<>"") then
	 id=Clng(request.QueryString("id"))
	else
		id=0
	end if
	if(id>0) then
		set rs=server.CreateObject("adodb.recordset") 
		rs.open "select title,content,Price,City,ContactMan,QQ,Tel,PubDate,ExpireDate,PubIp,Hits,HomePage from t_info where id="&id,conn,3,1
		if not rs.eof then
			title=rs(0)
			content=RemoveHTML(rs(1))
			Price=rs(2)
			City=rs(3)
			ContactMan=rs(4)
			QQ=rs(5)
			Tel=rs(6)
			PubDate=rs(7)
			ExpireDate=rs(8)
			PubIp=rs(9)
			Hits=rs(10)
			HomePage=rs(11)
		end if
		rs.close
		set rs=nothing
	end if
end if
%>
<card id="c1" title="<%=title%>" >
        <p align="center">
                济南淘网-最新分类信息
        </p>
        <p>
        信息搜索：<input name="key" type="text" maxlength="16" value="<%=key%>" />
        <anchor title="搜索">搜索
        <go href="index.asp" method="get">
        <postfield name="key" value="$key"/>
        </go>
        </anchor>
        </p>    
		<%
		
		if(act<>"" and act="show") then
			response.Write(title+"<br/>")			
			response.Write("<table align=""left"" title=""label"" columns=""2"">")
			response.Write("<tr>")
			response.Write("<td>发布日期：</td><td>"&PubDate&"</td>")
			response.Write("<td>联系人：</td><td>"&ContactMan&"</td>")
			response.Write("</tr>")
			response.Write("<tr>")
			response.Write("<td>QQ：</td><td>"&QQ&"</td>")
			response.Write("<td>联系电话：</td><td>"&Tel&"</td>")
			response.Write("</tr>")
			response.Write("</table>")
			content=replace(content,"&nbsp;","")
			response.Write(replace(content,"&nbsp"," "))
		else
			response.Write("<p>")
			set rs=server.CreateObject("adodb.recordset") 
			sql="select count(*) from t_info where IsCheck=1"
			if(key<>"") then
				sql=sql&" and title like '%"&key&"%'"
			end if
			rs.open sql,conn,3,1
			if(cid>0) then
				sql=sql&" and CatalogId="&cid
			end if
			totalnum=rs(0)
			rs.close
			set rs=nothing
			totalpage=int((totalnum+recpage-1)/recpage)
			set rs=server.CreateObject("adodb.recordset") 
			sql="select top "&recpage&" id,title from t_info where id <=(select min(id) from (select top "&(recpage*(currentpage-1)+1)&" id from t_info where IsCheck=1"
			if(cid>0) then
				sql=sql&" and CatalogId="&cid
			end if
			if(key<>"") then
				sql=sql&" and title like '%"&key&"%'"
			end if
			sql=sql&" order by id desc) as t)"
			if(cid>0) then
				sql=sql&" and CatalogId="&cid
			end if
			if(key<>"") then
				sql=sql&" and title like '%"&key&"%'"
			end if
			sql=sql&" and IsCheck=1 order by id desc "
			rs.open sql,conn,3,1			
			while not rs.eof
				response.Write("<a href=""index.asp?act=show&amp;id="&rs(0)&""">"&rs(1)&"</a><br/>"&Chr(10))
				rs.movenext
			wend		
			rs.close
			set rs=nothing
			response.Write("</p>")
			'page lists
				response.Write("<p>")
				dim n,p,startpage,endpage,j
				n=currentpage+1
				p=currentpage-1
				startpage=currentpage-5
				if(startpage<=0) then
					startpage=1
				end if
				endpage=currentpage+5
				if(endpage>totalpage) then
					endpage=totalpage
				end if
				response.write(" 共"&totalnum&"条 ")
				if p>0then
					response.write("["&"<a href='index.asp?key="&key&"&amp;cid="&cid&"&amp;page="&cstr(p)&"'>上一页</a>] ")
				else 
					response.write("上一页 ")
				end if 
				'''''''''''''''''
				for j=startpage to endpage
						if(j=currentpage) then
							response.write(j&" ")
						else
							response.write("<a href=""index.asp?key="&key&"&amp;cid="&cid&"&amp;page="&j&""">["&j&"]</a> ")
						end if
						if(j>(startPage+10)) then
							exit for
						end if
				next
				if (n-1)*recpage>=Clng(totalnum) then 
						response.write("下一页" )
				else
						response.Write("["&"<a href='index.asp?key="&key&"&amp;cid="&cid&"&amp;page="&cstr(n)&"'>下一页</a>]")
				end if
				response.Write("</p>")
		end if
		%>
    <p>
			|<a href="index.asp">淘网首页</a>
    </p>
</card>
</wml>
<%
call connclose()
%>