Jump to content


Photo

Codigo De Busca Não Reconheçe Acentos


  • Faça o login para participar
Nenhuma resposta neste tópico

#1 Maxwell

Maxwell

    Turista

  • Usuários
  • 33 posts
  • Sexo:Masculino
  • Localidade:Guarulhos/SP

Posted 20/06/2010, 00:08

Pessoal vocês se lembram do codigo asp Surf-net? è um codigo antigo disponibilizado na net de forum em asp. Estou usando em meu site, mas verifiquei que o sistema de busca não considera Acentos, sendo que se eu buscar uma palavra com acento ele me resulta zero resultado, mesmo que existe um topico com a palavra.

Acredito que seja algo facil de adaptar no codigo de resposta da busca. Ficarei grato se alguem puder me ajudar.

Segue o codigo da pagina de resposta da busca:


<% Option Explicit %>
<!--#include file="common.inc" -->
<%

'Dimension variables
Dim rsTopicDetails		'Holds the Recordset for the Topic Count
Dim rsTopic			'Holds the Recordset for the Topic details
Dim rsForum			'Holds the Recordset for the Forum details
Dim rsThread			'Holds the Recordset for the Thread details
Dim rsAuthor			'Holds the Recordset for the Author details
Dim rsForumJump			'Holds the recordset for the forum
Dim strSQLResultsQuery		'Holds the query built for the search
Dim intForumID			'Holds the forum ID number
Dim strForumName		'Holds the forum name
Dim strSearchKeywords		'Holds the keywords to search for
Dim sarySearchWord		'Array to hold the search words
Dim strSearchIn			'Holds where the serach is to be done
Dim lngNumberOfReplies		'Holds the number of replies for a topic
Dim lngTopicID			'Holds the topic ID
Dim strSubject			'Holds the topic subject
Dim strTopicStartUsername 	'Holds the username of the user who started the topic
Dim lngTopicStartUserID		'Holds the users Id number for the user who started the topic
Dim lngNumberOfViews		'Holds the number of views a topic has had
Dim strLastEntryUsername	'Holds the username of the last person to post a message in a topic
Dim lngLastEntryUserID		'Holds the user's ID number of the last person to post a meassge in a topic
Dim dtmLastEntryDate		'Holds the date the last person made a post in the topic
Dim intRecordPositionPageNum	'Holds the recorset page number to show the topics for
Dim intTotalNumOfPages		'Holds the total number of pages in the recordset
Dim intRecordLoopCounter	'Holds the loop counter numeber
Dim intLinkPageNum		'Holss the page number to link to
Dim strJumpForumName		'Holds the name of the forum to jump to
Dim lngJumpForumID		'Holds the forum id to jump to
Dim blnReturnedSearchResults	'Set to true if there are search results returned



'Initialise variables
blnReturnedSearchResults = True



'Read in the search criteria
strSearchKeywords = Server.HTMLEncode(Trim(Request.QueryString("search")))	
strSearchIn = Request.QueryString("searchIn")
intForumID = CInt(Request.QueryString("Forum"))

'Split up the keywords to be searched
sarySearchWord = Split(Trim(strSearchKeywords), " ")



'If there is no keywords to search for then redirect to the forum homepage
'If strSearchKeywords = "" Then Response.Redirect "default.asp"


'If this is the first time the page is displayed then the Forum Topic record position is set to page 1
If Request.QueryString("SearchPagePosition") = 0 Then
	intRecordPositionPageNum = 1

'Else the page has been displayed before so the Forum Topic record postion is set to the Record Position number
Else
	intRecordPositionPageNum = CInt(Request.QueryString("SearchPagePosition"))
End If	



'Initalise the Results Query string with the select part of the query
strSQLResultsQuery = "SELECT tblTopic.Topic_ID, tblTopic.No_of_views, tblTopic.Subject FROM tblTopic WHERE "


'If the user has selected to search the TOPICS and any words or all words then build the next part of the Results Query with the where cluase 
If (Request.QueryString("searchMode") = "anywords" OR Request.QueryString("searchMode") = "allwords") AND Request.QueryString("searchIn") = "Topic" Then 	

	'Call the function to build the query
	strSQLResultsQuery = strSQLResultsQuery & BuildSQL ("tblTopic.Subject", sarySearchWord)

End If

'If the user has selected to search TOPIC and phrase then build the next part of the Results Query with the where cluase 
If Request.QueryString("searchMode") = "phrase" AND Request.QueryString("searchIn") = "Topic" Then
	
	strSQLResultsQuery = strSQLResultsQuery & "tblTopic.Subject LIKE '%" & strSearchKeywords & "%'"
End If



'If the user has selected to search in the message body then build the Where Clause of the Reseults Query with the Topics containg threads with the search words
If Request.QueryString("searchIn") = "Thread"  Then

	'Create a recordset to search the message body
	Set rsThread = Server.CreateObject("ADODB.Recordset")
	
	'Initialise the sql query to get the with a select statment to get the topic ID
	strSQL = "SELECT tblThread.Topic_ID FROM tblThread INNER JOIN tblTopic ON tblThread.Topic_ID = tblTopic.Topic_ID WHERE "
	
	'If the user has selected all or any words then build the where clause with the words to be searched
	If Request.QueryString("searchMode") = "anywords" OR Request.QueryString("searchMode") = "allwords" Then 	
	
		'Call the function to build the query
		strSQL = strSQL & BuildSQL ("tblThread.Message", sarySearchWord)
	
	'Else the user has choosen to only search for a message containg the phrase
	Else
		strSQL = strSQL & "tblThread.Message LIKE '%" & strSearchKeywords & "%'"
	
	End If
	
	'If the user has selected to search a certain forum then intitilaise the SQL query to search only that forum
	strSQL = strSQL & " AND tblTopic.Forum_ID =" & intForumID
	
	'Set the cursor type property of the record set to dynamic so we can naviagate through the record set
	rsThread.CursorType = 3
	
	'Set the cursor lovcation to client side so we can use get AbsolutePosition of the record in the recordset
	rsThread.CursorLocation = 3
	
	'Query the database
	rsThread.Open strSQL, strCon
		
	
	'Build the Where Clause of the Reseults Query
	strSQLResultsQuery = strSQLResultsQuery & "("
	
	'If no results are returned then set the Results Query to look for nothing
	If rsThread.EOF Then strSQLResultsQuery = strSQLResultsQuery & "tblTopic.Topic_ID = 0 "
	
	'Loop through the Topic ID's returned by the recordset to build the Results Query
	Do while NOT rsThread.EOF
	
		'If this is the 2nd time through or more stick an OR between the diffrent Topic ID's
		If rsThread.AbsolutePosition > 1 Then strSQLResultsQuery = strSQLResultsQuery & " OR "
		
		'Place the topic ID containing the word searched for into the Results Query
		strSQLResultsQuery = strSQLResultsQuery & "tblTopic.Topic_ID = " & CLng(rsThread("Topic_ID"))
		
		'Move to the next recordset
		rsThread.MoveNext
	Loop

	'Stick bracket on the end of the Results Query
	strSQLResultsQuery = strSQLResultsQuery & ")"
End If



'If the user has selected to search in the message body then build the Where Clause of the Reseults Query with the Topics containg threads written by the author
If Request.QueryString("searchIn") = "Author" Then

	'Create a recordset to get the forum details
	Set rsAuthor = Server.CreateObject("ADODB.Recordset")
	
	
	'Initalise the strSQL variable with an SQL statement to query the database
	strSQL = "SELECT tblAuthor.Author_ID, tblThread.Topic_ID FROM tblAuthor INNER JOIN tblThread ON tblThread.Author_ID = tblAuthor.Author_ID WHERE "		
	strSQL = strSQL & "tblAuthor.Username = '" & strSearchKeywords & "'"	
	
	'Set the cursor type property of the record set to dynamic so we can naviagate through the record set
	rsAuthor.CursorType = 3
	
	'Set the cursor lovcation to client side so we can use get AbsolutePosition of the record in the recordset
	rsAuthor.CursorLocation = 3
	
	'Query the database
	rsAuthor.Open strSQL, strCon
	
	
	'Build the Where Clause of the Reseults Query
	strSQLResultsQuery = strSQLResultsQuery & "("
	
	'If no results are returned then set the Results Query to look for nothing
	If rsAuthor.EOF Then strSQLResultsQuery = strSQLResultsQuery & "tblTopic.Topic_ID = 0 "
	
	'Loop through the Topic ID's returned by the recordset to build the Results Query
	Do while NOT rsAuthor.EOF
	
		'If this is the 2nd time through or more stick an OR between the diffrent Topic ID's
		If rsAuthor.AbsolutePosition > 1 Then strSQLResultsQuery = strSQLResultsQuery & " OR "
		
		'Place the topic ID containing the author searched for into the Results Query
		strSQLResultsQuery = strSQLResultsQuery & "tblTopic.Topic_ID = " & CLng(rsAuthor("Topic_ID"))
		
		'Move to the next record in the recordset
		rsAuthor.MoveNext
	Loop

	'Stick bracket on the end of the Results Query
	strSQLResultsQuery = strSQLResultsQuery & ")"
End If


'If the user has selected to search a certain forum then build the Results Query to only look in that forum
strSQLResultsQuery = strSQLResultsQuery & " AND tblTopic.Forum_ID =" & intForumID

'Tell the Results Query what order to place the results in
If Request.QueryString("searchSort") = "topic" Then 
	strSQLResultsQuery = strSQLResultsQuery & " ORDER BY tblTopic.Subject ASC;"
ElseIf Request.QueryString("searchSort") = "views" Then 
	strSQLResultsQuery = strSQLResultsQuery & " ORDER BY tblTopic.No_of_views DESC;"
ElseIf Request.QueryString("searchSort") = "dateASC" Then 
	strSQLResultsQuery = strSQLResultsQuery & " ORDER BY tblTopic.Last_entry_date ASC;"
Else
	strSQLResultsQuery = strSQLResultsQuery & " ORDER BY tblTopic.Last_entry_date DESC;"
End If

%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Discussion Forum Search Results</title>

<!-- The Surf-Net Forum is written and produced by Bruce Corkhill ©2001
     	If you want your own Forum then goto http://www.surf-net.co.uk -->

     	
<script  language="JavaScript">
<!-- Hide from older browsers...

//Function to jump to another forum
function ForumJump(URL) {
	
	if (URL.selectedIndex != "") self.location.href = URL.options[URL.selectedIndex].value;
	
	return true;
}
// -->
</script>
    	
</head>
<body bgcolor="<% = strBgColour %>" text="<% = strTextColour %>" link="<% = strLinkColour %>" vlink="<% = strVisitedLinkColour %>" alink="<% = strActiveLinkColour %>">
<h1 align="center">Discussion Forum Search Results</h1>
<table width="98%" border="0" cellspacing="0" cellpadding="1" align="center" bgcolor="<% = strTableBorderColour %>">
  <tr>
    <td>
      <table width="100%" border="0" cellspacing="0" cellpadding="1" align="center" bgcolor="<% = strTableTitleColour %>">
        <tr> 
          <%
'If the user has logged in then the Logged In User ID number will be more than 0
If NOT lngLoggedInUserID = 0 Then
	
	'Dispaly a welcome message to the user in the top bar
	Response.Write vbCrLf & "<td>Welcome " &  strLoggedInUsername & "&nbsp;&nbsp;&nbsp;<a href=""profile_edit.asp?ReturnPage=Search&search=" & Request.QueryString("search") & "&searchMode=" & Request.QueryString("searchMode") & "&searchIn=" & Request.QueryString("searchIn") & "&forum=" & Request.QueryString("forum") & "&searchSort=" & Request.QueryString("searchSort") & "&SearchPagePosition=" & intRecordPositionPageNum & """ target=""_self""><img src=""forum_images/edit_profile.gif"" width=""100"" height=""24"" border=""0"" align=""absmiddle"" alt=""Edit Profile""></a></td>"

'Else the user is not logged
Else
    	'Display a welcome guset message with the option to login or register
    	Response.Write vbCrLf & "<td>Welcome Guest &nbsp;&nbsp;&nbsp;<a href=""register_form.asp?ReturnPage=Search&search=" & Request.QueryString("search") & "&searchMode=" & Request.QueryString("searchMode") & "&searchIn=" & Request.QueryString("searchIn") & "&forum=" & Request.QueryString("forum") & "&searchSort=" & Request.QueryString("searchSort") & "&SearchPagePosition=" & intRecordPositionPageNum & """ target=""_self""><img src=""forum_images/register.gif"" width=""81"" height=""24"" alt=""Register"" border=""0"" align=""absmiddle""></a>&nbsp;&nbsp;<a href=""login_user.asp?ReturnPage=Search&search=" & Request.QueryString("search") & "&searchMode=" & Request.QueryString("searchMode") & "&searchIn=" & Request.QueryString("searchIn") & "&forum=" & Request.QueryString("forum") & "&searchSort=" & Request.QueryString("searchSort") & "&SearchPagePosition=" & intRecordPositionPageNum & """ target=""_self""><img src=""forum_images/login.gif"" width=""81"" height=""24"" alt=""Login"" border=""0"" align=""absmiddle""></a></td>"
End If
%>
          <td align="right"><a href="search_form.asp?ReturnPage=Search&SearchPagePosition=<% = intRecordPositionPageNum %>&search=<% = Request.QueryString("search") %>&searchMode=<% = Request.QueryString("searchMode") %>&searchIn=<% = Request.QueryString("searchIn") %>&forum=<% = Request.QueryString("forum") %>&searchSort=<% = Request.QueryString("searchSort") %>" target="_self"><img src="forum_images/search.gif" width="81" height="24" align="absmiddle" border="0" alt="Search the Forum"></a>&nbsp;&nbsp;<a href="forum_members.asp?ReturnPage=Search&SearchPagePosition=<% = intRecordPositionPageNum %>&search=<% = Request.QueryString("search") %>&searchMode=<% = Request.QueryString("searchMode") %>&searchIn=<% = Request.QueryString("searchIn") %>&forum=<% = Request.QueryString("forum") %>&searchSort=<% = Request.QueryString("searchSort") %>" target="_self"><img src="forum_images/members_list.gif" width="100" height="24" border="0" align="absmiddle"></a></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<br>
<table width="525" border="0" cellspacing="0" cellpadding="1" align="center">
  <tr> 
    <td align="left" width="712"><img src="forum_images/folder_icon.gif" width="15" height="15" border="0" align="bottom">&nbsp;<a href="default.asp" target="_self">All 
      Forums</a><br>
      <img src="forum_images/folder_line.gif" width="20" height="20">&nbsp;<img src="forum_images/folder_icon.gif" width="15" height="15" border="0" align="bottom"> 
      <%
      
'Create a recordset to get the forum details
Set rsForum = Server.CreateObject("ADODB.Recordset")

'Read in the forum name from the database
'Initalise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT tblForum.Forum_name FROM tblForum WHERE Forum_ID = " & intForumID

'Query the database
rsForum.Open strSQL, strCon


'Check there are forum's to display
If rsForum.EOF Then

	'If there are no forum's to display then display the appropriate error message
	Response.Write vbCrLf & "There are no Forum's to display"

'Else there the are forum's to write the HTML to display it the forum names and a discription
Else 
			
	'Read in forum details from the database
	strForumName = rsForum("Forum_name")
		
		
	'Write the HTML of the forum descriptions as hyperlinks to the forums
	Response.Write vbCrLf & "<a href=""display_forum_topics.asp?ForumID=" & intForumID & """ target=""_self"">" & strForumName & "</a>"		

%>
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="forum_images/folder_line.gif" width="20" height="20"> 
      <img src="forum_images/open_folder_icon.gif" width="15" height="15"> <a href="search.asp?SearchPagePosition=<% = intRecordPositionPageNum %>&search=<% = Request.QueryString("search") %>&searchMode=<% = Request.QueryString("searchMode") %>&searchIn=<% = Request.QueryString("searchIn") %>&forum=<% = Request.QueryString("forum") %>&searchSort=<% = Request.QueryString("searchSort") %>&ReturnPage=Search" target="_self">Forum 
      Search Results</a> 
      <%
End If
%>
    </td>
  </tr>
</table>
<br>
<table width="98%" border="0" cellspacing="0" cellpadding="1" align="center" bgcolor="<% = strTableBorderColour %>">
  <tr> 
    <td> 
      <table width="100%" border="0" cellspacing="0" cellpadding="1" align="center" bgcolor="<% = strTableTitleColour %>">
        <tr> 
          <td width="50%">&nbsp;</td>
          <td align="right" width="50%""><a href="post_message_form.asp?mode=new&ReturnPage=Search&SearchPagePosition=<% = intRecordPositionPageNum %>&search=<% = Request.QueryString("search") %>&searchMode=<% = Request.QueryString("searchMode") %>&searchIn=<% = Request.QueryString("searchIn") %>&forum=<% = Request.QueryString("forum") %>&searchSort=<% = Request.QueryString("searchSort") %>&ForumID=<% = intForumID %>" target="_self"><img src="forum_images/new_post.gif" width="100" height="24" border="0" align="absmiddle" alt="New post"></a></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<%
'Get the Topics for the forum from the database
'Create a record set object to the Topics held in the database
Set rsTopicDetails = Server.CreateObject("ADODB.Recordset")
	

'Set the cursor type property of the record set to dynamic so we can naviagate through the record set
rsTopicDetails.CursorType = 1

'Query the database
rsTopicDetails.Open strSQLResultsQuery, strCon   

'Set the number of records to display on each page
rsTopicDetails.PageSize = 15



'If ther are records found say how many
If NOT rsTopicDetails.EOF Then 
	Response.Write vbCrLf & "<table align=""center"" cellpadding=""4"">"
	Response.Write vbCrLf & "<tr>"
	Response.Write vbCrLf & "<td align=""center"">Your search has found " & rsTopicDetails.RecordCount & " results</td>"
	Response.Write vbCrLf & "</tr>"
	Response.Write vbCrLf & "</table>"
End If
	%>
	<br>
<table width="98%" border="0" cellspacing="0" cellpadding="0" bgcolor="<% = strTableBorderColour %>" align="center">
  <tr> 
    <td> 
     <table width="100%" border="0" cellspacing="1" cellpadding="4" height="14" bgcolor="<% = strTableBorderColour %>">
<%
If rsTopicDetails.EOF Then 

	Response.Write vbCrLf & "<tr><td bgcolor=""" & strTableColour & """ colspan=""5"" align=""center"" height=""150"">Sorry, your search found no results"
	Response.Write vbCrLf & "<br><br><a href=""search_form.asp?ReturnPage=Search&search=" & Request.QueryString("search") & "&searchMode=" & Request.QueryString("searchMode") & "&searchIn=" & Request.QueryString("searchIn") & "&forum=" & Request.QueryString("forum") & "&searchSort=" & Request.QueryString("searchSort")  & "&SearchPagePosition=1" & """ target=""_self"">Click here to refine your search</a></td></tr>"

'If there the are topic's so write the HTML to display the topic names and a discription
Else
%>

     
        <tr>
          <td bgcolor="<% = strTableTitleColour %>" width="47%" height="2"><b>Thread</b></td>
          <td bgcolor="<% = strTableTitleColour %>" width="14%" height="2"><font face="Times New Roman, Times, serif" size="2"><b>Thread 
            Starter</b></font></td>
          <td bgcolor="<% = strTableTitleColour %>" width="6%" align="center" height="2"><b>Replies</b></td>
          <td bgcolor="<% = strTableTitleColour %>" width="6%" align="center" height="2"><b>Views</b></td>
          <td bgcolor="<% = strTableTitleColour %>" width="27%" height="2"><b>Last Post</b></td>
        </tr>
        <%
        

	'Get the record poistion to display from
	rsTopicDetails.AbsolutePage = intRecordPositionPageNum
	
	'Count the number of pages there are in the recordset calculated by the PageSize attribute set above
	intTotalNumOfPages = rsTopicDetails.PageCount


	'Craete a Recodset object for the topic details
	Set rsTopic = Server.CreateObject("ADODB.Recordset")
	
	'Initalise the strSQL variable with an SQL statement to query the database to get the Author and subject from the database for the topic
	strSQL = "SELECT tblThread.Author_ID, tblThread.Message_date, tblAuthor.Username, tblThread.Topic_ID " 
	strSQL = strSQL & "FROM tblAuthor INNER JOIN tblThread ON tblAuthor.Author_ID = tblThread.Author_ID "
	strSQL = strSQL & "ORDER BY tblThread.Message_Date ASC;"		
	
	'Set the cursor type property of the record set to forward only so we can navigate through the record set
	rsTopic.CursorType = 1	
	
	'Query the database
	rsTopic.Open strSQL, strCon


	'Loop round to read in all the Topics in the database
	For intRecordLoopCounter = 1 to 15
	
		'If there are no records left in the recordset to display then exit the for loop
		If rsTopicDetails.EOF Then Exit For	
	
		'Read in Topic details from the database
		lngTopicID = CLng(rsTopicDetails("Topic_ID"))
		lngNumberOfViews = CLng(rsTopicDetails("No_of_views"))
		strSubject = Server.HTMLEncode(rsTopicDetails("Subject"))		
	
		'Filter the recordset to only have details on the topic we need the details for
		rsTopic.Filter = "Topic_ID = " & lngTopicID
		
		'If there is info in the database relating to the topic then get them from the record set
		If NOT rsTopic.EOF Then
			
			'Read in the subject and author and number of replies from the record set
			strTopicStartUsername = Server.HTMLEncode(rsTopic("Username")) 
			lngTopicStartUserID = CLng(rsTopic("Author_ID")) 
			lngNumberOfReplies = CLng((rsTopic.RecordCount) - 1)
			
			'Move to the last record in the record set to get the date and username of the last entry
			rsTopic.MoveLast
			
			'Read in the username and date of the last entry from the record set
			strLastEntryUsername = Server.HTMLEncode(rsTopic("Username"))
			lngLastEntryUserID = CLng(rsTopic("Author_ID"))
			dtmLastEntryDate = CDate(rsTopic("Message_date"))
		End If	
		
		'Write the HTML of the Topic descriptions as hyperlinks to the Topic details and message 
		%>
		<tr>
		<td bgcolor="<% = strTableColour %>" width="47%"><a href="display_topic_threads.asp?ForumID=<% = intForumID %>&TopicID=<% = lngTopicID %>&SearchPagePosition=<% = intRecordPositionPageNum %>&search=<% = Request.QueryString("search") %>&searchMode=<% = Request.QueryString("searchMode") %>&searchIn=<% = Request.QueryString("searchIn") %>&forum=<% = Request.QueryString("forum") %>&searchSort=<% = Request.QueryString("searchSort") %>&ReturnPage=Search" target="_self"><% = strSubject %></a></td>
		<td bgcolor="<% = strTableColour %>" width="14%"><a href="profile.asp?profile=<% = lngTopicStartUserID %>&ReturnPage=Search&SearchPagePosition=<% = intRecordPositionPageNum %>&search=<% = Request.QueryString("search") %>&searchMode=<% = Request.QueryString("searchMode") %>&searchIn=<% = Request.QueryString("searchIn") %>&forum=<% = Request.QueryString("forum") %>&searchSort=<% = Request.QueryString("searchSort") %>" target="_self"><% = strTopicStartUsername %></a></td>
		<td bgcolor="<% = strTableColour %>" width="6%" align="center"><% = lngNumberOfReplies %></td>
		<td bgcolor="<% = strTableColour %>" width="6%" align="center"><% = lngNumberOfViews %></td>
		<td bgcolor="<% = strTableColour %>" width="27%"><% = FormatDateTime(dtmLastEntryDate, vbLongDate) %> at <% = FormatDateTime(dtmLastEntryDate, vbShortTime) %><br>By <a href="profile.asp?profile=<% = lngLastEntryUserID %>&ReturnPage=Search&SearchPagePosition=<% = intRecordPositionPageNum %>&search=<% = Request.QueryString("search") %>&searchMode=<% = Request.QueryString("searchMode") %>&searchIn=<% = Request.QueryString("searchIn") %>&forum=<% = Request.QueryString("forum") %>&searchSort=<% = Request.QueryString("searchSort") %>" target="_self"><% = strLastEntryUsername %></a></td>
		</tr>
		<%
		
		'Move to the next database record
		rsTopicDetails.MoveNext	
	Next		
End If      
        %>       
      </table>
    </td>
  </tr>
</table>
<br>
<form>
  <table width="98%" border="0" cellspacing="0" cellpadding="1" align="center" bgcolor="<% = strTableBorderColour %>">
    <tr>
      <td>
        <table width="100%" border="0" cellspacing="0" cellpadding="1" align="center" bgcolor="<% = strTableTitleColour %>">
          <tr> 
            <td> &nbsp;Forum Jump 
              <select onChange="ForumJump(this)" name="SelectJumpForum">
                <option value="" selected>-- Select Forum --</option>
                <%
'Create a recordset to hold the forum name and id number
Set rsForumJump = Server.CreateObject("ADODB.Recordset")

'Read in the forum name from the database
'Initalise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT tblForum.Forum_name, tblForum.Forum_ID FROM tblForum"

'Query the database
rsForumJump.Open strSQL, strCon

'Loop through all the froum in the database
Do while NOT rsForumJump.EOF 

	'Read in the forum details from the recordset
	strJumpForumName = rsForumJump("Forum_name")
	lngJumpForumID = CLng(rsForumJump("Forum_ID"))

	'Display a link in the link list to the forum
	Response.Write vbCrLf & "<option value=display_forum_topics.asp?ForumID=" & lngJumpForumID & ">" & strJumpForumName & "</option>"		
			
	'Move to the next record in the recordset
	rsForumJump.MoveNext
Loop
%>
              </select>
            </td>
            <%
'If there is more than 1 page of topics display last and next links to the other topics
If intTotalNumOfPages > 1 Then   

	'Display an image link to the last topic
	Response.Write vbCrLf & "<td><a href=""search.asp?search=" & Request.QueryString("search") & "&searchMode=" & Request.QueryString("searchMode") & "&searchIn=" & Request.QueryString("searchIn") & "&forum=" & Request.QueryString("forum") & "&searchSort=" & Request.QueryString("searchSort") & "&SearchPagePosition="
	
	'If this page is the first page of topics than link to the last page of topics
	If (intRecordPositionPageNum - 1) = 0 Then
		Response.Write intTotalNumOfPages 
	'If this page is the not the first page of topics than link to the previous page
	Else
		Response.Write intRecordPositionPageNum - 1
	End If
	
	Response.Write """ target=""_self""><img src=""forum_images/last_topic.gif"" width=""100"" height=""24"" border=""0"" align=""absmiddle"" alt""Last topic""></a>&nbsp;"
	
	
	'Display an image link to the next page of topics
	Response.Write vbCrLf & "<a href=""search.asp?search=" & Request.QueryString("search") & "&searchMode=" & Request.QueryString("searchMode") & "&searchIn=" & Request.QueryString("searchIn") & "&forum=" & Request.QueryString("forum") & "&searchSort=" & Request.QueryString("searchSort") & "&SearchPagePosition="
	
	'If this is the last page of Topics then link to the first page of topics
	If rsTopicDetails.EOF Then
		Response.Write "1"
	'If this this page is not the last page of topics then link to the next page of topics
	Else
		Response.Write intRecordPositionPageNum + 1 	
	End If
	
	Response.Write """ target=""_self""><img src=""forum_images/next_topic.gif"" width=""100"" height=""24"" border=""0"" align=""absmiddle"" alt""Next topic""></a></td>"
End If


'Reset Server Objects
Set adoCon = Nothing
Set strCon = Nothing
Set rsForum = Nothing
Set rsAuthor = Nothing
Set rsThread = Nothing
Set rsTopicDetails = Nothing 
Set rsTopic = Nothing 
Set rsForumJump = Nothing
%>
            <td align="right"><a href="post_message_form.asp?mode=new&ReturnPage=Search&SearchPagePosition=<% = intRecordPositionPageNum %>&search=<% = Request.QueryString("search") %>&searchMode=<% = Request.QueryString("searchMode") %>&searchIn=<% = Request.QueryString("searchIn") %>&forum=<% = Request.QueryString("forum") %>&searchSort=<% = Request.QueryString("searchSort") %>&ForumID=<% = intForumID %>" target="_self"><img src="forum_images/new_post.gif" width="100" height="24" border="0" align="absmiddle" alt="New post"></a></td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
  </form>
<div align="center"> <a href="http://www.surf-net.co.uk" target="_blank"><br>
  <img src="surf-net_logo.gif" width="88" height="31" border="0" alt="Surf-net"></a> 
</div>
<br>
</body>
</html>
<%
'Function to build SQL query's for seach all or any words
Function BuildSQL (strTable, sarySearchWord)

	'Initilaise variables
	Dim intSQLLoopCounter
	
	
	'Initilaise variables
	intSQLLoopCounter = 0

	'Search for the first search word
	BuildSQL = BuildSQL & "(" & strTable & " LIKE '%" & sarySearchWord(0) & "%'"

	'Loop to search for each search word entered by the user
	For intSQLLoopCounter = 1 To UBound(sarySearchWord)
		
		'If the search is for all words then place AND between the words to be serached
		If Request.QueryString("searchMode") = "allwords" Then 
			BuildSQL = BuildSQL & " AND "
		
		'Else the user has choosen to search for any words so place OR between the words to be serached
		Else
			BuildSQL = BuildSQL & " OR "
		End If
		
		'Place the search word in the query
		BuildSQL = BuildSQL & strTable & " LIKE '%" & sarySearchWord(intSQLLoopCounter) & "%'"
	Next

	'Close the end of the search words in the SQL query by closing the bracket
	BuildSQL = BuildSQL & ")"
End Function
%>





0 user(s) are reading this topic

0 membro(s), 0 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq