<!-- #include file=../inc/BBSsetup.asp -->
<!-- #include file=../inc/Upload_Setup.asp -->
<!-- #include file=../inc/Board_Popfun.asp -->
<%
DEF_BBS_HomeUrl = "../"
Dim Key

Function LoginAccuessFul

	GBL_CHK_TempStr = ""
	DisplayAnnouncesSplitPages

End Function

Sub Main

	'GBL_CHK_PWdFlag = 0
	initDatabase
	GBL_CHK_TempStr = ""
	BBS_SiteHead DEF_SiteNameString & " " & DEF_BBS_Name,0," &gt;&gt; 浏览论坛附件"
	UpdateOnlineUserAtInfo 0,"浏览论坛附件"
	
	'If GetBinarybit(GBL_CHK_UserLimit,11) = 1 and (GetBinarybit(GBL_CHK_UserLimit,10) = 1 or GetBinarybit(GBL_CHK_UserLimit,8) = 1) Then
	If CheckSupervisorUserName = 1 or (GetBinarybit(GBL_CHK_UserLimit,10) = 1 or GetBinarybit(GBL_CHK_UserLimit,8) = 1) Then
	Else
		GBL_CHK_TempStr = " &nbsp; 全部附件查看已经设为只允许版主查看．"
	End If

	If GBL_CHK_TempStr = "" Then
		If GBL_TableHeadString <> "" Then
			Response.Write "<table width=" & DEF_BBS_ScreenWidth & " border=0 cellspacing=0 cellpadding=0 align=center><tr><td>"
			Response.Write GBL_TableHeadString
			Response.Write "</td></tr></table>"
		End If
	%>
	<table width="<%=DEF_BBS_ScreenWidth%>" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="<%=DEF_BBS_DarkColor%>" class=TBone>
	<tr>
		<td>
			<%LoginAccuessFul%></td>
	</tr>
	</table><%
		If GBL_TableBottomString <> "" Then
			%><table width=<%=DEF_BBS_ScreenWidth%> border=0 cellspacing=0 cellpadding=0 align=center><tr><td><%=GBL_TableBottomString%></td></tr></table><%
		End If
	Else
	%>
	<table width="<%=DEF_BBS_ScreenWidth%>" border="0" cellspacing="0" cellpadding="0" align="center">
	<tr height=30>
		<td bgcolor="<%=DEF_BBS_Color%>" class=TBBG1>
			<%=GBL_CHK_TempStr%></td>
	</tr>
	</table>
	<%
	End If
	closeDataBase
	SiteBottom
	If GBL_ShowBottomSure = 1 Then Response.Write GBL_SiteBottomString

End Sub

Function LoginAccuessFul

	Dim Rs,SQL,NewNum,UserName,recordCount

	'Set Rs = Con.ExeCute("Select top 1 UploadNum from LeadBBS_SiteInfo")
	'GBL_DBNum = GBL_DBNum + 1

	'If Not Rs.Eof Then
	'	recordCount = cCur(Rs(0))
	'Else
	'	Response.Write "<br><br>&nbsp; &nbsp; &nbsp; 无任何信息！"
	'	Rs.Close
	'	Set Rs = Nothing
	'	Exit Function
	'End if
	'Rs.close
	'Set Rs = Nothing
	
	Dim TmpData
	If isArray(application(DEF_MasterCookies & "StatisticData")) = False Then ReloadStatisticData
	TmpData = Application(DEF_MasterCookies & "StatisticData")
	recordCount = cCur(TmpData(5,0))

	GBL_CHK_TempStr=""
	Dim UpDownPageFlag
	UpDownPageFlag = Request("UpDownPageFlag")

	Dim Start

	Dim SQLendString

	Start = Left(Trim(Request("Start")),14)
	Start = start
	If isNumeric(Start)=0 or Start="" Then Start=999999999
	Start = cCur(Start)
	If Start = 0 Then Start=999999999
	if Start = 1 Then Start = 0

	Dim SQLCountString,whereFlag
	whereFlag = 0

	SQLCountString = SQLendString
	If UpDownPageFlag = "1" and Start>=0 then
		If whereFlag = 1 Then
			SQLendString = SQLendString & " and T1.ID>" & Start
		Else
			SQLendString = SQLendString & " where T1.ID>" & Start
			whereFlag = 1
		End If
	Else
		If whereFlag = 1 Then
			SQLendString = SQLendString & " and T1.ID<" & Start
		Else
			SQLendString = SQLendString & " where T1.ID<" & Start
			whereFlag = 1
		End If
	end If

	If UpDownPageFlag = "1" then
		SQLendString = SQLendString & " Order by  T1.ID ASC"
	Else
		SQLendString = SQLendString & " Order by T1.ID DESC"
	End If
	
	Dim MaxRecordID,MinRecordID
	MaxRecordID = 0

	SQL = "select Max(id) from LeadBBS_Upload as T1 " & SQLCountString
	Set Rs = Con.ExeCute(SQL)
	GBL_DBNum = GBL_DBNum + 1
	
	If not Rs.Eof Then
		If Rs(0) <> "" Then
			MaxRecordID = cCur(Rs(0))
		Else
			MaxRecordID = 0
		End If
	End If
	Rs.Close
	Set Rs = Nothing
	
	SQL = "select Min(id) from LeadBBS_Upload as T1 " & SQLCountString
	Set Rs = Con.ExeCute(SQL)
	GBL_DBNum = GBL_DBNum + 1

	If not Rs.Eof Then
		If Rs(0) <> "" Then
			MinRecordID = cCur(Rs(0))
		else
			MinRecordID = 0
		end If
	End If
	Rs.Close
	Set Rs = Nothing

	Dim FirstID,LastID	
	'SQL = "select count(*) from LeadBBS_Upload as T1 " & SQLCountString
	'Rs.Open SQL,con,1,1
	'GBL_DBNum = GBL_DBNum + 1
	'if rs.eof then
	'	recordCount=0
	'else
	'	recordCount=rs(0)
	'	if recordCount="" or isNull(recordCount) or len(recordCount)<1 Then recordCount=0
	'End If
	'Rs.Close

	SQL = "select TOP "&DEF_TopicContentMaxListNum&" T1.ID,T1.UserID,T1.PhotoDir,T1.SPhotoDir,T1.NdateTime,T1.FileType,T2.UserName from LeadBBS_Upload As T1 left join LeadBBS_User as T2 on T1.UserID=T2.ID " & SQLendString
	Set Rs = Con.ExeCute(SQL)
	GBL_DBNum = GBL_DBNum + 1
	Dim Num
	Dim GetData
	If Not rs.Eof Then
		GetData = Rs.GetRows(-1)
		Num = Ubound(GetData,2)
	Else
		Num = -1
	End If
	Rs.close
	Set Rs = Nothing
	
	
	Dim i,N
	If Num>=0 Then
		i=1
	
		Dim MinN,MaxN,StepValue
		SQL = ubound(getdata,2)
		If UpDownPageFlag = "1" then
			MinN = SQL
			MaxN = 0
			StepValue = -1
		Else
			MinN = 0
			MaxN = SQL
			StepValue = 1
		End If

		LastID = cCur(GetData(0,MaxN))
		FirstID = cCur(GetData(0,MinN))
	
		Dim EndwriteQueryString,PageSplictString
		EndwriteQueryString = "?ttsID=3"
	
		PageSplictString = PageSplictString & "<table><tr><td>&nbsp;"
		If FirstID >= MaxRecordID Then
			PageSplictString = PageSplictString & "<font color=999999>首页</font> " & VbCrLf
			PageSplictString = PageSplictString & " <font color=999999>上页</font> " & VbCrLf
		else
			PageSplictString = PageSplictString & "<a href=UploadList.asp" & EndwriteQueryString & "&Start=0>首页</a> " & VbCrLf
			PageSplictString = PageSplictString & " <a href=UploadList.asp" & EndwriteQueryString & "&Start=" & FirstID & "&UpDownPageFlag=1>上页</a> " & VbCrLf
		end if
	
		If LastID <= MinRecordID Then
			PageSplictString = PageSplictString & " <font color=999999>下页</font> " & VbCrLf
			PageSplictString = PageSplictString & " <font color=999999>尾页</font> " & VbCrLf
		else
			PageSplictString = PageSplictString & " <a href=UploadList.asp" & EndwriteQueryString & "&Start=" & LastID & ">下页</a> " & VbCrLf
			PageSplictString = PageSplictString & " <a href=UploadList.asp" & EndwriteQueryString & "&Start=1&UpDownPageFlag=1>尾页</a> " & VbCrLf
		end if
		
		PageSplictString = PageSplictString & "共<b>" & recordCount & "</b>条信息"
		If (recordCount mod DEF_TopicContentMaxListNum)=0 Then
			PageSplictString = PageSplictString & " 计<b>" & clng(recordCount/DEF_TopicContentMaxListNum) & "</b>页"
		Else
			If recordCount>=DEF_TopicContentMaxListNum Then
				PageSplictString = PageSplictString & " 计<b>" & clng(recordCount/DEF_TopicContentMaxListNum)+1 & "</b>页"
			Else
				PageSplictString = PageSplictString & " 计<b>1</b>页"
			End If
		End If
		PageSplictString = PageSplictString & " 每页<b>" & DEF_TopicContentMaxListNum & "</b>条记录"
		PageSplictString = PageSplictString & "</td></tr></table>"
	
	End If

	%>
	
	<script language=javascript>
		function kill(str)
		{
			window.open('../User/DeleteUpload.asp?FileID='+str,'','width=450,height=37,scrollbars=auto,status=no');
		}
	</script>
	<table width="100%" border="0" cellspacing="1" cellpadding="5" bordercolor="#000000">
	  <tbody> 
	  <tr height="19" bgcolor="<%=DEF_BBS_TableHeadColor%>" align=center bgcolor=<%=DEF_BBS_TableHeadColor%> class=TBBG1>
	    <td width=25%><img src=../images/blank.gif width=151 height=3><br>缩略图/下载</td>
	    <td width=25% align=left><img src=<%=DEF_BBS_HomeUrl%>images/null.gif width=2 height=2><br>信息</td>
	    <td width=25%><img src=../images/blank.gif width=1 height=3><br>缩略图/下载</td>
	    <td width=25% align=left><img src=../images/blank.gif width=1 height=3><br>信息</td>
	  </tr>
	<%
	If Num = -1 Then
		response.write "<tr bgcolor=" & DEF_BBS_LightestColor & " class=TBBG9><td colspan=5 height=30>&nbsp; 没有任何上传附件!</td></tr>"
	end if

	Dim TempN,Temp,Temp1
	
	Dim DeleteEnable
	If GetBinarybit(GBL_CHK_UserLimit,11) = 1 and (GetBinarybit(GBL_CHK_UserLimit,10) = 1 or GetBinarybit(GBL_CHK_UserLimit,8) = 1) Then
		DeleteEnable = 1
	Else
		DeleteEnable = 0
	End If

	Temp1 = 0
	if Num <> -1 then
		LastID = GetData(0,ubound(getdata,2))
		for n= MinN to MaxN Step StepValue
			Temp1 = Temp1 + 1
			Response.Write "<tr height=19 bgcolor=" & DEF_BBS_LightestColor & " align=center class=TBBG9>"

			Response.Write "<td>"
                 If GetData(2,n) <> "" Then
                        Temp = inStrRev(GetData(2,n),".")
                        Temp = Mid(GetData(2,n),Temp+1)
                  Else
                        Temp = "file"
                  End If
                  Temp = lcase(Temp)
                  If Temp = "gif" OR Temp = "jpg" OR Temp = "png"  OR Temp = "bmp" Then
                        GetData(5,N) = 0
                  ElseIf Temp = "swf" Then 
                        GetData(5,N) = 1
                  Else
                        GetData(5,N) = 2
                  End If
			If GetData(3,n) <> "" Then
				Response.Write "<a href=""" & DEF_BBS_HomeUrl & DEF_BBS_UploadPhotoUrl & GetData(2,n) & """ target=_blank>"
				Response.Write "<img src=""" & DEF_BBS_HomeUrl & DEF_BBS_UploadPhotoUrl & GetData(3,n) & """ border=0 width=100 height=100>"
				Response.Write "</a>"
			ElseIf GetData(2,n) <> "" and GetData(5,N) = 0 Then
				Response.Write "<a href=""" & DEF_BBS_HomeUrl & DEF_BBS_UploadPhotoUrl & GetData(2,n) & """ target=_blank>"
				Response.Write "<img src=""" & DEF_BBS_HomeUrl & DEF_BBS_UploadPhotoUrl & GetData(2,n) & """ border=0 width=100 height=100>"
				Response.Write "</a>"
			ElseIf GetData(2,n) <> "" and GetData(5,N) = 1 Then
				Response.Write "<a href=""" & DEF_BBS_HomeUrl & DEF_BBS_UploadPhotoUrl & GetData(2,n) & """ target=_blank>全屏播放</a>"
			Else
				Response.Write "<a href=""" & DEF_BBS_HomeUrl & DEF_BBS_UploadPhotoUrl & GetData(2,n) & """>下载</a>"
			End If
			Response.Write "</td><td align=left>"
			
			If isNull(GetData(6,N)) Then
				Response.Write "作者：无"
			Else
				Response.Write "作者：<a href=../user/LookUserInfo.asp?id=" & GetData(1,n) & ">" & htmlencode(GetData(6,n)) & "</a>"
			End If
			Response.Write "<br><img src=../images/blank.gif width=2 height=3><br>时间：" & Left(RestoreTime(GetData(4,n)),16)
			If GetData(2,n) <> "" Then
				Temp = inStrRev(GetData(2,n),".")
				Temp = Mid(GetData(2,n),Temp+1)
			Else
				Temp = "file"
			End If
			Response.Write "<br><img src=../images/blank.gif width=2 height=3><br>类型：<img src=../images/fileType/" & Temp & ".gif align=absbottom width=16>"
			If GetData(5,N) = 0 Then
				Response.Write "图片文件"
			ElseIf GetData(5,N) = 1 Then
				Response.Write "Flash动画"
			Else
				Response.Write "其它文件"
			End If
			
			If GBL_CHK_User = GetData(6,n) or CheckSupervisorUserName = 1 or DeleteEnable = 1 Then
				Response.Write "<br><img src=../images/blank.gif width=2 height=3><br>删除：<a href='javascript:kill(""" & GetData(0,N) & """);'><img src=../images/" & GBL_DefineImage & "clear.gif width=16 border=0 align=absmiddle></a>"
			End If

			Response.Write "</td>"
	
			
			n = n + StepValue
			Temp1 = Temp1 + 1
			If Temp1 > ubound(getdata,2)+1 Then
				Response.Write "<td>&nbsp;</td>"
				Response.Write "<td>&nbsp;</td>"
			Else
				Response.Write "<td>"
                 If GetData(2,n) <> "" Then
                        Temp = inStrRev(GetData(2,n),".")
                        Temp = Mid(GetData(2,n),Temp+1)
                  Else
                        Temp = "file"
                  End If
                  Temp = lcase(Temp)
                  If Temp = "gif" OR Temp = "jpg" OR Temp = "png"  OR Temp = "bmp" Then
                        GetData(5,N) = 0
                  ElseIf Temp = "swf" Then 
                        GetData(5,N) = 1
                  Else
                        GetData(5,N) = 2
                  End If
				If GetData(3,n) <> "" Then
					Response.Write "<a href=""" & DEF_BBS_HomeUrl & DEF_BBS_UploadPhotoUrl & GetData(2,n) & """ target=_blank>"
					Response.Write "<img src=""" & DEF_BBS_HomeUrl & DEF_BBS_UploadPhotoUrl & GetData(3,n) & """ border=0 width=100 height=100>"
					Response.Write "</a>"
				ElseIf GetData(2,n) <> "" and GetData(5,N) = 0 Then
					Response.Write "<a href=""" & DEF_BBS_HomeUrl & DEF_BBS_UploadPhotoUrl & GetData(2,n) & """ target=_blank>"
					Response.Write "<img src=""" & DEF_BBS_HomeUrl & DEF_BBS_UploadPhotoUrl & GetData(2,n) & """ border=0 width=100 height=100>"
					Response.Write "</a>"
				ElseIf GetData(2,n) <> "" and GetData(5,N) = 1 Then
					Response.Write "<a href=""" & DEF_BBS_HomeUrl & DEF_BBS_UploadPhotoUrl & GetData(2,n) & """ target=_blank>全屏播放</a>"
				Else
					Response.Write "<a href=""" & DEF_BBS_HomeUrl & DEF_BBS_UploadPhotoUrl & GetData(2,n) & """>下载</a>"
				End If
				Response.Write "</td><td align=left>"
				
				If isNull(GetData(6,N)) Then
					Response.Write "作者：无"
				Else
					Response.Write "作者：<a href=../user/LookUserInfo.asp?id=" & GetData(1,n) & ">" & htmlencode(GetData(6,n)) & "</a>"
				End If
				Response.Write "<br><img src=../images/blank.gif width=2 height=3><br>时间：" & Left(RestoreTime(GetData(4,n)),16)
				If GetData(2,n) <> "" Then
					Temp = inStrRev(GetData(2,n),".")
					Temp = Mid(GetData(2,n),Temp+1)
				Else
					Temp = "file"
				End If
				Response.Write "<br><img src=../images/blank.gif width=2 height=3><br>类型：<img src=../images/fileType/" & Temp & ".gif align=absbottom width=16>"
				If GetData(5,N) = 0 Then
					Response.Write "图片文件"
				ElseIf GetData(5,N) = 1 Then
					Response.Write "Flash动画"
				Else
					Response.Write "其它文件"
				End If
				
				If GBL_CHK_User = GetData(6,n) or CheckSupervisorUserName = 1 or DeleteEnable = 1 Then
					Response.Write "<br><img src=../images/blank.gif width=2 height=3><br>删除：<a href='javascript:kill(""" & GetData(0,N) & """);'><img src=../images/" & GBL_DefineImage & "clear.gif width=16 border=0 align=absmiddle></a>"
				End If
	
				Response.Write "</td>"
			End If
			Response.Write "</tr>" & VbCrLf
		next
	End If
	If PageSplictString<>"" Then Response.Write "<tr bgcolor=" & DEF_BBS_TableHeadColor & " class=TBBG1><td colspan=4>" & PageSplictString & "</td></tr>"
	%>
	      </table><%

End Function

Main
%>