<% Option Explicit %> <% ' ## ASP Discussion Forum ## ' ## Copyright (C)2001 Bruce Corkhill ## ' ## URL: http://www.webwizguide.com ## 'Set the response buffer to true as we maybe redirecting Response.Buffer = True 'Dimension variables Dim rsMembers 'Holds the Database Recordset for the forum members Dim rsLastPostDate 'Holds the Database Recordset for the users last post Dim strUsername 'Holds the users username Dim strLocation 'Holds the users location Dim strHomepage 'Holds the users homepage if they have one Dim strEmail 'Holds the users e-mail address Dim blnShowEmail 'Boolean set to true if the user wishes there e-mail address to be shown Dim lngUserID 'Holds the new users ID number Dim intNumOfPosts 'Holds the number of posts the user has made Dim dtmRegisteredDate 'Holds the date the usre registered Dim strReturnPage 'Holds the page to return to Dim intTotalNumMembersPages 'Holds the total number of pages Dim intTotalNumMembers 'Holds the total number of forum members Dim intRecordPositionPageNum 'Holds the page number we are on Dim intRecordLoopCounter 'Recordset loop counter Dim dtmLastPostDate 'Holds the date of the users las post Dim intLinkPageNum 'Holds the page number to link to Dim strReturnPageProperties 'Holds the properties of the return page Dim strSearchCriteria 'Holds the search critiria Dim strSortBy 'Holds the way the records are sorted Dim intSortSelectField 'Holds the sort selection to be shown in the sort list box 'Initalise variables blnShowEmail = False strSearchCriteria = "%" 'Get the forum page to return to Select Case Request.QueryString("ReturnPage") Case "Topic" 'Read in the forum and topic to return to strReturnPage = "display_forum_topics.asp" strReturnPageProperties = "?ReturnPage=" & Request.QueryString("ReturnPage") & "&ForumID=" & CInt(Request.QueryString("ForumID")) & "&PagePosition=" & CInt(Request.QueryString("PagePosition")) 'Read in the thread and forum to return to Case "Thread" strReturnPage = "display_topic_threads.asp" strReturnPageProperties = "?ReturnPage=" & Request.QueryString("ReturnPage") & "&ForumID=" & CInt(Request.QueryString("ForumID")) & "&TopicID=" & CLng(Request.QueryString("TopicID")) & "&PagePosition=" & CInt(Request.QueryString("PagePosition")) 'Read in the search to return to Case "Search" strReturnPage = "search.asp" strReturnPageProperties = "?ReturnPage=" & Request.QueryString("ReturnPage") & "&SearchPagePosition=" & Request.QueryString("SearchPagePosition") & "&search=" & Server.URLEncode(Request.QueryString("search")) & "&searchMode=" & Request.QueryString("searchMode") & "&searchIn=" & Request.QueryString("searchIn") & "&forum=" & Request.QueryString("forum") & "&searchSort=" & Request.QueryString("searchSort") 'Else return to the forum main page Case Else strReturnPage = "default.asp" strReturnPageProperties = "?ForumID=0" End Select 'If this is the first time the page is displayed then the members record position is set to page 1 If Request.QueryString("MemPagePosition") = "" Then intRecordPositionPageNum = 1 'Else the page has been displayed before so the members page record postion is set to the Record Position number Else intRecordPositionPageNum = CInt(Request.QueryString("MemPagePosition")) End If 'Get the search critiria for the members to display If NOT Request.QueryString("find") = "" Then strSearchCriteria = Request.QueryString("find") & "%" End If 'Get the sort critiria Select Case Request.QueryString("Sort") Case "post" strSortBy = "No_of_posts DESC" intSortSelectField = 1 Case "latestUsers" strSortBy = "Join_date DESC" intSortSelectField = 2 Case "oldestUsers" strSortBy = "Join_date ASC" intSortSelectField = 3 Case "location" strSortBy = "Location ASC" intSortSelectField = 4 Case Else strSortBy = "Username ASC" intSortSelectField = 0 End Select %> Forum Members List

ข้อมูลสมาชิก
Forum Members List

<< กลับหน้ากระทู้หลัก

ค้นหาข้อมูลสมาชิก : "> "> "> "> "> "> "> "> "> ">

ทั้งหมด

All A B C D E F G H I J F L M N O P Q R S T U V W X Y Z

<% 'If the user has not logged in dispaly an error message If lngLoggedInUserID = 0 Then Response.Write vbCrLf & "ขอโทษครับ ขอสงวนสิทธิ์การค้นหาไว้สำหรับเพื่อนสมาชิกด้วยกันเท่านั้น

" Response.Write vbCrLf & "  " 'If the user has logged in then read in the members from the database and dispaly them Else 'Intialise the ADO recordset object Set rsMembers = Server.CreateObject("ADODB.Recordset") 'Initalise the strSQL variable with an SQL statement to query the database strSQL = "SELECT tblAuthor.* " strSQL = strSQL & "FROM tblAuthor " strSQL = strSQL & "WHERE ((([tblAuthor].[Username]) Like '" & strSearchCriteria & "')) " strSQL = strSQL & "ORDER BY tblAuthor." & strSortBy & ";" 'Set the cursor type property of the record set to dynamic so we can naviagate through the record set rsMembers.CursorType = 3 'Query the database rsMembers.Open strSQL, strCon 'Set the number of records to display on each page rsMembers.PageSize = 20 'If there are no memebers to display then show an error message If rsMembers.EOF Then Response.Write "ไม่พบข้อมูลที่ค้นหา" 'If there is a recorset returned by the query then read in the details Else 'Set the page number to display records for rsMembers.AbsolutePage = intRecordPositionPageNum 'Count the number of members there are in the database by returning the number of records in the recordset intTotalNumMembers = rsMembers.RecordCount 'Count the number of pages there are in the database calculated by the PageSize attribute set above intTotalNumMembersPages = rsMembers.PageCount 'Display the HTML for the total number of pages and total number of records in the database for the users Response.Write vbCrLf & " " Response.Write vbCrLf & " " Response.Write vbCrLf & " " Response.Write vbCrLf & " " Response.Write vbCrLf & "
" 'If we are showing all the forum memebers then display how many members there are If Request.QueryString("find") = "" Then Response.Write vbCrLf & " จำนวนสมาชิกปัจจุบันมีทั้งหมด " & intTotalNumMembers & " คน
Forum members on " & intTotalNumMembersPages & " pages และขณะนี้อยู่ที่หน้า " & intRecordPositionPageNum 'Else display how many results were fround from the search Else Response.Write vbCrLf & " ค้นหาสมาชิกได้จำนวน " & intTotalNumMembers & " ท่าน" End If Response.Write vbCrLf & "
" Response.Write vbCrLf & "
" %>
ค้นหาโดย:
<% 'Intialise the ADO recordset object Set rsLastPostDate = Server.CreateObject("ADODB.Recordset") 'Initalise the strSQL variable with an SQL statement to query the database strSQL = "SELECT tblThread.Message_date, tblThread.Author_ID " strSQL = strSQL & "FROM tblThread " strSQL = strSQL & "ORDER BY tblThread.Message_date DESC;" 'Query the database rsLastPostDate.Open strSQL, strCon 'For....Next Loop to loop through the recorset to display the forum members For intRecordLoopCounter = 1 to 20 'If there are no member's records left to display then exit loop If rsMembers.EOF Then Exit For 'Initialise varibles dtmLastPostDate = "" 'Read in the profile from the recordset lngUserID = CLng(rsMembers("Author_ID")) strUsername = Server.HTMLEncode(rsMembers("Username")) strEmail = rsMembers("Author_email") blnShowEmail = CBool(rsMembers("Show_email")) strHomepage = rsMembers("Homepage") strLocation = rsMembers("Location") intNumOfPosts = CInt(rsMembers("No_of_posts")) dtmRegisteredDate = CDate(rsMembers("Join_date")) 'Filter the Last Post recordset to get the last post the user posted rsLastPostDate.Filter = "Author_ID = " & lngUserID 'Read in the date of the last post If NOT rsLastPostDate.EOF Then dtmLastPostDate = CDate(rsLastPostDate("Message_date")) 'Write the HTML of the Topic descriptions as hyperlinks to the Topic details and message %> <% 'Move to the next record in the database rsMembers.MoveNext 'Loop back round Next End If %>
ติดต่อ ชื่อสมาชิก การเข้าใช้ เข้าใช้ล่าสุด สมัครวันที่ พื้นที่การใช้ internet ค้นหา
<% If NOT strHomepage = "" Then Response.Write "" %> <% If NOT strEmail = "" AND (blnShowEmail = True OR lngLoggedInUserID = 1) Then Response.Write " " %> <% If strHomepage = "" AND strEmail = "" AND (blnShowEmail = False OR lngLoggedInUserID > 1) Then Response.Write " " %> <% = strUsername %> <% = intNumOfPosts %> <% If dtmLastPostDate = "" Then Response.Write " " Else Response.Write FormatDateTime(dtmLastPostDate, VbLongDate) End If %> <% = FormatDateTime(dtmRegisteredDate, VbLongDate) %> <% If strLocation = "" Then Response.Write " " Else Response.Write strLocation End If %> <% If Request.QueryString("ReturnPage") = "Search" Then %> Search for other posts by <% = strUsername %> <% Else %> Search for other posts by <% = strUsername %> <% End If %>
<% 'Display an HTML table with links to the rest of the mebers list Response.Write vbCrLf & " " Response.Write vbCrLf & " " Response.Write vbCrLf & " " Response.Write vbCrLf & " " Response.Write vbCrLf & "
" Response.Write vbCrLf & " " Response.Write vbCrLf & " " Response.Write vbCrLf & " " Response.Write vbCrLf & " " Response.Write vbCrLf & "
" 'If there are more pages to display then add a title to the other pages If intRecordPositionPageNum > 1 or NOT rsMembers.EOF Then Response.Write vbCrLf & " Page:  " End If 'If the page number is higher than page 1 then display a back link If intRecordPositionPageNum > 1 Then Response.Write vbCrLf & " << Prev " End If 'If there are more pages to display then display links to all the pages If intRecordPositionPageNum > 1 or NOT rsMembers.EOF Then 'Display a link for each page in the members list For intLinkPageNum = 1 to intTotalNumMembersPages 'If the page to be linked to is the page displayed then don't make it a hyper-link If intLinkPageNum = intRecordPositionPageNum Then Response.Write vbCrLf & " " & intLinkPageNum Else Response.Write vbCrLf & " " & intLinkPageNum & "" End If Next End If 'If it is Not the End of the members list then display a next link for the next page If NOT rsMembers.EOF then Response.Write vbCrLf & "  Next >>" End If 'Finsh HTML the table Response.Write vbCrLf & "
" Response.Write vbCrLf & "
" 'Reset Server Variables Set strCon = Nothing Set rsMembers = Nothing Set rsLastPostDate = Nothing End If %>