<!-- #include file=../../inc/BBSsetup.asp -->
<!-- #include file=../../inc/Upload_Setup.asp -->
<!-- #include file=../../inc/Board_Popfun.asp -->
<%
'论坛最新图片调用.05-06-20 BY :wensui.com
Dim HomeUrl
HomeUrl = "http://"&Request.ServerVariables("server_name")
If Request.ServerVariables("SERVER_PORT") <> "80" Then HomeUrl = HomeUrl & ":" & Request.ServerVariables("SERVER_PORT")
HomeUrl = Lcase(HomeUrl & Request.Servervariables("SCRIPT_NAME"))
HomeUrl = Replace(HomeUrl,"other/article/showbbspic.asp","")

initDatabase

DEF_BBS_HomeUrl = "../../"

	Dim Rs,SQL,NewNum,pic_ListNum,SQLendString,n,width,heihgt
        pic_ListNum = Left(Request.QueryString("ListNum"),14)
	If isNumeric(pic_ListNum) = False or pic_ListNum = "" Then pic_ListNum = 1
        width = Left(Request.QueryString("width"),14)
        heihgt = Left(Request.QueryString("heihgt"),14)
	If isNumeric(width) = False or width = "" Then width = 100
	If isNumeric(heihgt) = False or heihgt = "" Then heihgt = 100
	SQLendString = " Order by ID DESC"
	
	Dim MaxRecordID,MinRecordID
	MaxRecordID = 0

	SQL = "select Max(id) from LeadBBS_Upload"
	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
	
   If MaxRecordID > 0 Then 
	If pic_ListNum > MaxRecordID Then pic_ListNum = MaxRecordID
	SQL = "select TOP " & pic_ListNum & " ID,UserID,PhotoDir,SPhotoDir,NdateTime,FileType from LeadBBS_Upload where PhotoDir like '%.gif' OR PhotoDir like '%.jpg' OR PhotoDir like '%.png'  OR PhotoDir like '%.bmp' " & 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
	if Num <> -1 then
		for n= 0 to pic_ListNum-1 
				Response.Write "document.write("""
				Response.Write "<img src=" & HomeUrl & DEF_BBS_UploadPhotoUrl & replace(GetData(2,n),"\","/") & " border=0 width="& width &" height="& heihgt &">"
				Response.Write """);" & VbCrLf
		next
	End If
  End If
closeDataBase
%>