سورس كد كم حجم ترين انجمن مبتني بر قدرت ASP
http://www.googlen.ir/showthread.php?tid=403
http://www.googlen.ir/showthread.php?tid=403
<% @ LANGUAGE=VBScript%>
<%Response.Buffer = True%>
<html>
<head>
<!-- Page is build by Gurgen Alaverdian ------->
<!-- Check ReadMe1st.rtf for more info. ------->
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Veiw Threads</title>
<script language="JavaScript1.2" src="ultimate.js">
</script>
<style fprolloverstyle>A:hover {color: #008000; font-weight: bold}
</style>
</head>
<body bgcolor="#000000" text="#000000" link="#FF0000" vlink="#035074" alink="#008000" style="font-size: 1em">
<p align="center"><img border="0" src="Images/Logo1.jpg"></p>
<%
'******************** Begin Script ************************
Dim objFile, showForum, strForums, dbForum, f, fl, currentForum
Dim PerPage, Page, showForumEn, NewForum
Set objFile = CreateObject("Scripting.FileSystemObject")
If Request.Querystring.Count = 1 then
showForum = Request.Querystring.Item(1)
Else: showForum = ""
End If
If Request.Cookies("PerPage") = "" then
Response.Cookies("PerPage") = 20
PerPage = 20
Else: PerPage = CInt(Request.Cookies("PerPage"))
End If
If Request.Cookies("Page") = "" then
Response.Cookies("Page") = 1
Page = 1
Else: Page = CInt(Request.Cookies("Page"))
End If
'Response.Write "PerPage=" & PerPage & vbcr
'Response.Write "Page=" & Pages
'*** Build a Forum List.
dbForum = server.mappath("db\Forums")
Set fl = objFile.GetFolder(dbForum)
For each f in fl.files
Forum = Mid(f.name, 1, instr(f.name, ".") - 1)
Select Case showForum
Case ""
showForum = Forum
strForums = "<option selected value='" & Server.URLEncode(Forum) & "'>" & Forum & "</option>"
Case else
If showForum = Forum then
strForums = strForums & "<option selected value='" & Server.URLEncode(Forum) & "'>" & Forum & "</option>"
Else: strForums = strForums & "<option value='" & Server.URLEncode(Forum) & "'>" & Forum & "</option>"
End If
End Select
Next
showForumEn = Server.URLEncode(showForum)
%>
<FORM METHOD=POST ACTION="default.asp" NAME="view">
<p align="center"> </p>
<div align="center">
<center>
<table border="0" width="70%" cellspacing="1" height="43">
<tr>
<td width="43%" valign="middle" align="center" height="43">
<font face="Arial" color="C7DBDE" size="2"><b>Current Forum: </b></font><select size="1" name="Forums" onChange="javascript:window.location='default.asp?Forum=' + this.options[this.selectedIndex].value;" style="background-color: #035074; color: #FFFFFF; font-family: Arial; font-size: 10pt; font-weight: bold">
<%=strForums%>
</select></td>
<td width="57%" valign="middle" align="center" height="43"><a href="postnew.asp?Forum=<%=showForumEn%>"><img border="0" src="Images/postNew.jpg"></a>
<a href="admin.asp"><img border="0" src="Images/Administer.jpg"></a>
<a href="archive.asp"><img border="0" src="Images/Archive.jpg"></a>
<a href="#" onclick="javascript:window.location=window.location"><img border="0" src="Images/Refresh.jpg"></a></td>
</tr>
</table>
</center>
</div>
<!--#include file="Pages.asp"-->
<div align="center">
<center>
<table border="0" width="80%" height="43">
<tr>
<td width="12%" height="39"><font face="Arial" color="C7DBDE" size="2"><b>Total Threads:</b></font></td>
<td width="6%" height="39"><font face="Arial" color="C7DBDE" size="2"><b><%=Total%></b></font></td>
<td width="63%" height="39" align="center"><font face="Arial" size="2" color="C7DBDE"><b><%=Pages%></b></font></td>
<td width="19%" height="39" align="right">
<select size="1" name="D1" onChange="viewpages(this.options[this.selectedIndex].value, 1, '<%=showForumEn%>', 'default.asp')"; style="background-color: #035074; color: #FFFFFF; font-family: Arial; font-size: 10pt; font-weight: bold">
<option <%if PerPage = 20 then Response.Write "selected"%> value="20">20 Threads per page</option>
<option <%if PerPage = 40 then Response.Write "selected"%> value="40">40 Threads per page</option>
<option <%if PerPage = 60 then Response.Write "selected"%> value="60">60 Threads per page</option>
<option <%if PerPage = 80 then Response.Write "selected"%> value="80">80 Threads per page</option>
</select>
</td>
</tr>
</table>
</center>
</div>
<%
End Sub
set dbFile = objFile.GetFile(server.mappath("db\Forums\" & showForum & ".txt"))
IF objFile.FileExists(dbFile) Then
Set recordGet=objFile.OpenTextFile(dbFile, 1, False)
On Error Resume Next
allRecords = recordGet.Read(dbFile.Size)
On Error GoTo 0
IF allRecords = "" Or allRecords = VbCrlf Then
recordGet.Close: noEntry
Else
recordGet.Close: Call GetRecords(allRecords)
End IF
Else: noEntry
End IF
'*** This is a main function that builds the page.
Function GetRecords(allRecords)
Dim globRecord, X, strRec, recArray, Date, Name, Email, Topic, Comment
Dim FirstMessage, LastMessage, Y, post
'*** Split All Records into lines and assign to array.
globRecord = Split(allRecords, vbCrLf)
allRecords = ""
'*** Strip replies
For each post in globRecord
If Left(post, 3) = "001" then
allRecords = allRecords & chr(165) & post
End If
Next
'*** Split remaining
globRecord = Split(allRecords, Chr(165))
X = Ubound(globRecord)
'*** Call a sub that buids links to the pages and Drop-Down list.
Call ShowPages(X, "default.asp", "view")
%>
<hr width="80%" size="3" color="#035074">
<div align="center">
<center>
<table style="behavior: url(sort.htc)" border="1" width="80%" cellspacing="0" height="30">
<thead>
<tr>
<td width="58%" bgcolor="#C7DBDE" valign="middle" align="center" height="1"><b><font face="Verdana" size="1">Topic:</font></b></td>
<td width="17%" bgcolor="#C7DBDE" valign="middle" align="center" height="1"><b><font face="Verdana" size="1">Posted by:</font></b></td>
<td width="6%" bgcolor="#C7DBDE" valign="middle" align="center" height="1"><b><font face="Verdana" size="1">Replies:</font></b></td>
<td width="19%" bgcolor="#C7DBDE" valign="middle" align="center" height="1"><b><font face="Verdana" size="1">Last Post:</font></b></td>
</tr>
</thead>
<tbody>
<%
'*** Next I need to figure out what messages to display according to "PerPage" and "Page" number. Just a math.
Y = X - (Page * PerPage)
If Y < 0 then
LastMessage = 0
FirstMessage = X Mod PerPage
Else
LastMessage = Y
FirstMessage = Y + PerPage
End If
'*** Now I split each record by special character separator (as they were recorded), set appropriate data to variale and build the table.
X = FirstMessage
Do until X = LastMessage
strRec = globRecord(X)
IF Not strRec = "" then
recArray = Split(Cstr(strRec), chr(164))
ID = Server.URLEncode(recArray(1))
Name = recArray(2)
Email = recArray(3)
Topic = recArray(4)
icon = recArray(7)
lastPost = recArray(8)
Replies = recArray(9)
If Not Email = "" then Name = "<a href='mailto:" & Email & "'>" & Name & "</a>"
%>
<tr>
<td width="58%" bgcolor="#C7DBDE" valign="middle" align="left" height="1"><b><font face="Verdana" size="1"><img border="0" src="Images/<%=icon%>">
<a href="viewpost.asp?ID=<%=ID%>&Forum=<%=showForumEn%>&Level=001&Repl=<%=Replies%>"><%=Topic%></a></font></b></td>
<td width="17%" bgcolor="#C7DBDE" valign="middle" align="center" height="1"><b><font face="Verdana" size="1"><%=Name%></font></b></td>
<td width="6%" bgcolor="#C7DBDE" valign="middle" align="center" height="1"><b><font face="Verdana" size="1"><%=Replies%></font></b></td>
<td width="19%" bgcolor="#C7DBDE" valign="middle" align="center" height="1"><b><font face="Verdana" size="1"><%=LastPost%></font></b></td>
</tr>
<%
End IF
X = X - 1
Loop
End Function
%>
<tbody>
</table>
</center>
</div>
<%
Sub noEntry()
Dim msgEmpty
msgEmpty = "There are no messages in this forum. Please click "Post New" to start a thread."
Response.Write "<p align='center'><b><font face='Bangle' color='C7DBDE' size='3'>" & msgEmpty & "</font></b></p>"
End Sub
%>
<hr width="80%" size="3" color="#035074">
</form>
<p align="center"><b><font face="Arial" size="2" color="C7DBDE">©2002 MyWebSite.com - All Rights Reserved</font></b></p>
</body>
</html>