📄 classalbum.asp
字号:
<!--#INCLUDE FILE="conn.asp" -->
<!--#INCLUDE FILE="const.asp" -->
<!--#INCLUDE FILE="char.asp" -->
<!--#INCLUDE FILE="checkuser.asp" -->
<!--#INCLUDE FILE="theme.asp" -->
<html><head>
<meta NAME=GENERATOR Content="Microsoft FrontPage 4.0" CHARSET=GB2312>
<title><%=SchoolmateName%>——班级相册</title>
<link rel=stylesheet type=text/css href=txl.css>
<script language="JavaScript" src="script/jsfun.js"></script>
</head>
<body alink=#333333 vlink=#333333 link=#333333 topmargin=0 bgcolor=<%=bodycolor%>>
<%
call isjoinclass(1)
sub alldelete()
if isclassadmin(0)=false then
errmsg=errmsg+"<br>"+"<li>操作失败!因为没有权限,你不是本班的管理员!"
call error(errmsg)
exit sub
end if
sql="select picid from [photo] where classid="&clsid
set rs=conn.execute(sql)
if rs.eof then
errmsg=errmsg+"<br>"+"<li>操作失败!班级相册内还没有任何照片!"
call error(errmsg)
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)
end sub
sub seldelete()
if isclassadmin(0)=false then
errmsg=errmsg+"<br>"+"<li>操作失败!因为没有权限,你不是本班的管理员!"
call error(errmsg)
exit sub
end if
dim idlist,idarr,id
If request("id")="" then
Errmsg=Errmsg+"<br>"+"<li>请选择所要删除的文件!"
call error(errmsg)
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)
End sub
sub delphoto(id)
sql="select filename,name from [photo] where picid="&id&" and classid="&clsid
set rs=conn.execute(sql)
photofile=PhotoPath&rs(0)
username=rs(1)
set rs=nothing
sql="update [student] set point=point+"&pDelPhoto&" where userid='"&username&"'"
conn.execute(sql)
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 [photo] where picid="&cstr(id)&" and classid="&clsid
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 uploadphoto()
dim upload,file
Dim fso
%>
<!--#INCLUDE FILE="script/upload.inc" -->
<%
if UploadFlag=false then
Errmsg=Errmsg+"<br>"+"<li>操作失败,系统管理员禁止使用此项功能."
call error(errmsg)
exit sub
end if
set upload=new upload_5xSoft
if upload.form("remark")="" then
Errmsg=Errmsg+"<br>"+"<li>请输入图片说明."
founderr=true
else
remark=trim(upload.form("remark"))
end if
pictype=upload.form("pictype")
'response.write pictype
'response.end
set file=upload.file("UpFile")
fileExt=lcase(right(file.filename,4))
if file.filesize<100 then
Errmsg=Errmsg+"<br>"+"<li>请先选择你要上传的文件."
founderr=true
elseif fileEXT<>".gif" and fileEXT<>".jpg" then
Errmsg=Errmsg+"<br>"+"<li>所要上传文件的格式错误!."
founderr=true
elseif file.filesize>MaxPhotoSize then
Errmsg=Errmsg+"<br>"+"<li>文件大小超过了"&MaxPhotoSize/1024&"K限制."
founderr=true
end if
if founderr=true then
call error(errmsg)
exit sub
end if
set fso = CreateObject("Scripting.FileSystemObject")
path=server.mappath(PhotoPath)
if fso.folderexists(path)=false then
fso.createfolder(path)
end if
set fso=nothing
if right(PhotoPath,1)<>"/" then
PhotoPath=PhotoPath&"/"
end if
datetime=year(date)&month(date)&day(date)&hour(now)&minute(now)&second(now)
filename=datetime&file.FileName
file.SaveAs Server.mappath(PhotoPath&FileName)
Set rs = Server.CreateObject("ADODB.Recordset")
rs.open "photo",conn,1,3
rs.addnew
rs("filename")=filename
rs("filesize")=file.filesize
rs("type")=pictype
rs("datetime")=now()
rs("name")=membername
rs("remark")=remark
rs("classid")=clsid
rs.update
rs.close
StrSQL = "update [student] set point=point+"&pAddPhoto&" where userid='"&membername&"'"
conn.execute(StrSQL)
stitle="上载照片"
smsg="您的照片已经成功上载,并收藏在您的班级相册中。"
call success(stitle,smsg)
set file=nothing
set upload=nothing
end sub
sub upform()
StrSQL = "select realname from student where userid='"&membername&"'"
set rs=conn.execute(StrSQL)
%>
<!--#INCLUDE FILE="script/sendnow.inc" -->
<div id="sponsorAdDiv" style="visibility:hidden">
<table width="300" height="50" bgcolor="<%=tablebordercolor%>" border=0 cellspacing=1><tr><td>
<table width="100%" height="100%" border=0 cellspacing=0><tr bgcolor="<%=tablebodycolor1%>"><td>
正在上传图片,请稍候......
</td></tr></table></td></tr></table></div>
<table border="0" cellspacing="1" width="100%">
<tr>
<td>
<table border="0" cellspacing="1" width="100%">
<tr>
<td align="center"><br>
</p>
<form name="frmupload" action="classalbum.asp?action=upload" method="post" enctype="multipart/form-data" onsubmit="submitonce(this);initAd();">
<table border="0" cellspacing="1" width="470" cellpadding="4"
bgcolor="<%=tablebordercolor%>">
<tr bgcolor="<%=tabletitlecolor%>">
<td height="20" align="center" colspan=2>
<IMG SRC="IMAGES/upload.gif" WIDTH="149" HEIGHT="36" BORDER=0 ALT=""></td>
<tr bgcolor="<%=tablebodycolor2%>">
<td height="13" colspan=2><table width=100% border=0 cellspacing=16><tr><td><FONT color=#284654><SPAN
style="FONT-SIZE: 9pt"><b>注意事项:</b><BR>1. 请不要在此发布违反计算机信息网络安全相关条例的有害信息,一经发现,后果自负!<BR>2. 请不要在此发布和与本站内容无关的照片(如卡通、壁纸、电影剧照、海报、明星、球星、宠物、植物等),一经发现,立即删除。<BR>3. 仅接受.jpg
和.gif格式的图片,且文件名必须以.jpg或.gif为后缀,大小不超过<font color=brown><%=MaxPhotoSize/1024%>K</font>字节。<BR></SPAN></FONT></td></tr></table></td>
</tr>
<tr bgcolor="<%=tablebodycolor2%>">
<td height="13" width=100 align=right>提 供 者 </td><td>
<%=htmlencode(rs("realname"))%></td>
</tr>
<tr bgcolor="<%=tablebodycolor2%>">
<td height="13" align=right>照片说明 </td><td> <input size="41" name="remark" maxlength=30></td>
</tr>
<tr bgcolor="<%=tablebodycolor2%>">
<td height=13 align=right>照片位置 </td>
<td> <INPUT
type=file size=30 name=UpFile></td>
</tr>
<tr bgcolor="<%=tablebodycolor2%>">
<td height="13" align=right>照片类型 </td>
<td> <select name=pictype>
<option value=校园风光> 校园风光 </option>
<option value=同学合影> 同学合影 </option>
<option value=个人照片> 真我风采 </option>
<option value=其它照片> 其它照片 </option>
</select><input type=hidden name=test value=test></td>
</tr>
<tr bgcolor="<%=tablebodycolor2%>">
<td height="13" colspan=2><table width=100% cellspacing=13><tr><td>如果你的图片文件较大或网络速度太慢,上载过程可能要一段时间,请耐心等待!</td></tr></table></td>
</tr>
<tr bgcolor="<%=tabletitlecolor%>">
<td height="30" align="center" colspan=2><input
style="WIDTH: 90px; HEIGHT: 20px" type="submit" value="开始上载" name="upsubmit">
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<%end sub
sub showalbum()
dim totalPages,currentPage
currentPage=request.querystring("page")
stats=ordername
%>
<br><br>
<form action="classalbum.asp" method=post name=album>
<table width=<%=tablewidth%> bgcolor=<%=TableborderColor%> cellspacing=0 border=0 align=center>
<tr>
<td>
<table cellpadding=6 cellspacing=1 border=1 width=100% bgcolor=<%=TableborderColor%> bordercolor=<%=TableborderColor%> bordercolorlight=<%=TablebodyColor1%> bordercolordark=<%=TablebodyColor1%>>
<tr bgcolor=<%=TablebodyColor1%>>
<td colspan=5 valign=top width=350 align=center> >> <B>班级相册</B> <<
<font face=宋体> </font></td>
<td colspan=2>相册中照片数:<%=allphotoes()%></td>
</tr>
<tr bgcolor=<%=TabletitleColor%>>
<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 photo.*,student.realname from [photo],[student] where photo.classid="&clsid&_
" and student.userid=photo.name order by picid desc"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
%>
<tr bgcolor=<%=TableBodyColor2%>>
<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=<%=TablebodyColor2%>>
<td valign=top> <a target=_blank href=viewphoto.asp?id=<%=(rs("picid"))%>><img src=images/<%=right(rs("filename"),3)%>.gif border=0 align=absmiddle hspace=2><%=htmlencode(rs("remark"))%></a></td>
<td align=center>
<a target=_blank href="profile.asp?action=showdetail&name=<%=htmlencode(rs("name"))%>"><%=htmlencode(rs("realname"))%></a>
</td>
<td align=center><%=rs("type")%></td>
<td align=center><%=rs("filesize")\1024%>KB</td>
<td align=center>
<%=rs("visitcount")%>
</td>
<td align=center><%=rs("datetime")%></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=<%=tabletitlecolor%>><td colspan=7 align=right nowrap>
<input type=checkbox name=chkall value=on onclick="return CheckAll(this.form)">选中所有显示记录 <input type=submit name=action value="上传照片"> <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
%>
</td></tr></table>
<%
end sub
function allphotoes()
tmprs=conn.execute("Select count(picid) from [photo] where classid="&clsid)
allphotoes=tmprs(0)
set tmprs=nothing
if isnull(allphotoes) then allphotoes=0
end function
%>
<!--#include file="footer.asp"-->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -