📄 classalbum.asp
字号:
<!--#INCLUDE file="inc/DB.INC" -->
<!--#INCLUDE FILE="char.asp" -->
<!-- #include file="inc/func.inc" -->
<%
userid=session("myuserid")
password=session("mypwd")
if isman(userid,password)=0 then
%>
<script>
alert("同志,你不是管理员,无权进入!");
parent.location.href="index.asp";
</script>
<%
else%>
<html>
<meta NAME="GENERATOR" Content="Microsoft FrontPage 5.0" CHARSET="GB2312">
<title>相册管理</title><head>
<link rel="stylesheet" type="text/css" href="jscs/css.CSS">
<script language="JavaScript" src="jscs/jsfun.js"></script>
</head>
<script language="JavaScript" src="jscs/pop_pic.js"></script>
<body bgcolor="#F2F8FF">
<%
MaxPhotoSize=clng(65535*2+2)
photopath="photo/"
sub alldelete()
sql="select picid from [classpic]"
set rs=conn.execute(sql)
if rs.eof then
errmsg="操作失败!在线相册内还没有任何照片!"
call error(errmsg,"javascript:history.back()")
exit sub
end if
i=0
do until rs.eof
call delphoto(rs(0))
rs.movenext
i=i+1
loop
set rs=nothing
stitle="删除照片"
smsg="您已经成功的从在线相册中删除了"&i&"张照片!"
call success(stitle,smsg,"classalbum.asp")
end sub
sub seldelete()
dim idlist,idarr,id
If request("id")="" then
Errmsg="请选择所要删除的文件!"
call error(errmsg,"javascript:history.back()")
exit sub
end if
idlist=request("id")
if instr(idlist,",")>0 then
idArr=split(idlist)
for i = 0 to ubound(idarr)
id=clng(idarr(i))
call delphoto(id)
next
else
call delphoto(clng(idlist))
end if
stitle="删除照片"
smsg="您已经成功的从在线相册中删除了照片!"
call success(stitle,smsg,"classalbum.asp")
End sub
sub delphoto(id)
sql="select filename,name from [classpic] where picid="&id
set rs=conn.execute(sql)
photofile=PhotoPath&rs(0)
username=rs(1)
set rs=nothing
on error resume next
set fso = CreateObject("Scripting.FileSystemObject")
filepath=server.mappath(photofile)
if fso.FileExits(filepath)=true then
Set file = fso.GetFile(filepath)
file.delete
end if
set file=nothing
set fso=nothing
sql="delete from [classpic] where picid="&cstr(id)
conn.execute sql
end sub
if request("action")="全部删除" then
call alldelete()
elseif request("action")="删除所选"then
call seldelete()
elseif request("action")="上传照片" then
'call upform()
elseif request("action")="upload" then
'call uploadphoto()
else
call showalbum()
end if
sub showalbum()
dim totalPages,currentPage
currentPage=request.querystring("page")
stats=ordername
%>
<form action="classalbum.asp" method="post" name="album">
<table width="90%" bgcolor="#CED8CA" cellspacing="0" border="0" align="center">
<tr>
<td>
<table cellpadding="5" cellspacing="1" border="0" width="100%" bgcolor="#0099CC">
<tr bgcolor="#99CCFF">
<td colspan="5" valign="top" width="350" align="center"> >> <b>在线相册</b> << <font face="宋体"> </font></td>
<td colspan="2">相册中照片数:<%=allphotoes()%></td>
</tr>
<tr bgcolor="#D2E9FE">
<td align="center" nowrap><b>照片说明</b></td>
<td align="center" nowrap><b>提供者</b></td>
<td align="center" nowrap><b>照片类型</b></td>
<td align="center" nowrap><b>照片大小</b></td>
<td align="center" nowrap><b>点击次数</b></td>
<td align="center" nowrap><b>上载时间</b></td>
<td align="center" nowrap><b>操作</b></td>
</tr>
<%
dim rs,sql
set rs=server.createobject("adodb.recordset")
sql="select classpic.*,txluser.truename from [classpic],[txluser] where txluser.userid=classpic.name order by picid desc"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
%>
<tr bgcolor="#99CCFF">
<td colspan="9"> 目前还没有照片.</td>
</tr>
<%
else
rs.pagesize=20
totalpages=rs.pagecount
if currentpage="" then currentpage=1
if not isNumeric(currentpage) then
currentpage=1
elseif Cint(currentpage)>totalpages then
currentpage=totalpages
end if
currentpage=Cint(currentpage)
rs.absolutepage=currentpage
for i=1 to 20
if rs.eof then exit for
%>
<tr bgcolor="#99CCFF">
<td valign="top">
<img class="hand" src="images/<%=right(rs("filename"),3)%>.gif" dypop="<%=rs("remark")%>" dyclass="red">
<a href="javascript:doPopUp("look.asp?id=<%=rs("picid")%>")">
<%=rs("remark")%>
</a>
</td>
<td align="center">
<%=rs("truename")%>
</td>
<td align="center"><%=rs("type")%></td>
<td align="center"><%=rs("filesize")\1024%>KB</td>
<td align="center">
<%=rs("visitcount")%>
</td>
<td align="center"><%=formatdatetime(rs("datetime"),2)%></td>
<td align="center"><input type="checkbox" name="id" value="<%=rs("picid")%>"></td>
</tr>
<%
rs.movenext
next
end if
rs.close
set rs=nothing
%>
<tr bgcolor="#D2E9FE"><td colspan="7" align="right" nowrap>
<input type="checkbox" name="chkall" value="on" onclick="return CheckAll(this.form)">选中所有显示记录 <input type="submit" name="action" onclick="{if(confirm('确定删除选定的纪录吗?')){this.document.album.submit();return true;}return false;}" value="删除所选"> <!--<input type=submit name=action onclick="{if(confirm('确定清除所有的纪录吗?')){this.document.album.submit();return true;}return false;}" value="全部删除">-->
</td></tr>
</table>
</td></tr>
</table>
<table width="85%" align="center">
<tr><td align="right">
<% if currentpage=0 then currentpage=1
response.write "共 "&totalpages&" 页 第 "¤tpage&" 页 "
if currentpage=1 or totalpages=0 then
response.write "<font color=gray>首页 前页</font>"
else
response.write "<a href=?page=1&orders="&orders&">首页</a> <a href=?page="¤tpage-1&"&orders="&orders&">前页</a>"
end if
if currentpage=totalpages or totalpages=0 then
response.write " <font color=gray>后页 尾页</font>"
else
response.write " <a href=?page="¤tpage+1&"&orders="&orders&">后页</a> <a href=?page="&totalpages&"&orders="&orders&">尾页</a>"
end if
%><%
end sub
function allphotoes()
tmprs=conn.execute("Select count(picid) from [classpic]")
allphotoes=tmprs(0)
set tmprs=nothing
if isnull(allphotoes) then allphotoes=0
end function
%><%end if%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -