<!--#include file="conn.asp"-->
<!--#include file="inc/const.asp"-->
<!--#include file="inc/cls_keyword.asp"-->
<%
Response.ContentType="text/html"
Response.Expires = -9999
Response.AddHeader "pragma", "no-cache"
Response.AddHeader "cache-ctrol", "no-cache"
%>
<h2><span>与您的提问相关的已解决问题（看看是否能解答您的疑问）</span></h2>
<ul>
<%
Dim XMLDom
Dim searchmode,Keyword
searchmode = 0
Keyword = Trim(Request("q"))
If Len(Keyword) < 2 Then Keyword = Trim(Request("word"))
If Len(Keyword) < 2 Then Keyword = ""
If Keyword = "请输入关键字" Then Keyword = ""

showmain()
NewAsp.CloseConn()

Sub showmain()
	Dim Rs,SQL,FoundSQL,topiclist,node
	Dim FindSolved,SolvedQuestion
	Dim KeywordArray,KeywordLike,i,n
	FindSolved = 0
	Set XMLDom = NewAsp.CreateXMLDoc("msxml2.FreeThreadedDOMDocument"& MsxmlVersion)
	XMLDom.appendChild(XMLDom.createElement("xml"))
	FoundSQL = ""
	If searchmode = 0 Then
		KeywordArray = ws.ParseKeyword(Keyword)
		n = 0
		For i = 0 To UBound(KeywordArray)
			If Len(KeywordArray(i)) > 1 Then
				If n = 0 Then
					If IsSqlDataBase=1 Then
						FoundSQL = "title like '%"&KeywordArray(i)&"%'"
					Else
						FoundSQL = "InStr(1,LCase(Title),LCase('"&KeywordArray(i)&"'),0)>0"
					End If
				Else
					If IsSqlDataBase=1 Then
						FoundSQL = FoundSQL & " Or title like '%"&KeywordArray(i)&"%'"
					Else
						FoundSQL = FoundSQL & " Or InStr(1,LCase(Title),LCase('"&KeywordArray(i)&"'),0)>0"
					End If
				End If
				n = n + 1
			End If
		Next
		If n = 0 Then
			FoundSQL = ""
		End If
	Else
		If ws.CheckKeyword(Keyword) Then
			If IsSqlDataBase=1 Then
				FoundSQL = "title like '%"&Keyword&"%'"
			Else
				FoundSQL = "InStr(1,LCase(Title),LCase('"&Keyword&"'),0)>0"
			End If
		Else
			FoundSQL = ""
		End If
	End If
	If Len(FoundSQL) > 10 Then
		FoundSQL = "And ("&FoundSQL&")"
		SQL="SELECT TOP 10 TopicID,classid,userid,classname,title,PostUsername,Expired,Closed,PostTable,DateAndTime,LastPostTime,LockTopic,Reward,TopicMode FROM NC_Ask_Topic WHERE TopicMode=1 And LockTopic=0 " & FoundSQL & " ORDER BY LastPostTime DESC"
		Set Rs = Newasp.Execute(SQL)
		If Not Rs.EOF Then
			SQL=Rs.GetRows(-1)
			Set topiclist=NewAsp.ArrayToxml(SQL,Rs,"row","topic")
			FindSolved = 1
		Else
			Set topiclist=Nothing
			FindSolved = 0
		End If
		Rs.Close : Set Rs=Nothing
		SQL=Empty
		SolvedQuestion = ""
		If Not topiclist Is Nothing Then
			For Each Node in topiclist.documentElement.SelectNodes("row")
				SolvedQuestion = SolvedQuestion & "<li>"
				SolvedQuestion = SolvedQuestion & "<a href=""question.asp?topicid=" & Node.selectSingleNode("@topicid").text & """ target=""_blank"">" & NewAsp.HTMLEncode(Node.selectSingleNode("@title").text) & "</a> - "
				SolvedQuestion = SolvedQuestion & Node.selectSingleNode("@dateandtime").text
				SolvedQuestion = SolvedQuestion & "</li>" & vbCrLf
			Next
		End If
		Set topiclist=Nothing
		Set XMLDom=Nothing
	Else
		FindSolved = 0
	End If
	Response.Write SolvedQuestion
End Sub
%>
</ul>