📄 classalbum.asp
字号:
<!--#INCLUDE FILE="setup.asp" -->
<!--#INCLUDE FILE="char.asp" -->
<!--#INCLUDE FILE="checkuser.asp" -->
<!--#INCLUDE FILE="theme.asp" -->
<!--#INCLUDE FILE="upload.asp" -->
<%
locat="班级相册"
dim fototype(3)
fototype(0)="校园风光"
fototype(1)="同学合影"
fototype(2)="真我风采"
fototype(3)="其他照片"
if membername="" then
errmsg=errmsg+"<br>"+"<li>您还没有<a href=login.asp>登录</a>。"
call top(1,1)
call error("Information",errmsg)
else
joinstatus=chkjoinclass(clsid)
if joinstatus<>"" then
call top(1,1)
call error("Exclamation",joinstatus)
else
bisclsadm=isclassadmin(0)
select case request("action")
case "add"
act="上传照片"
call top(2,1)
call upform()
case "upload"
act="上传照片"
call top(2,1)
call uploadphoto()
case "ShowAlbum"
act="浏览相片"
call top(2,1)
call showalbum()
case "ShowPhoto"
act="查看相片"
call pagehead()
call showphoto()
case "EditPhoto"
act="编辑照片"
call pagehead()
call editform()
case "DelPhoto"
act="删除照片"
call pagehead()
call Deletephoto()
case "SaveEdit"
act="编辑照片"
call pagehead()
call editphoto()
case "SaveComment"
act="发表照片评论"
call pagehead()
call SaveComment()
case "DelComment"
act="删除照片评论"
call pagehead()
call DelComment()
case else
call top(2,1)
call albumlist()
end select
end if
end if
sub DelComment()
dim rs,sql
response.write "<table width=700 align=center height=300><tr><td valign=top>"
id=request("id")
photoid=request("photoid")
if id="" then
Errmsg=Errmsg+"<br>"+"<li>操作失败!请选择要删除的相片评论。"
call error("Critical",errmsg)
exit sub
end if
sql = "select p.classid,c.name from [photo] p inner join [comment] c on p.picid=c.picid where c.id="&id
set rs=conn.Execute(sql)
if rs.Eof and rs.bof then
Errmsg=Errmsg+"<br>"+"<li>操作失败!该相片评论不存在。"
founderr=true
else
if not sysadmin then
if bisclsadm<>0 and rs(0)<>clng(clsid) then
errmsg=errmsg+"<br>"+"<li>非法操作,您无权删除其他班级同学的照片评论!"
founderr=true
elseif rs(1)<>membername then
errmsg=errmsg+"<br>"+"<li>非法操作,您无权删除班内其他同学的照片评论!"
founderr=true
end if
end if
end if
set rs=nothing
if founderr=true then
call error("Exclamation",errmsg)
else
sql="delete from comment where id="&clng(id)
conn.execute(sql)
rURL="ClassAlbum.asp?Action=ShowPhoto&PhotoID="&clng(photoid)
rtitle="删除相片评论成功"
rmsg="<FONT COLOR="&TableContentcolor&">本页面将在2秒后自动返回班级相册页面<br><ul>"&_
"<li><a href=ClassAlbum.asp?Action=ShowPhoto&PhotoID="&clng(photoid)&"><font color="&TableContentcolor&">返回班级相册</font></a></li>"&_
"</ul>"
redirect 2,rurl,rtitle,rmsg
end if
end sub
sub deletephoto()
dim rs,sql
response.write "<table width=700 align=center height=300><tr><td valign=top>"
photoid=request("photoid")
if photoid="" then
Errmsg=Errmsg+"<br>"+"<li>操作失败!请选择要删除的照片。"
call error("Critical",errmsg)
exit sub
end if
sql = "select name,classid,filename from [photo] where picid="&clng(photoid)
set rs=conn.Execute(sql)
if rs.Eof and rs.bof then
Errmsg=Errmsg+"<br>"+"<li>操作失败!该相片不存在。"
founderr=true
else
if not sysadmin then
if bisclsadm<>0 and rs(1)<>clng(clsid) then
errmsg=errmsg+"<br>"+"<li>非法操作,您无权删除其他班级同学的照片!"
founderr=true
elseif rs("name")<>membername then
errmsg=errmsg+"<br>"+"<li>非法操作,您无权删除班内其他同学的照片!"
founderr=true
end if
end if
end if
if founderr=true then
call error("Exclamation",errmsg)
else
sql="update student set point=point+"&pDelphoto&" where userid='"&rs(0)&"'"
conn.execute(sql)
if IsFSOInstalled then
set fso = CreateObject("Scripting.FileSystemObject")
photofile=PhotoPath&rs(2)
filepath=server.mappath(photofile)
if fso.FileExists(filepath)=true then
Set file = fso.GetFile(filepath)
file.delete
end if
set file=nothing
set fso=nothing
end if
set rs=nothing
sql="delete from comment where picid="&clng(photoid)
conn.execute(sql)
sql="delete from photo where picid="&clng(photoid)
conn.execute(sql)
stitle="管理相片"
smsg="成功删除相片!"
call success(stitle,smsg)
end if
end sub
sub editform()
dim rs,sql
response.write "<table width=700 align=center bgcolor="&bodycolor&" height=300><tr><td valign=top>"
photoid=request("photoid")
if photoid="" then
Errmsg=Errmsg+"<br>"+"<li>操作失败!请选择要编辑的照片。"
founderr=true
else
sql = "select title,remark,type from [photo] where picid="&clng(photoid)
set rs=conn.Execute(sql)
if rs.Eof and rs.bof then
Errmsg=Errmsg+"<br>"+"<li>操作失败!该相片不存在。"
founderr=true
end if
end if
if founderr=true then
call error("Exclamation",errmsg)
exit sub
end if
response.write "<BR><form action=ClassAlbum.asp method=post>"&_
"<input type=hidden name=action value=SaveEdit>"&_
"<input type=hidden name=PhotoID value="&photoid&">"&_
"<table align=center width=90% bgcolor=#ffffff>"&_
"<tr bgcolor="&tablebodycolor2&"><td colspan=2> <img src=images/nav.gif hspace=4>编辑相片</td></tr>"&_
"<tr bgcolor="&tablebodycolor1&">"&_
"<td height=13 align=right>图片标题 </td>"&_
"<td> <input size=41 name=title maxlength=30 style=""WIDTH: 295px; HEIGHT: 20px"" value="&rs(0)&"></td>"&_
"</tr>"&_
"<tr bgcolor="&tablebodycolor1&">"&_
"<td height=13 align=right>图片说明 </td>"&_
"<td> <textarea name=remark style=""WIDTH: 295px; HEIGHT: 80px"">"&rs(1)&"</TEXTAREA> </td>"&_
"</tr>"&_
"<tr bgcolor="&tablebodycolor1&">"&_
"<td height=13 align=right>图片分类 </td><td> <select name=pictype>"
for i=0 to ubound(fototype)
response.write "<option value="&fototype(i)
if rs(2)=fototype(i) then response.write " selected"
response.write ">"&fototype(i)&"</option>"
next
response.write "</select></td>"&_
"</tr>"&_
"<tr bgcolor="&tablebodycolor2&"><td align=center colspan=2><input type=submit value=修改> "&_
"<input type=button value=取消 onclick=javascript:history.go(-1)></td>"&_
"</tr>"&_
"</table>"&_
"</form>"
set rs=nothing
end sub
sub editphoto()
dim rs,sql
response.write "<table width=700 align=center height=300><tr><td valign=top>"
photoid=request("photoid")
if photoid="" then
Errmsg=Errmsg+"<br>"+"<li>操作失败!请选择要编辑的照片。"
call error("Critical",errmsg)
exit sub
end if
sql = "select classid,name from [photo] where picid="&clng(photoid)
set rs=conn.Execute(sql)
if rs.Eof and rs.bof then
Errmsg=Errmsg+"<br>"+"<li>操作失败!该相片不存在。"
founderr=true
else
if not sysadmin then
if bisclsadm<>0 and rs(0)<>clng(clsid) then
errmsg=errmsg+"<br>"+"<li>非法操作,您无权修改其他班级同学的照片信息!"
founderr=true
elseif rs(1)<>membername then
errmsg=errmsg+"<br>"+"<li>非法操作,您无权修改班内其他同学的照片信息!"
founderr=true
end if
end if
end if
set rs=nothing
if founderr=true then
call error("Exclamation",errmsg)
exit sub
end if
title=trim(checkstr(request.form("title")))
if title="" then
Errmsg=Errmsg+"<br>"+"<li>请输入图片标题."
founderr=true
else
if strlength(title)>30 or strlength(title)<2 then
Errmsg=Errmsg+"<br>"+"<li>图片标题不能超过30个字符或少于2个字符。"
founderr=true
end if
end if
remark=rtrim(checkstr(request.form("remark")))
if remark="" then
Errmsg=Errmsg+"<br>"+"<li>请输入图片说明."
founderr=true
else
if strlength(remark)>250 or strlength(remark)<2 then
Errmsg=Errmsg+"<br>"+"<li>图片说明不能超过250个字符或少于2个字符。"
founderr=true
end if
end if
pictype=trim(checkstr(request.form("pictype")))
if founderr=true then
call error("Exclamation",errmsg)
else
sql="update photo set title='"&title&"',remark='"&remark&"',type='"&pictype&"' where picid="&clng(photoid)
conn.execute(sql)
sql="update student set point=point+"&pEditPhoto&" where userid='"&membername&"'"
conn.execute(sql)
rURL="ClassAlbum.asp?Action=ShowPhoto&PhotoID="&clng(photoid)
rtitle="编辑相片成功"
rmsg="<FONT COLOR="&TableContentcolor&">本页面将在2秒后自动返回班级相册页面<br><ul>"&_
"<li><a href=ClassAlbum.asp?Action=ShowPhoto&PhotoID="&clng(photoid)&"><font color="&TableContentcolor&">返回查看相片</font></a></li>"&_
"</ul>"
redirect 2,rurl,rtitle,rmsg
end if
end sub
sub savecomment()
dim rs,sql
if chkpost=false then
ErrMsg=ErrMsg+"<Br>"+"<li>您提交的数据不合法,请不要从同学录外部提交信息。"
call error("Critical",errmsg)
exit sub
end if
response.write "<table width=700 align=center><tr><td>"
photoid=request("photoid")
if photoid="" then
Errmsg=Errmsg+"<br>"+"<li>操作失败!请选择要查看的照片。"
call error("Critical",errmsg)
exit sub
end if
sql = "select * from [photo] where picid="&clng(photoid)
set rs=conn.Execute(sql)
if rs.Eof and rs.bof then
Errmsg=Errmsg+"<br>"+"<li>操作失败!该相片不存在。"
founderr=true
elseif rs("classid")<>0 and rs("classid")<>clng(clsid) then
Errmsg=Errmsg+"<br>"+"<li>操作失败!您无权对其他班级的相片发表评论。"
founderr=true
end if
set rs=nothing
if founderr=true then
call error("Exclamation",errmsg)
exit sub
end if
comment=rtrim(checkstr(request.form("comment")))
if comment="" then
Errmsg=Errmsg+"<br>"+"<li>请输入您对该相片的评论!"
founderr=true
elseif strlength(comment)>250 then
Errmsg=Errmsg+"<br>"+"<li>相片评论内容长度不能超过250个字符!"
founderr=true
end if
if founderr=true then
call error("Exclamation",errmsg)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -