?? lbbs_pic v1.0.asp
字號:
<%
'**************************************
'** LBBS_pic.asp
'**
'** 文件說明:樂學LBBS無限級目錄圖片直讀系統(tǒng)V1.0(ASP)
'** 創(chuàng)建日期:2008-04-30
'** 修改日期:2008-04-30
'** 網(wǎng) 站:http://www.learn365.cn/
'** 作 者:CYC
'**************************************
'系統(tǒng)變量
Dim c_HomeName,c_HomeUrl,c_title,c_filelb,c_cook
dim c_strFileName,cPicType,Action,totalPut,CurrentPage,TotalPages,upforder2
dim UploadDir,TruePath,fso,theFolder,theFile,thisfile,FileCount,TotalSize,TotalSize_Page
dim strFileType,sqlup,rsup,strFiles,iij,strDirName,c_strFileName2,c_UploadDirg
dim forder,upforder,action_cook,c_MaxPerPage,con_MaxPerPage,cook_MaxPerPage,cook_MaxPerPage01
dim c_Page,con_Page,cook_Page,cook_Page01,c_picwidth,con_picwidth,cook_picwidth,cook_picwidth01
dim c_picheight,con_picheight,cook_picheight,cook_picheight01
dim starttime:starttime = timer()
dim c_poweredby:c_poweredby =" V1.0" '系統(tǒng)版本號
'============參數(shù)設(shè)置==========================================
c_HomeName = "<< 返回首頁" '網(wǎng)站首頁鏈接名稱(空值則不顯示)
c_HomeUrl = "http://www.learn365.cn/" '網(wǎng)站首頁鏈接地址
c_title = "樂學LBBS圖片庫" '標題名
c_c_filelb = "是" '左則是否顯示當前目錄下文件。(是:顯示,否則不顯示)
c_cook = "是" '是否顯示并允許使用自定義功能。(是:可用,否則不可用)
c_UploadDirg = "lbbs_pic" '圖片所在文件夾("../"表示上一層,"./"表示當前)
con_MaxPerPage = 20 '每頁顯示圖片數(shù)
con_Page = 5 '每行顯示圖片數(shù)
con_picwidth = 140 '圖片縮圖寬度
con_picheight = 120 '圖片縮圖高度
'=============================================================
UploadDir =c_UploadDirg
If UploadDir = "" Then UploadDir="./"
if right(UploadDir,1)<>"/" or right(UploadDir,1)<>"\" then
UploadDir=UploadDir & "/"
End if
forder=request("forder")
if forder<>"" then
if right(forder,1)<>"/" then
forder=forder & "/"
End If
UploadDir=UploadDir&forder
end If
if instr(forder,"/")>0 then
upforder=left(forder,instrrev(forder,"/")-1) 'upforder當前目錄去末尾的/
end If
if instr(upforder,"/")>0 then
upforder2=left(upforder,instrrev(upforder,"/")-1) 'upforder2上一層目錄
end If
TruePath=Server.MapPath(UploadDir)
if upforder2<>"" then
TruePath2=Server.MapPath(upforder2)
end If
c_strFileName=Request.ServerVariables("script_name")
If forder = "" Then
c_strFileName = c_strFileName
c_strFileName2 = c_strFileName
Else
c_strFileName2 = c_strFileName
c_strFileName = c_strFileName &"?forder="&forder&"&"
End If
Action=trim(Request("Action"))
if trim(request("page"))<>"" then
currentPage=cint(request("page"))
else
currentPage=1
end if
'-----------------------------------
'自定義每頁圖片數(shù)、行數(shù)、寬度、高度
If c_cook = "是" then
action_cook = request("action_cook")
Select Case action_cook
Case "cookies"
cook_MaxPerPage = trim(replace(request("cook_MaxPerPage")," ",""))
cook_Page = trim(replace(request("cook_Page")," ",""))
cook_picwidth = trim(replace(request("cook_picwidth")," ",""))
cook_picheight = trim(replace(request("cook_picheight")," ",""))
if not(IsNumeric(cook_MaxPerPage)) then
Response.write "<script language='javascript'>alert('第頁圖片數(shù):你輸入的不是純數(shù)字,請輸入1-30之間的數(shù)字!');history.go(-1);</script>"
Response.end
elseif cook_MaxPerPage<1 or cook_MaxPerPage>30 then
Response.write "<script language='javascript'>alert('第頁圖片數(shù):請輸入1-30之間的數(shù)字!');history.go(-1);</script>"
Response.end
end if
if not(IsNumeric(cook_Page)) then
Response.write "<script language='javascript'>alert('每行圖片數(shù):你輸入的不是純數(shù)字,請輸入正確數(shù)字!');history.go(-1);</script>"
Response.end
elseif cook_Page<1 or cook_Page>10 then
Response.write "<script language='javascript'>alert('每行圖片數(shù):請輸入1-10之間的數(shù)字!');history.go(-1);</script>"
Response.end
end if
if not(IsNumeric(cook_picwidth)) then
Response.write "<script language='javascript'>alert('圖片寬度:你輸入的不是純數(shù)字,請輸入正確數(shù)字!');history.go(-1);</script>"
Response.end
elseif cook_picwidth<20 or cook_Page>800 then
Response.write "<script language='javascript'>alert('圖片寬度:請輸入20-800之間的數(shù)字!');history.go(-1);</script>"
Response.end
end if
if not(IsNumeric(cook_picheight)) then
Response.write "<script language='javascript'>alert('圖片高度:你輸入的不是純數(shù)字,請輸入正確數(shù)字!');history.go(-1);</script>"
Response.end
elseif cook_picheight<20 or cook_picheight>800 then
Response.write "<script language='javascript'>alert('圖片高度:請輸入20-800之間的數(shù)字!');history.go(-1);</script>"
Response.end
end If
Response.cookies("cycpic")("cook_MaxPerPage") = cook_MaxPerPage
Response.cookies("cycpic")("cook_Page") = cook_Page
Response.cookies("cycpic")("cook_picwidth") = cook_picwidth
Response.cookies("cycpic")("cook_picheight") = cook_picheight
if cook_MaxPerPage<>"" and cook_Page<>"" and cook_picwidth<>"" and cook_picheight<>"" then
Select Case Request.Form("CookieTime")
Case 1
Response.cookies("cycpic").Expires=Date+1
Case 2
Response.cookies("cycpic").Expires=Date+7
Case 3
Response.cookies("cycpic").Expires=Date+31
Case 4
Response.cookies("cycpic").Expires=Date+365
End Select
end If
Case "con"
Response.cookies("cycpic")("cook_MaxPerPage") = con_MaxPerPage
Response.cookies("cycpic")("cook_Page") = con_Page
Response.cookies("cycpic")("cook_picwidth") = con_picwidth
Response.cookies("cycpic")("cook_picheight") = con_picheight
End Select
End If
'---------------------------------
cook_MaxPerPage = Request.cookies("cycpic")("cook_MaxPerPage")
cook_Page = Request.cookies("cycpic")("cook_Page")
cook_picwidth = Request.cookies("cycpic")("cook_picwidth")
cook_picheight = Request.cookies("cycpic")("cook_picheight")
if cook_MaxPerPage="" then c_MaxPerPage = con_MaxPerPage else c_MaxPerPage = cook_MaxPerPage
if cook_Page="" then c_Page = con_Page else c_Page = cook_Page
if cook_picwidth="" then c_picwidth = con_picwidth else c_picwidth = cook_picwidth
if cook_picheight="" then c_picheight = con_picheight else c_picheight = cook_picheight
%>
</body>
</html>
<%
'------------------------------------------------
'上一頁、下一頁鏈接
sub showpage(sfilename,totalnumber,c_MaxPerPage)
dim n, i,strTemp
c_MaxPerPage=CInt(c_MaxPerPage)
if totalnumber mod c_MaxPerPage=0 then
n= totalnumber \ c_MaxPerPage
else
n= totalnumber \ c_MaxPerPage+1
end If
If totalnumber=0 Then
Exit Sub
End if
strTemp= "<table align='center'><form name='showpages' method='Post' action='" & sfilename & "'><tr><td>"
strTemp=strTemp & "當前目錄下共 <b>" & totalnumber & "</b> 個文件,占用 <b>" & TotalSize\1024 & "</b> K "
sfilename=JoinChar(sfilename)
if CurrentPage<2 then
strTemp=strTemp & "首頁 上一頁 "
else
strTemp=strTemp & "<a title='首頁' href='" & sfilename & "page=1'>首頁</a> "
strTemp=strTemp & "<a title='上一頁' href='" & sfilename & "page=" & (CurrentPage-1) & "'>上一頁</a> "
end if
if n-currentpage<1 then
strTemp=strTemp & "下一頁 尾頁"
else
strTemp=strTemp & "<a title='下一頁' href='" & sfilename & "page=" & (CurrentPage+1) & "'>下一頁</a> "
strTemp=strTemp & "<a title='尾頁' href='" & sfilename & "page=" & n & "'>尾頁</a>"
end if
strTemp=strTemp & " 頁次:<strong><font color=red>" & CurrentPage & "</font>/" & n & "</strong>頁 "
strTemp=strTemp & " <b>" & c_MaxPerPage & "</b>" & "個文件/頁"
strTemp=strTemp & " 轉(zhuǎn)到:<select name='page' size='1' onchange='javascript:submit()'>"
for iij = 1 to n
strTemp=strTemp & "<option value='" & iij & "'"
if cint(CurrentPage)=cint(iij) then strTemp=strTemp & " selected "
strTemp=strTemp & ">第" & iij & "頁</option>"
next
strTemp=strTemp & "</select>"
strTemp=strTemp & "</td></tr></form></table>"
response.write strTemp
end sub
'------------------------------------------------
'------------------------------------------------
Sub ShowObjectInstalled(strObjName)
If IsObjInstalled(strObjName) Then
Response.Write "<font color='#99CCFF'><b>√</b></font>"
Else
Response.Write "<font color='red'><b>×</b>(無)</font>"
End If
End Sub
'------------------------------------------------
'------------------------------------------------
'函數(shù)名:IsObjInstalled 檢查組件是否已經(jīng)安裝(參 數(shù):strClassString ----組件名)
'返回值:True ----已經(jīng)安裝 False ----沒有安裝
Function IsObjInstalled(strClassString)
On Error Resume Next
IsObjInstalled = False
Err = 0
Dim xTestObj
Set xTestObj = Server.CreateObject(strClassString)
If 0 = Err Then IsObjInstalled = True
Set xTestObj = Nothing
Err = 0
End Function
'------------------------------------------------
'函數(shù)名:JoinChar
'作 用:向地址中加入 ? 或 &
'參 數(shù):strUrl ----網(wǎng)址
'返回值:加了 ? 或 & 的網(wǎng)址
function JoinChar(strUrl)
if strUrl="" then
JoinChar=""
exit function
end if
if InStr(strUrl,"?")<len(strUrl) then
if InStr(strUrl,"?")>1 then
if InStr(strUrl,"&")<len(strUrl) then
JoinChar=strUrl & "&"
else
JoinChar=strUrl
end if
else
JoinChar=strUrl & "?"
end if
else
JoinChar=strUrl
end if
end Function
'------------------------------------------------
'------------------------------------------
'目錄存在時顯示此目錄下的所有子目錄
Function ShowFolderList(folderspec)
On Error Resume Next
Dim f, f1, fc, s ,fs,jj
set fs=CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(folderspec)
s = s &"<BR><B>當前目錄下文件夾:</B><br>"
Set fc = f.SubFolders
jj=1
For Each f1 in fc
s = s & "<a title='"&f1.name&"' href='?forder="&forder&f1.name&"'><img border='0' src='images/folder.gif' width='16' height='16'>"
s = s &"<font color='#0066FF'>"&jj&"."& f1.name&"</font></a><br>"
jj=jj+1
Next
If jj-1=0 then s = s &"(無)<BR>"
If c_c_filelb = "是" then
s = s &"<BR><B>當前目錄下文件:</B>"
'讀取該文件夾下所有文件
Set fc2 = f.Files
i=1
For Each f1 in fc2
Filenames= f1.name
FileSize= f1.Size
If Len(Filenames)>20 Then Filenames=Left(Filenames,20)&".."
s = s &"<BR><a href='" & UploadDir & f1.name & "' target='_blank' alt='[文件]"&f1.name &Chr(10)&"[大小]"&round(FileSize\1024)&"K'>"
s = s &"<img border='0' src='images/file.gif' width='16' height='16'>"
s = s &"<font color='#0066FF'>"&i&".</font>"&Filenames&"</a>"
i=i+1
Next
If i-1=0 then s = s &"<BR>(無)"
End if
ShowFolderList = s
End Function
'-------------------------------------------
'===========================================
function strvalue(str,lennum) '截取字符串,支持中英文混用
dim p_num,x
dim i
if strlen(str)<=lennum then
strvalue=str
else
p_num=0
x=0
do while not p_num > lennum-2
x=x+1
if asc(mid(str,x,1))<0 then
p_num=int(p_num) + 2
else
p_num=int(p_num) + 1
end if
strvalue=left(trim(str),x)&"…"
loop
end if
end function
'===========================================
%>
<html>
<head>
<title><%=c_title%></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<STYLE>
BODY {
FONT-SIZE: 9pt; BACKGROUND: #ffffff; LINE-HEIGHT: 150%; FONT-FAMILY: "宋體";TEXT-DECORATION: none
}
TD {
FONT-SIZE: 9pt; FONT-FAMILY: "宋體"
}
INPUT {
FONT-SIZE: 9pt; HEIGHT: 20px
}
BUTTON {
FONT-SIZE: 9pt; HEIGHT: 20px
}
SELECT {
FONT-SIZE: 9pt; HEIGHT: 20px
}
A {
COLOR: #000000; TEXT-DECORATION: none
}
.title {
}
.border {
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -