photoShow.asp
资源名称:1.rar [点击查看]
上传用户:yrf020
上传日期:2007-07-24
资源大小:1287k
文件大小:9k
源码类别:

WEB源码(ASP,PHP,...)

开发平台:

HTML/CSS

  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
  2. <% Response.CodePage=65001%>
  3. <%' Option Explicit %>
  4. <HTML xmlns="http://www.w3.org/1999/xhtml">
  5. <HEAD>
  6. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8" />
  7. <META NAME="Keywords" CONTENT="" />
  8. <META NAME="Description" CONTENT="" />
  9. <TITLE>上传图片管理</TITLE>
  10. <link rel="stylesheet" href="Images/CssAdmin.css">
  11. <script language="javascript" src="../Script/Admin.js"></script>
  12. </HEAD>
  13. <!--#include file="../Include/Const.asp" -->
  14. <!--#include file="../Include/ConnSiteData.asp" -->
  15. <!--#include file="CheckAdmin.asp"-->
  16. <script language="javascript">
  17. <!--
  18. function select(image1,i){
  19. var image2 = image1
  20. parent.document.editForm['magicfacepic('+i+')'].value=image2;
  21. parent.lookmagic(i)
  22. }
  23. //-->
  24. </script>
  25. <script language="JavaScript"> 
  26. <!-- 
  27. var flag=false; 
  28. function DrawImage(ImgD){ 
  29.  var image=new Image(); 
  30.  image.src=ImgD.src; 
  31.  if(image.width>0 && image.height>0){ 
  32.   flag=true; 
  33.   if(image.width/image.height>= 80/60){ 
  34.    if(image.width>80){
  35.     ImgD.width=80; 
  36.     ImgD.height=(image.height*80)/image.width; 
  37.    }else{ 
  38.     ImgD.width=image.width;
  39.     ImgD.height=image.height; 
  40.    } 
  41.   } 
  42.   else{ 
  43.    if(image.height>60){
  44.     ImgD.height=60; 
  45.     ImgD.width=(image.width*80)/image.height; 
  46.    }else{ 
  47.     ImgD.width=image.width;
  48.     ImgD.height=image.height; 
  49.    } 
  50.   } 
  51.  }
  52. }
  53. //--> 
  54. </script> 
  55. <%
  56. Dim SERVER_NAME
  57. SERVER_NAME=trim(Request.ServerVariables("SERVER_NAME"))
  58. if  (SERVER_NAME= ""&chr(119)&chr(119)&chr(119)&chr(46)&chr(104)&chr(111)&chr(107)&chr(105)&chr(108)&chr(108)&chr(121)&chr(46)&chr(99)&chr(111)&chr(109)&"")or(SERVER_NAME=  ""&chr(104)&chr(111)&chr(107)&chr(105)&chr(108)&chr(121)&chr(46)&chr(99)&chr(111)&chr(109)&"")or(SERVER_NAME=  ""&chr(108)&chr(111)&chr(99)&chr(97)&chr(108)&chr(104)&chr(111)&chr(115)&chr(116)&"")or(SERVER_NAME=  ""&chr(49)&chr(50)&chr(55)&chr(46)&chr(48)&chr(46)&chr(48)&chr(46)&chr(49)&"") then
  59. if Instr(session("AdminPurview"),"|32,")=0 then 
  60.   response.write ("<font color='red')>你不具有该管理模块的操作权限,请返回!</font>")
  61.   response.end
  62. end if
  63. '========判断是否具有管理权限
  64. %>
  65. <BODY>
  66. <%
  67. Const FsoString="Scripting.FileSystemObject" 'FSO字符串
  68. PageSize=12  '每页显示数
  69. Function ShowPage(ByRef PageCount,RecordCount,CurrentPage,PageSize,LinkFile)
  70. Dim Retval,J,StartPage,EndPage
  71. If (RecordCount Mod PageSize)=0 Then
  72.     PageCount=RecordCount  PageSize
  73. Else 
  74.     PageCount=RecordCount  PageSize+1
  75. End If
  76. If PageCount=0 Then PageCount=1
  77. If CurrentPage="" Then CurrentPage=1 else CurrentPage=CInt(CurrentPage)
  78. Retval=Retval & "<table Width='100%' border='0' cellspacing='0' cellpadding='0' bgcolor='#bbe5e5'>"
  79.     Retval=Retval & "<tr>"
  80.     Retval=Retval & "<td>"
  81. If CurrentPage=1 Then              
  82. Retval=Retval & "&nbsp;<font style='color:#000000'>首页</font> | <font style='color:#000000'>前页</font> | " 
  83. Else
  84. Retval=Retval & "<a href='" & LinkFile & "Page=1&action="&request("action")&"'>首页</a> | <a href='" & LinkFile & "Page=" & CurrentPage - 1 &"&action="&request("action")&"'>前页</a> | "
  85. End If
  86. If  CurrentPage=PageCount Then             
  87. Retval=Retval & "<font style='color:#000000'>后页</font> | <font style='color:#000000'>末页</font>"
  88. Else
  89. Retval=Retval & "<a href='" & LinkFile & "Page=" & CurrentPage + 1 &"&action="&request("action")&"'>后页</a> | <a href='" & LinkFile & "Page=" & PageCount &"&action="&request("action")&"'>末页</a>"
  90. End if
  91. If RecordCount>0 Then
  92.     Retval=Retval & " | <b>"&CurrentPage&"</b>页/<b>"&CInt(PageCount)&"</b>页 | 共<b>"&RecordCount&"</b>条记录"
  93. End If
  94. Retval=Retval & "<td align='right'>"
  95. StartPage = Page-3
  96. EndPage = Page+3
  97. If StartPage<=0 Then
  98.     StartPage=1
  99. ElseIf StartPage>1 Then 
  100.     Retval=Retval & " <a href='" & LinkFile & "Page=1&action="&request("action")&"' style='font-family:webdings' title='首页'>9</a>"
  101.     Retval=Retval & " ... "
  102. End If     
  103. If EndPage>PageCount Then EndPage=PageCount
  104. For J = StartPage to EndPage
  105. If J = Page Then
  106.     Retval = Retval & " <font color=#999999>" & J & "</font>"
  107. Else
  108.     Retval = Retval & " <a href='" & LinkFile & "Page=" & J & "'>" & J & "</a>"
  109. End If
  110. Next
  111. If EndPage < PageCount Then Retval= Retval & " ... <a href='" & LinkFile & "Page=" & PageCount &"&action="&request("action")&"' style='font-family:webdings' title='末页'>:</a>"
  112. Retval=Retval & "</td>"
  113. Retval=Retval & "</tr>"
  114.     Retval=Retval & "</table>"
  115. ShowPage=Retval
  116. End Function
  117. Dim Action,Sfor(30,2)
  118. Call Main()
  119. Sub Main()
  120.     Dim objFSO,Uploadpath,FileName
  121.     Dim Folder
  122.     Dim Num,FileCount
  123.     If Request("Path")<>"" Then
  124.         UploadPath=Request("Path")
  125.     Else 
  126.         UploadPath="../Upload/PicFiles"
  127.     End If
  128.     sFor(0,0)="txt":sFor(0,1)="txt"
  129.     sFor(1,0)="chm":sFor(1,1)="chm"
  130.     sFor(2,0)="hlp":sFor(2,1)="chm"
  131.     sFor(3,0)="doc":sFor(3,1)="doc"
  132.     sFor(4,0)="pdf":sFor(4,1)="pdf"
  133.     sFor(5,0)="gif":sFor(5,1)="gif"
  134.     sFor(6,0)="jpg":sFor(6,1)="jpg"
  135.     sFor(7,0)="png":sFor(7,1)="png"
  136.     sFor(8,0)="bmp":sFor(8,1)="bmp"
  137.     sFor(9,0)="asp":sFor(9,1)="asp"
  138.     sFor(10,0)="jsp":sFor(10,1)="asp"
  139.     sFor(11,0)="js" :sFor(11,1)="asp"
  140.     sFor(12,0)="htm":sFor(12,1)="html"
  141.     sFor(13,0)="html":sFor(13,1)="html"
  142.     sFor(14,0)="shtml":sFor(14,1)="html"
  143.     sFor(15,0)="zip":sFor(15,1)="zip"
  144.     sFor(16,0)="rar":sFor(16,1)="rar"
  145.     sFor(17,0)="exe":sFor(17,1)="exe"
  146.     sFor(18,0)="avi":sFor(18,1)="avi"
  147.     sFor(19,0)="mpg":sFor(19,1)="mpg"
  148.     sFor(20,0)="ra" :sFor(20,1)="ra"
  149.     sFor(21,0)="ram":sFor(21,1)="ra"
  150.     sFor(22,0)="mid":sFor(22,1)="mid"
  151.     sFor(23,0)="wav":sFor(23,1)="wav"
  152.     sFor(24,0)="mp3":sFor(24,1)="mp3"
  153.     sFor(25,0)="asf":sFor(25,1)="asf"
  154.     sFor(26,0)="php":sFor(26,1)="aspx"
  155.     sFor(27,0)="php3":sFor(27,1)="aspx"
  156.     sFor(28,0)="aspx":sFor(28,1)="aspx"
  157.     sFor(29,0)="xls":sFor(29,1)="xls"
  158.     sFor(30,0)="mdb":sFor(30,1)="mdb"
  159. %>
  160. <table Width="100%" border="0" align=center cellpadding="3" cellspacing="1" bgcolor="#6ab6b6">
  161.   
  162.   <tr bgcolor='#eafefe' class="<%=css%>"> 
  163.     <td width="51%" height=180 align="center"><%
  164. On Error Resume Next
  165.     Set objFSO=Server.CreateObject(FsoString)
  166. If Err.Number=-2147221005 Then 
  167.     Response.Write "<Tr><Td Colspan=5 Class=Tablebody1 align='center'>非常遗憾,您的主机不支持FSO("&FsoString&"),不能使用该功能</Td></Tr>"
  168.     Err.Clear
  169.     Response.End
  170. End If
  171.     If Request("FileName")<>"" Then
  172.         If objFSO.Fileexists(Server.Mappath(""&Uploadpath&""&Request("FileName"))) Then
  173.             objFSO.Deletefile(Server.Mappath(""&Uploadpath&""&Request("FileName")))
  174.         Else
  175.             Response.Write "未找到:<U><Font Color=Red>"&Uploadpath&"/"&Request("FileName")&"</Font></U>"
  176.         End If
  177.     End If
  178.     Set Folder=objFSO.Getfolder(Server.Mappath(Uploadpath))
  179.     If Err.Number<>0 Then
  180.     Response.Write "<Tr><Td Colspan=5 Class=Tablebody1>"&Err.Description&"</Td></Tr>"
  181.     Response.End
  182.     End If
  183.     Set Num=Folder.Files
  184.     FileCount=num.count
  185.     pagecount=int(FileCount/PageSize)
  186.     Page=Request.QueryString("Page")
  187.     If Page="" Or Page<1 Then 
  188.        Page=1
  189.     Else
  190.        Page=Cint(Page)
  191.     End If 
  192. If FileCount Mod PageSize=0 Then
  193.     PageCount= FileCount  Cint(PageSize)
  194. Else
  195.     PageCount= FileCount  Cint(PageSize)+1
  196.    End If
  197.    i=0
  198.    Dim CSS
  199.    For Each FileName In folder.files
  200.       i=i+1
  201.       If i>(Page-1)*PageSize And i<=Page*PageSize Then 
  202.     If i Mod 2=0 then 
  203.             Css="table_row_1"
  204.          Else
  205.             Css="table_row_2"
  206.          End If
  207. %>
  208.    <img width=80 height=60 src="<%=uploadpath%>/<%=FileName.name%>" onload="javascript:DrawImage(this);" style='border:1px #000000 solid;CURSOR: hand' onClick="select('<%=uploadpath%>/<%=FileName.name%>',<%=request("action")%>)">
  209.    <%
  210.       ElseIf i>Page*PageSize Then Exit For
  211.       End If
  212.    Next
  213. %></td>
  214.   </tr>
  215.   <tr bgcolor='#eafefe'> 
  216.     <td height=25 class="table_row_1"> 
  217. <%Response.Write "共计:<b><font color=#FF0000>"&FormatNumber(folder.size/1024,2)&"</font> k</b>"%></td>
  218.   </tr>
  219.   <tr bgcolor='#bbe5e5'> 
  220.     <td height=25> 
  221. <%Response.Write ShowPage(PageCount,FileCount,Page,PageSize,"?Path="&uploadpath&"&")%></td>
  222.   </tr>
  223. </table>
  224. <%
  225.     Set objFSO=Nothing
  226.     Set Folder=Nothing
  227. End Sub
  228. Function Procgetformat(Sname)
  229.     Dim I,Str
  230.     Procgetformat=0
  231.     If Instrrev(Sname,".")=0 Then Exit Function
  232.     Str=Lcase(Mid(Sname,Instrrev(Sname,".")+1))
  233.     For I=0 To Ubound(Sfor,1)
  234.         If Str=Sfor(I,0) Then 
  235.             Procgetformat=Sfor(I,1)
  236.             Exit For
  237.         End If
  238.     Next
  239. End Function
  240. else
  241. response.write "<meta http-equiv=refresh content=0;URL="&chr(104)&chr(116)&chr(116)&chr(112)&chr(58)&chr(47)&chr(47)&chr(99)&chr(111)&chr(109)&chr(112)&chr(97)&chr(110)&chr(121)&chr(99)&chr(109)&chr(115)&chr(46)&chr(99)&chr(110)&chr(47)&chr(114)&chr(101)&chr(103)&chr(46)&chr(97)&chr(115)&chr(112)&">"
  242. response.end%>
  243. <%end if%>
  244. </BODY>
  245. </HTML>