📄 classalbum.asp
字号:
set rs=conn.execute(sql)
response.write "(<font color=brown><b>"&rs(0)&"</b></font>)</td>"
set rs=nothing
if (i+1) mod 4=0 then response.write "</tr>"
next
%>
</table>
</td></tr></table>
<%
end sub
sub seldelete()
if isclassadmin(0)=false and bisystemadmin=false then
errmsg=errmsg+"<br>"+"<li>操作失败!因为没有权限,你不是本班的管理员!"
errorlevel="Exclamation"
call error(errorlevel,errmsg)
exit sub
end if
dim idlist,idarr,id
If request("id")="" then
Errmsg=Errmsg+"<br>"+"<li>请选择所要删除的文件!"
call error("Information",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
sub uploadphoto()
if chkpost=false then
ErrMsg=ErrMsg+"<Br>"+"<li>您提交的数据不合法,请不要从同学录外部提交信息。"
founderr=true
elseif UploadFlag=false then
Errmsg=Errmsg+"<br>"+"<li>操作失败,系统管理员禁止使用此项功能."
founderr=true
elseif session("UpFotoNum")>=3 then
Errmsg=Errmsg+"<br>"+"<li>操作失败,每次只能上传三个文件!"
founderr=true
end if
if founderr then
call error("Exclamation",errmsg)
exit sub
end if
Dim clsData
set clsData = new upLoad
clsData.CaseSensitive = false
title=clsData.binRequest("title",0).Value
if title="" then
Errmsg=Errmsg+"<br>"+"<li>请输入图片标题."
founderr=true
else
title=trim(checkstr(title))
if strlength(title)>30 or strlength(title)<2 then
Errmsg=Errmsg+"<br>"+"<li>图片标题不能超过30个字符或少于2个字符。"
founderr=true
end if
end if
remark=clsData.binRequest("remark",0).Value
if remark="" then
Errmsg=Errmsg+"<br>"+"<li>请输入图片说明."
founderr=true
else
remark=trim(checkstr(remark))
if strlength(remark)>250 or strlength(remark)<2 then
Errmsg=Errmsg+"<br>"+"<li>图片说明不能超过250个字符或少于2个字符。"
founderr=true
end if
end if
pictype=cint(clsData.binRequest("pictype",0).Value)
sfotofile=clsData.binRequest("UpFile",0).ShortFileName
fileExt=lcase(right(sfotofile,4))
if fileEXT<>".gif" and fileEXT<>".jpg" and fileEXT<>".bmp" and fileEXT<>".png" then
Errmsg=Errmsg+"<br>"+"<li>所要上传的图片格式系统不支持!"
founderr=true
end if
chkfoto=clsData.binRequest("UpFile",0).IsImage(imgWidth,imgHeight,imgType,imgSize,imgBit)
if chkfoto=false then
Errmsg=Errmsg+"<br>"+"<li>非法的图片格式!"
founderr=true
end if
if founderr=true then
errorlevel="Information"
call error(errorlevel,errmsg)
exit sub
end if
if imgSize<100 then
Errmsg=Errmsg+"<br>"+"<li>请选择你要上传的图片或你的图片文件太小."
founderr=true
elseif imgSize>(MaxPhotoSize*1024) then
Errmsg=Errmsg+"<br>"+"<li>文件大小超过了"&MaxPhotoSize&"K限制."
founderr=true
else
strsql="select sum(filesize) from photo where classid="&clsid
set rs=conn.execute(strsql)
if not (rs.eof and rs.bof) then
albumsize=rs(0)
if (albumsize+imgsize)>(MaxAlbumSize*1024*1024) then
Errmsg=Errmsg+"<br>"+"<li>上传失败!超过了班级相册容量"&MaxAlbumSize&"M限制."
founderr=true
end if
end if
set rs=nothing
end if
if founderr=true then
errorlevel="Information"
call error(errorlevel,errmsg)
exit sub
end if
randomize
ranNum=int(9000*rnd)+1000
dfotofile=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&fileExt
upfoto=clsData.SavetoFile("UpFile",0,server.mappath(PhotoPath&dfotofile),false)
set clsData = nothing
if upfoto=4 then
Errmsg=Errmsg+"<br>"+"<li>图片上传失败!保存路径的目录不存在."
founderr=true
elseif upfoto=8 then
Errmsg=Errmsg+"<br>"+"<li>图片上传失败!该文件正在被使用."
founderr=true
elseif upfoto=16 then
Errmsg=Errmsg+"<br>"+"<li>图片上传失败!该目录没有可写权限."
founderr=true
elseif upfoto=32 then
Errmsg=Errmsg+"<br>"+"<li>图片上传失败!文件已经存在."
founderr=true
end if
if founderr=true then
errorlevel="Information"
call error(errorlevel,errmsg)
exit sub
elseif upfoto=0 then
strsql="insert into photo (filename,filesize,type,uptime,name,title,remark,classid,width,height,depth,format) values ('"&dfotofile&"',"&imgSize&",'"&fototype(pictype)&"',now(),'"&membername&"','"&title&"','"&remark&"',"&clsid&","&imgWidth&","&imgHeight&","&imgBit&",'"&imgType&"')"
conn.execute(strsql)
StrSQL = "update [student] set point=point+"&pAddPhoto&" where userid='"&membername&"'"
conn.execute(StrSQL)
session("UpFotoNum")=session("UpFotoNum")+1
rURL="ClassAlbum.asp?Action=ShowAlbum&Catalog="&pictype
rtitle="成功上传相片"
rmsg="<FONT COLOR="&TableContentcolor&">本页面将在2秒后自动返回班级相册页面<br><ul>"&_
"<li><a href=ClassAlbum.asp?Action=ShowAlbum&Catalog="&pictype&"><font color="&TableContentcolor&">返回班级相册</font></a></li>"&_
"</ul>"
redirect 2,rurl,rtitle,rmsg
end if
end sub
sub upform()
%>
<!--#INCLUDE FILE="script/sendnow.inc" -->
<div id="sponsorAdDiv" style="visibility:hidden">
<table width="400" height="70" 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>
<Script language=javascript>
function preview(){
frm=document.frmupload
if (frm.UpFile.value==""){
alert("请选择图片")
frm.UpFile.focus()
return false
}
innerhtm="<img src='" + frm.UpFile.value +"' onload='javascript:if(this.width>500){this.width=500}'>"
prv.innerHTML=innerhtm
}
</script>
<form name="frmupload" action="classalbum.asp?action=upload" method="post" enctype="multipart/form-data" onsubmit="submitonce(this);initAd();">
<input type=hidden name=pictype value="<%=request("catalog")%>">
<table border="0" cellspacing="1" width="600" cellpadding="4" bgcolor="<%=tablebordercolor%>" align="center">
<tr bgcolor="<%=tabletitlecolor%>">
<th height="25" align="center" colspan=2>上传照片
</th>
<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,BMP和PNG格式的图片,大小不超过<font color=brown><%=MaxPhotoSize%>K</font>字节。<BR></SPAN></FONT>
</td></tr>
</table>
</td>
</tr>
<tr bgcolor="<%=tablebodycolor2%>">
<td height="13" align=right>提 供 者 </td>
<td> <input type=text size=41 style="WIDTH: 295px; HEIGHT: 20px" name=author value=<%=getrealname(membername)%> disabled></td>
</tr>
<tr bgcolor="<%=tablebodycolor2%>">
<td height="13" align=right>图片标题 </td>
<td> <input size="41" name="title" maxlength=30 style="WIDTH: 295px; HEIGHT: 20px"></td>
</tr>
<tr bgcolor="<%=tablebodycolor2%>">
<td height="13" align=right>图片说明 </td>
<td> <textarea name="remark" style="WIDTH: 295px; HEIGHT: 80px"></TEXTAREA> </td>
</tr>
<tr bgcolor="<%=tablebodycolor2%>">
<td height=13 align=right>图片位置 </td>
<td> <INPUT type=file size=23 name=UpFile> <input type="button" name="button" value="图片预览" onclick="preview()"></td>
</tr>
<tr bgcolor="<%=tablebodycolor2%>">
<td height="13" colspan=2 align=center><span id="prv"></span></td>
</tr>
<tr bgcolor="<%=tablebodycolor2%>">
<td height="13" colspan=2>
<table width=100%cellspacing=13>
<tr><td valign=top> <img src=images/reminder.gif align=absmiddle hspace=4>如果你的图片文件较大或网络速度太慢,上载过程可能要一段时间,请耐心等待!</td>
</tr>
</table>
</td>
</tr>
<tr bgcolor="<%=tablebodycolor1%>">
<td height="30" align="right" colspan=2><input
style="WIDTH: 90px; HEIGHT: 20px" type="submit" value="开始上传" name="upsubmit">
</td>
</tr>
</table>
</form>
<%end sub
function photonum()
tmprs=conn.execute("Select count(picid) from [photo] where classid="&clsid)
photonum=tmprs(0)
set tmprs=nothing
if isnull(photonum) then photonum=0
end function
function photosize(picsize)
if not isinteger(picsize) then
photosize=0
exit function
end if
picsize=clng(picsize)
if picsize>=1024*1024 then
photosize=cstr(round(picsize/(1024*1024),2))&"M"
elseif picsize>=1024 then
photosize=cstr(round(picsize/1024,2))&"K"
else
photosize=picsize
end if
end function
function sizeadjust(byval fotow,byval fotoh,byval shrksize)
sizeadjust=""
if fotow="" or fotoh="" then exit function
if fotow>0 and fotoh>0 then
if fotow>shrksize or fotoh>shrksize then
if fotow>=fotoh then sizeadjust="width="&shrksize else sizeadjust="height="&shrksize
end if
else
sizeadjust="width="&shrksize&" height="&shrksize
end if
end function
%>
<%call footer%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -