📄 lbbs_pic v1.05.asp
字号:
'========================================
'========================================
'浏览图片
Sub showpic()
%>
<tr class="tdbg">
<td height="24" style="width: 238px">
<a title='返回总目录' href='<%=picurl%>'><img alt='' border='0' src='images/alllist.gif' width='16' height='16'>总目录</a><br>
<%if forder<>"" then response.write"<a title='↑向上…上层目录' href='?forder="&upforder&"'><img alt='' border='0' src='images/up.gif' width='16' height='16'>返回上层目录</a>"%>
</td>
<td height="24" style="width: 800px; height: 12px;">
转到目录:<select size="1" name="forder" onchange="javascript:window.location='?forder='+this.options[this.selectedIndex].value;">
<option value="" style="COLOR: #808000" selected>--请选择图片目录--</option>
<option value="">--总目录--</option>
<% call bl(0,"◆",c_UploadDirg) '遍历站点所有文件夹作为下拉列表 %>
</select>
<BR>当前位置:<font color='#0000ff'><%=replace(replace(forder,".",""),c_UploadDirg,"总目录")%></font>
</td>
</tr>
<tr class="tdbg">
<td height="30" style="width: 238px;" valign="top">
<% Response.write (ShowFolderList(TruePath))'左侧目录文件列表 %>
</td>
<td height="30" style="height: 15px; width: 800px;" valign="top">
<% call main()'图片列表 %>
</td>
</tr>
<%
End Sub
'========================================
'========================================
'遍历站点所有文件夹作为下拉列表
'i全角的空格( )数
'sty符号
'strpath文件夹路径
function bl(i,sty,strpath)
Dim objfolder,objfile,newstrpath,picFile,pi,pi2,picExt,objsubfolder
set objfolder=fso.getfolder(server.mappath(strpath))
for each objsubfolder in objfolder.subfolders
pi=0
pi2=0
For Each picFile In objsubfolder.Files
picExt=LCase(Right(Trim(picFile.name),3))
If instr(LCase(c_PicType),picExt)>0 Then
pi=pi+1
ElseIf instr(LCase(c_TxtType),picExt)>0 then
pi2=pi2+1
End If
Next
If CInt(pi)>0 Then pi=" "&pi&"P" Else pi=""
If CInt(pi2)>0 Then pi2=" "&pi2&"F" Else pi2=""
Response.write ("<option value='" & strpath & "/"& objsubfolder.name & "'")
if forder=strpath& "/"& objsubfolder.name then
Response.write (" style='COLOR: #0000ff' selected ")
end If
Response.write (">"&string(i," ")&""& sty & objsubfolder.name & pi & pi2 &"</option>")
i=i+1
call bl(i+1," ",strpath & "/"& objsubfolder.name)
i=i-1
next
End function
'========================================
'========================================
'图片列表
sub main()
Dim picExe1
if fso.FolderExists(TruePath)=False then
response.write "找不到文件夹!可能是配置有误!"
exit sub
end if
FileCount=0
TotalSize=0
Set theFolder=fso.GetFolder(TruePath)
For Each theFile In theFolder.Files
picExe1=LCase(Right(Trim(theFile.name),3))
If instr(LCase(c_PicType),picExe1)>0 Or instr(LCase(c_TxtType),picExe1)>0 Then
FileCount=FileCount+1
TotalSize=TotalSize+theFile.Size
End if
next
totalPut=FileCount
if picPage<1 then
picPage=1
end if
if (picPage-1)*c_MaxPerPage>totalput then
if (totalPut mod c_MaxPerPage)=0 then
picPage= totalPut \ c_MaxPerPage
else
picPage= totalPut \ c_MaxPerPage + 1
end if
end if
if picPage=1 then
call showContent()
Call showpage(c_picurl,totalput,c_MaxPerPage)
else
if (picPage-1)*c_MaxPerPage<totalPut then
call showContent()
call showpage(c_picurl,totalput,c_MaxPerPage)
else
picPage=1
call showContent()
call showpage(c_picurl,totalput,c_MaxPerPage)
end if
end if
end sub
sub showContent()
dim c
FileCount=0
TotalSize_Page=0
%>
<table width='100%' border="0" cellpadding="0" cellspacing="0">
<%
'--自定义开始--
If c_cook = "YES" Then
%>
<form method="POST" action="<%=JoinChar(c_picurl)%>action_cook=cookies">
<tr class="tdbg">
<td height="30" width="756">
<p align="left">
自定义:<span class="style3">每页图片数</span><input type="text" name="cook_MaxPerPage" size="5" value="<%=c_MaxPerPage%>" style="border: 1px solid #808000; width: 25px;" title="输入1-30之间的数字!"><span class="style3">
每行图片数</span><input type="text" name="cook_Page" size="12" value="<%=c_Page%>" style="border: 1px solid #808000; width: 21px;" title="输入1-10之间的数字!">
图片宽<input type="text" name="cook_picwidth" size="10" value="<%=c_picwidth%>" style="border: 1px solid #808000; width: 42px;" title="输入20-800之间的数字!">
高<input type="text" name="cook_picheight" size="10" value="<%=c_picheight%>" style="border: 1px solid #808000; width: 39px;" title="输入20-800之间的数字!"></font>
<select size="1" name="CookieTime" class="input">
<option selected value="0">是否记忆</option>
<option value="1">记忆一天</option>
<option value="2">记忆一周</option>
<option value="3">记忆一月</option>
<option value="4">记忆一年</option>
</select>
<input type="submit" value="提交" name="B1">
<input type="button" value="恢复默认值" name="B3" onClick="window.location.href='<%=JoinChar(c_picurl)%>action_cook=con'">
</p>
</td>
</tr>
</form>
</table>
<%End If
'--自定义结束--
call showpage(c_picurl,totalput,c_MaxPerPage) '分页链接
%>
<table width='100%' border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<form name="myform" method="Post" action="?forder=<%=forder%>&page=<%=picPage%>" onsubmit="return confirm('删除后无法恢复,你确定要删除选中的文件吗?');">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="3" class="border">
<tr class="tdbg">
<%
For Each theFile In theFolder.Files
c=c+1
if FileCount>=Int(c_MaxPerPage) then
exit for
elseif c>Int(c_MaxPerPage)*(picPage-1) then
'strFileType=lcase(mid(theFile.Name,instrrev(theFile.Name,".")+1))
FileExt = fso.GetExtensionName(theFile.Name) '获得文件的扩展名
if FileExt<>"" then
FileExt = Lcase(FileExt)
end if
If Session("lbbs_pic_delpic")="delpic" Then '点击“删除图片”时背景色样式
picbgclass="pic_delstyle"
Else
picbgclass="pic_showstyle"
end if
If instr(LCase(c_PicType),FileExt)>0 Or instr(LCase(c_TxtType),FileExt)>0 Then
%>
<td>
<table width="100%" height="100%" border="0" cellpadding="0">
<tr>
<td align="center" width="<%=c_picwidth%>" height="<%=c_picheight+10%>" class="<%=picbgclass%>">
<%If instr(LCase(c_PicType),FileExt)>0 then
response.write "<a href='"&Server.URLEncode(forder &"\"& theFile.Name)&"' target='_blank'><img src='"&Server.URLEncode(forder &"\"& theFile.Name)&"' alt='[文件] "&theFile.Name&Chr(10)&"[大小] "&SizeTo(theFile.size)&"' border='0' onmouseover=""this.style.cursor='hand';"" onload='javascript:DrawImage(this);' width="&c_picwidth&" height="&c_picheight&"></a>"
ElseIf instr(LCase(c_TxtType),FileExt)>0 then
response.write "<p align='left'><a href='"&Server.URLEncode(forder &"\"& theFile.Name)&"' target='_blank'><img src='images/" & FileExt & ".gif' border='0' onmouseover=""this.style.cursor='hand';"" class='imgmid' onerror=""this.src='images/noknow.gif';""><font color='#0066FF' style='font-size: 11pt;'>"&theFile.Name&"</font></a>"
End if
%>
</td>
</tr>
<tr>
<td align="left">
<%
If c_shownane="YES" Then'显示图片文件名
response.write "<font color='#0066FF'>"&c&".</font>"
If instr(LCase(c_PicType),FileExt)>0 Then
response.write theFile.Name&" ["&SizeTo(theFile.size)&"]"
Else
response.write "["&SizeTo(theFile.size)&"]"
End if
End if
%>
</td>
</tr>
<%If Session("lbbs_pic_delpic")="delpic" Then%>
<tr>
<td><input name="FileName" type="checkbox" id="FileName" value="<%=theFile.Name%>" onclick="unselectall()">选中 <a href="<%=JoinChar(c_picurl)%>Action=Del&page=<%=picPage%>&FileName=<%=theFile.Name%>" onclick="return confirm('删除后无法恢复,你真的要删除吗?')" ><font color='#FF0000'>单个删除</font></a></td>
</tr>
<%End if%>
</table>
</td>
<%
Else
FileCount=FileCount-1
c=c-1
End if
FileCount=FileCount+1
if FileCount mod c_Page=0 then response.write "</td><tr class='tdbg'>"
TotalSize_Page=TotalSize_Page+theFile.Size
end If
Next
%>
</tr>
</table>
<%If Session("lbbs_pic_delpic")="delpic" Then
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="200" height="30"><input name="chkAll" type="checkbox" id="chkAll" onclick=CheckAll(this.form) value="checkbox">
选中本页显示的所有文件</td>
<td><input name="Action" type="hidden" id="Action" value="Del">
<input name="forder" type="hidden" id="forder" value="<%=forder%>">
<input type="submit" name="Submit" value="删除选中的文件">
<!--<input type="submit" name="Submit2" value="删除当前目录所有文件" onClick="document.myform.Action.value='DelAll';">-->
</td>
</tr>
</table>
<BR> <BR>
<%end if%>
</td></tr></table>
<%
end sub
'------------------------------------------------
'---------------------------------------
'删除单个文件或选中文件
sub DelFiles()
Call admincheck() '登录检测
dim whichfile,arrFileName,i,UploadDir2
whichfile=trim(Request("FileName"))
if whichfile="" then exit sub
if instr(whichfile,",")>0 then
arrFileName=split(whichfile,",")
for iij=0 to ubound(arrFileName)
if left(trim(arrFileName(iij)),3)<>"../" and left(trim(arrFileName(iij)),1)<>"/" then
whichfile=server.MapPath(forder &"/"& trim(arrFileName(iij)))
set thisfile=fso.GetFile(whichfile)
thisfile.Delete True
end if
Next
else
if left(whichfile,3)<>"../" and left(whichfile,1)<>"/" then
Set thisfile = fso.GetFile(server.MapPath(forder &"/"& whichfile))
thisfile.Delete True
end if
end If
forder=Replace(forder,"\","/")
Response.Write("<script>alert('所选文件删除成功!');location.href='?forder="&forder&"&page="&picPage&"';</script>")
Response.end
end sub
'删除所有文件
sub DelAll()
Call admincheck() '登录检测
Set theFolder=fso.GetFolder(TruePath)
For Each theFile In theFolder.Files
theFile.Delete True
next
Response.Write("<script>alert(""本目录所有文件删除成功!"");location.href='"&c_picurl&"';</script>")
Response.end
end Sub
'---------------------------------------
'-----------------------------------------
'管理员登录
Sub adminlogin()
%>
<form method="POST" action="?action=logincheck" name="F1">
<table border="0" width="100%" class="border">
<tr>
<td width="220" align="right"> </td>
<td> </td>
</tr>
<tr>
<td width="220" align="right"> </td>
<td><span lang="zh-cn"><b>管理登录</b></span></td>
</tr>
<tr>
<td width="220" align="right"> </td>
<td> </td>
</tr>
<tr>
<td width="220" align="right"><span lang="zh-cn">用户名:</span></td>
<td height="21"><input type="text" name="username" size="20" value=""></td>
</tr>
<tr>
<td width="220" align="right">密 码:</td>
<td><input type="password" name="password" size="20"></td>
</tr>
<tr>
<td width="220" align="right"> </td>
<td><input type="submit" value="提交" name="B1"> <input type="reset" value="重置" name="B2"></td>
</tr>
</table>
</form>
<%
End Sub
'----------------------------------------
'----------------------------------------
'登录
sub logincheck()
If trim(Request.form("username"))<>c_admin_name Then
Response.write "<script language='javascript'>alert('管理用户名不正确!');history.go(-1);</script>"
response.End
Exit Sub
End If
If md5(trim(Request.form("password")))<>c_admin_password Then
Response.write "<script language='javascript'>alert('密码不正确!');history.go(-1);</script>"
response.End
Exit Sub
End If
Session("lbbs_pic_UserName")=trim(Request("username"))
Session("lbbs_pic_password")=md5(trim(Request("password")))
response.redirect ("?action=admin")
response.end
End sub
'----------------------------------------
'----------------------------------------
'退出登录
sub adminlogout()
Session("lbbs_pic_UserName")=""
Session("lbbs_pic_password")=""
Session("lbbs_pic_delpic")=""
response.redirect (picurl)
response.end
End sub
'----------------------------------------
'----------------------------------------
'登录检测
Sub admincheck()
If Session("lbbs_pic_UserName")<>c_admin_name or Session("lbbs_pic_password")<>c_admin_password Then
Response.write "<script language='javascript'>location.href='?action=login';</script>"
response.End
Exit Sub
End If
End Sub
'---------------------------------------
'---------------------------------------
'管理/参数设置
Sub admin()
Call admincheck() '登录检测
%>
<script>
<!--
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -