?? lbbs_pic v1.02.asp
字號:
exit for
elseif c>Int(c_MaxPerPage)*(CurrentPage-1) then
strFileType=lcase(mid(theFile.Name,instrrev(theFile.Name,".")+1))
If instr(LCase(c_PicType),strFileType)>0 Then
%>
<td>
<table width="100%" height="100%" border="0" cellpadding="0">
<tr>
<td align="center" width="<%=c_picwidth%>" height="<%=c_picheight+10%>" class="style1">
<%
response.write "<a href='" & UploadDir & theFile.Name & "' target='_blank'><img src='" & UploadDir & theFile.Name & "' alt='[文件]"&theFile.Name&Chr(10)&"[大小]"&round(theFile.size/1024)&"K "&Chr(10)&"[類型]"&theFile.type&"' border='0' onmouseover=""this.style.cursor='hand';"" onload='javascript:DrawImage(this);' width="&c_picwidth&" height="&c_picheight&"></a>"
%>
</td>
</tr>
<%If Session("lbbs_pic_UserName")=c_admin_name And Session("lbbs_pic_password")=c_admin_password Then
%>
<tr>
<td><input name="FileName" type="checkbox" id="FileName" value="<%=theFile.Name%>" onclick="unselectall()">選中 <a href="<%=JoinChar(c_strFileName)%>Action=Del&FileName=<%=theFile.Name%>" onclick="return confirm('你真的要刪除嗎!')">單個刪除</a></td>
</tr>
<%End if%>
</table>
</td>
<%
Else
FileCount=FileCount-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_UserName")=c_admin_name And Session("lbbs_pic_password")=c_admin_password 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="UploadDir" type="hidden" id="UploadDir" value="<%=left(UploadDir,len(UploadDir)-1)%>">
<input type="submit" name="Submit" value="刪除選中的文件">
<!--<input type="submit" name="Submit2" value="刪除當前目錄所有文件" onClick="document.myform.Action.value='DelAll';">-->
</td>
</tr>
</table>
<%end if%>
</td></tr></table>
<%
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><span lang="zh-cn"><b>管理登錄</b></span> <A class='style4' HREF="<%=strFileName%>">[回首頁]</A></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")=""
response.redirect (strFileName)
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 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(UploadDir & 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(UploadDir & whichfile))
thisfile.Delete True
end if
end if
Response.Write("<script>alert(""所選文件刪除成功"");location.href='"&c_strFileName&"';</script>")
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_strFileName&"';</script>")
end Sub
'---------------------------------------
'---------------------------------------
'管理設置
Sub admin()
Call admincheck() '登錄檢測
%>
<form method="POST" action="?action=adminsave" name="F" onSubmit="return check()">
<table border="0" width="100%" class="border">
<tr>
<td width="220" align="right"> </td>
<td><span lang="zh-cn"><b>參數設置</b></span> <A class='style4' HREF="<%=strFileName%>">[回首頁]</A> </td>
</tr>
<tr>
<td width="220" align="right"> </td>
<td> </td>
</tr>
<tr>
<td width="220" align="right"><span lang="zh-cn">登錄用戶名?。?lt;/span></td>
<td height="21"><input type="text" name="username" size="20" value="<%=c_admin_name%>"></td>
</tr>
<tr>
<td width="220" align="right">登錄密碼 ?。?lt;/td>
<td><input type="password" name="password" size="20"> 留空表示不作修改。</td>
</tr>
<tr>
<td width="220" align="right">再次確認密碼:</td>
<td><input type="password" name="password_again" size="20"></td>
</tr>
<tr>
<td width="220" align="right">網站首頁鏈接名稱:</td>
<td><input type="text" name="HomeName" size="30" value="<%=c_HomeName%>">(空值則不顯示)</td>
</tr>
<tr>
<td width="220" align="right">網站首頁鏈接地址:</td>
<td><input type="text" name="HomeUrl" size="30" value="<%=c_HomeUrl%>"></td>
</tr>
<tr>
<td width="220" align="right">標題名:</td>
<td><input type="text" name="title" size="30" value="<%=c_title%>"></td>
</tr>
<tr>
<td width="220" align="right">圖片所在文件夾:</td>
<td><input type="text" name="UploadDirg" size="30" value="<%=c_UploadDirg%>"></td>
</tr>
<tr>
<td width="220" align="right">圖片類型 :</td>
<td><input type="text" name="PicType" size="30" value="<%=c_PicType%>">(使用|將圖片格式分開)</td>
</tr>
<tr>
<td width="220" align="right">左則當前目錄下文件:</td>
<td><INPUT TYPE="radio" value="是" NAME="filelb" <%If c_filelb="YES" Then response.write"checked"%>>顯示 <INPUT TYPE="radio" value="否" NAME="filelb" <%If c_filelb<>"YES" Then response.write"checked"%>>不顯示 </td>
</tr>
<tr>
<td width="220" align="right">定義功能:</td>
<td><INPUT TYPE="radio" value="是" NAME="cook" <%If c_cook="YES" Then response.write"checked"%>>顯示 <INPUT TYPE="radio" value="否" NAME="cook" <%If c_cook<>"YES" Then response.write"checked"%>>不顯示</td>
</tr>
<tr>
<td width="220" align="right">每頁顯示圖片數:</td>
<td><input type="text" name="MaxPerPage" size="5" value="<%=con_MaxPerPage%>"></td>
</tr>
<tr>
<td width="220" align="right">每行顯示圖片數:</td>
<td><input type="text" name="Page" size="5" value="<%=con_Page%>"></td>
</tr>
<tr>
<td width="220" align="right">圖片縮圖寬度:</td>
<td><input type="text" name="picwidth" size="5" value="<%=con_picwidth%>"></td>
</tr>
<tr>
<td width="220" align="right">圖片縮圖高度:</td>
<td><input type="text" name="picheight" size="5" value="<%=con_picheight%>"></td>
</tr>
<tr>
<td width="220" align="right"></td>
<td> </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>
<script>
function check()
{
if (document.F.password.value!="" @@ document.F.password.value!=document.F.password_again.value) {
alert("兩次輸入的密碼不相同。請重設。");
return false;
}
return true;
}
</script>
<%
End Sub
'-----------------------------------------
'保存參數設置
Sub adminsave()
Call admincheck() '登錄檢測
dim fso,hf,hf2
Dim n_adminname,n_adminpassword,n_HomeName,n_HomeUrl,n_title,n_UploadDirg,n_PicType,n_filelb,n_cook
Dim n_MaxPerPage,n_Page,n_picwidth,n_picheight
If trim(Request.form("username"))<>"" then
n_admin_name = chr(34) & trim(Request.form("username"))& chr(34)
Session("lbbs_pic_UserName")=trim(Request.form("username"))
Else
n_admin_name = chr(34) &c_admin_name &chr(34)
End If
If trim(Request.form("password"))<>"" then
n_admin_password = chr(34) & md5(trim(Request.form("password")))& chr(34)
Session("lbbs_pic_password")=md5(trim(Request.form("password")))
Else
n_admin_password = chr(34) &c_admin_password &chr(34)
End If
n_HomeName = chr(34) & trim(Request("HomeName"))& chr(34)
n_HomeUrl = chr(34) & trim(Request("HomeUrl"))& chr(34)
n_title = chr(34) & trim(Request("title"))& chr(34)
n_UploadDirg = chr(34) & trim(Request("UploadDirg"))& chr(34)
n_PicType = chr(34) & trim(Request("PicType"))& chr(34)
n_filelb = chr(34) & trim(Request("filelb"))& chr(34)
n_cook = chr(34) & trim(Request("cook"))& chr(34)
c_filelb = Replace(c_filelb,"YES","是")
c_cook = Replace(c_cook,"YES","是")
n_MaxPerPage = trim(Request("MaxPerPage"))
n_Page = trim(Request("Page"))
n_picwidth = trim(Request("picwidth"))
n_picheight = trim(Request("picheight"))
set fso=Server.CreateObject("Scripting.FileSystemObject")
set hf2=fso.OpenTextFile(Server.mappath(strFileName),1)
if Not hf2.atendofstream Then
all = hf2.readALL
all=Replace(all,"c_admin_name="&chr(34) & c_admin_name & chr(34) &"","c_admin_name="& n_admin_name & "")
all=Replace(all,"c_admin_password="& chr(34) &c_admin_password & chr(34) &"","c_admin_password="& n_admin_password & "")
all=Replace(all,"c_HomeName="& chr(34) &c_HomeName & chr(34) &"","c_HomeName="& n_HomeName & "")
all=Replace(all,"c_HomeUrl="&chr(34) & c_HomeUrl &chr(34) & "","c_HomeUrl="& n_HomeUrl & "")
all=Replace(all,"c_title="&chr(34) & c_title &chr(34) & "","c_title="& n_title & "")
all=Replace(all,"c_UploadDirg="&chr(34) & c_UploadDirg &chr(34) & "","c_UploadDirg="& n_UploadDirg & "")
all=Replace(all,"c_PicType="&chr(34) & c_PicType &chr(34) & "","c_PicType="& n_PicType & "")
all=Replace(all,"c_cook="&chr(34) & c_cook &chr(34) & "","c_cook="& n_cook & "")
all=Replace(all,"c_filelb="&chr(34) & c_filelb &chr(34) & "","c_filelb="& n_filelb & "")
all=Replace(all,"con_MaxPerPage="& con_MaxPerPage & "","con_MaxPerPage="& n_MaxPerPage & "")
all=Replace(all,"con_Page="& con_Page & "","con_Page="& n_Page & "")
all=Replace(all,"con_picwidth="& con_picwidth & "","con_picwidth="& n_picwidth & "")
all=Replace(all,"con_picheight="& con_picheight & "","con_picheight="& n_picheight & "")
set hf=fso.CreateTextFile(Server.mappath(strFileName),true)
hf.write all
hf.close
End If
hf2.close
set hf=Nothing
set hf2=Nothing
set fso=Nothing
Response.write "<script language='javascript'>alert('設置成功!');location.href='?action=admin';</script>"
response.end
End Sub
'------------------------------------------------
'系統版本信息
response.write "<CENTER>"
response.write "| <A HREF='"&strFileName&"'>回首頁 </A> | "
response.write "<A HREF='?action=admin' class='style4'>設置管理</A> | "
If Session("lbbs_pic_UserName")=c_admin_name And Session("lbbs_pic_password")=c_admin_password Then
response.write "<A HREF='?action=logout' class='style4'>退出</A> | "
End if
response.write " Powered by <a title='樂學LBBS無限級目錄圖片直讀系統 "&c_poweredby&chr(10)&"http://www.learn365.cn/' target='_blank' href='http://www.learn365.cn/'><strong>LBBS_pic</strong> "&c_poweredby&"</a> "
dim endtime:endtime=timer()
if isempty(starttime) then
response.write "沒有程序被執行"
else
if cstr(FormatNumber((endtime-starttime)*1000,3))=".000" then
response.write "沒有程序被執行"
else
response.write FormatNumber((endtime-starttime)*1000,3)&"毫秒"
end if
end if
response.write"</CENTER>"
%>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -