📄 showphoto.asp
字号:
<!--#include file=../INC/txlconst.asp-->
<!--#include file=../INC/txlfun.asp-->
<!--
<pre>
┌─ 自由领域ASP+WAP同学录系统 ─────────────────┐
│ │
│ 感谢你使用 自由领域ASP+WAP同学录系统(测试版) │
│ 使用本免费源码您必须遵守以下规定 │
│ 不得公开发表代码 不得用做商业用途,不得向其他使用者收费。 │
│ │
│ 使用时,请保留此段信息,谢谢配合 │
│ │
│ 2004/12/19 │
│ │
└──────────────── http://99167.jahee.com ───┘
</per>
-->
<%
dim const_txl_HomeUrl,errstr,i,page
errstr=""
const_txl_HomeUrl="../"
OpenDatabase
txl_SiteHead const_txlname&"-班级相册"
call online
call main
CloseDatabase
SiteBottom
sub main
If const_photo_login_limit=1 Then '班级相册登录查看限制
If session("username")="" Then
errstr="<li>当前同学录状态已经设置为<font color=red>班级相册只有登录之后才能看到</font>!</li>"
errstr=errstr&"<li>你现在还没有登录或者会话超时,点<a href='../user/login.asp'>这里登录</a>!</li>"
errstr=errstr&"<li>如果还有疑问请与管理员联系!</li>"
Call printerror("浏览班级相册出错!",errstr,779)
Exit Sub
End If
ElseIf const_photo_login_limit=2 Then
If session("username")="" Then
errstr="<li>当前同学录状态已经设置为<font color=red>班级相册只有班级成员和嘉宾有查看权限</font>!</li>"
errstr=errstr&"<li>你现在还没有登录或者会话超时,点<a href='../user/login.asp'>这里登录</a>!</li>"
errstr=errstr&"<li>如果还有疑问请与管理员联系!</li>"
Call printerror("查看班级相册出错!",errstr,779)
Exit Sub
End If
If not (session("usertype")=3 or session("usertype")=4) Then
errstr="<li>当前同学录状态已经设置为<font color=red>班级相册只有班级成员和嘉宾有查看权限</font>!</li>"
errstr=errstr&"<li>你目前的身份没有该权限!</li>"
errstr=errstr&"<li>如果还有疑问请与管理员联系!</li>"
Call printerror("查看班级相册出错!",errstr,779)
Exit Sub
End If
End If
If Request.QueryString("action")="del" Then
Call del
Else
Call showphoto
End If
end sub%>
<%Sub showphoto
Dim rs,sql,ss
set rs=Server.CreateObject("Adodb.Recordset")
sql="select photo.*,ec.studentid,sname from photo,ec where ec.studentid=photo.studentid order by LastUpdateTime desc,picid desc"
rs.open sql,conn,1
dim RecordCount2,LinkFile,displaypagenum,PageSize2,k,PageCount2
page=Request.QueryString("page")
if page="" or (not isnumeric(page)) Then
page=1
end if
page=Cint(page)
RecordCount2=rs.recordcount
LinkFile="?"
displaypagenum=15
pagesize2=15
rs.pagesize=PageSize2
PageCount2=rs.pagecount
If not rs.eof then
rs.absolutepage=page
end if
i=0
%>
<style type="text/css">
<!--
.style1 {color: #FF0000}
.style2 {color: #0000FF}
-->
</style>
<table width="779" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td background="" style="padding:5px;vertical-align:top; ">
<table width="100%" border="0" cellpadding="0" cellspacing="8">
<tr>
<td class="rig1"><b>网站导航:</b><a href="<%=const_homepageurl%>">首页</a>
>> <a href="<%=const_txl_HomeUrl&const_txlurl%>"><%=const_txlname%></a>
>> <a href="showphoto.asp">班级相册</a>
</td></tr>
</table>
<table width="100%" bgcolor="#FFFFFF" border="0" cellspacing="8" cellpadding="0" style="margin-bottom:5px;border:#666666 1px solid;">
<tr><td style="line-height:1.8;">
·<b>请注意:</b> 自己上传的照片<span class="style1">自己有权删除</span>,只需要点击“<span class="style2">操作</span>”栏的“<span class="style2">删除</span>”即可。<br>
·<b>我要上传照片</b> <a href="#pub">点击此处上传照片</a></td>
</tr>
<tr>
<td class="rig1"><%=ShowPage(PageCount2,RecordCount2,page,PageSize2,LinkFile,displaypagenum) %>
</td>
</tr>
</table>
<%
dim trflag,trflag2,clos
clos=5 '每行4列
k=0
ss=RecordCount2
if ss>0 then
Response.Write"<table width=""769"" align=""center"" border=""1"" cellspacing=""0"" cellpadding=""1"" bordercolor=""#666666"" bgcolor=""#FFFFFF"" style=""border-collapse:collapse;text-align:center;line-height:1.5;font-family:Verdana;"">"
while k<ss and i<pagesize2 and not rs.eof
i=i+1
trflag=false
trflag2=false
if k mod 5=0 then trflag=true
if trflag then Response.Write("<tr>")
Response.Write("<td width=149>")
%>
<table width="149" border="0" cellpadding="0" cellspacing="0" style="font-family:Verdana, Arial, Helvetica, sans-serif;">
<tr>
<td height="91" style="padding:8px;" align="center"> <a href="viewphoto.asp?picid=<%=rs("picid")%>">
<%If Lcase(rs("PhotoFormat"))=".swf" Then
Response.Write "<embed width='120' height='160' src='"&const_txl_HomeUrl&const_photoup_path&rs("pic")&"' align='center'>"
Else%>
<img src="<%=const_txl_HomeUrl&const_photoup_path&rs("pic")%>" alt="<%=rs("LastUpdateInfo")%>" width="100" height="120" border="0" style="border:#cccccc 1px solid;">
<%End IF%>
</a> </td>
</tr>
<tr>
<td align="center" style="padding:5px;"><b><a href="viewphoto.asp?picid=<%=rs("picid")%>" title="<%=rs("LastUpdateInfo")%>"><%=rs("subject")%></a></b><span class="small"> (<%= rs("liuyanshu")&"/"&rs("dianji")%>) </span>
</td>
</tr>
<tr>
<td align="center" style="padding-bottom:8px;"><%=rs("sname")%>
[<a href="?action=del&picid=<%=rs("picid")%>" title="删除照片,管理员和上传者有权限" onclick="return confirm('这个操作将删除这个照片以及下面相关的回复留言\n 你确定吗?');">删除</a>]
</td>
</tr>
<!-- <%=rs("PhotoSize")&"KB"%><br> -->
</table>
<%
Response.Write("</td>")
rs.movenext
k=k+1
if k mod clos=0 then trflag2=true
if trflag2 then Response.Write("</tr>")
wend
if ss mod clos<>0 then
for k=1 to (clos-ss mod clos)
Response.Write("<td> </td>")
next
Response.Write("</tr>")
end if
Response.Write("</table>")
end if
rs.close
set rs=nothing
%>
<table width="100%" border="0" cellspacing="0" cellpadding="8" style="margin-top:5px;margin-bottom:5px;">
<tr>
<td class="rig1"><%=ShowPage(PageCount2,RecordCount2,page,PageSize2,LinkFile,displaypagenum) %></td>
</tr>
</table>
<script>
submitflag=false
function check_walkman_form(walkman_frm)
{
//walkman编写
if (walkman_frm.intro.value==""){
alert("请输入简短的说明!");
walkman_frm.intro.focus();
return false
}
if (walkman_frm.file.value==""){
alert("请选择图片!");
walkman_frm.file.focus();
return false
}
if(!submitflag){
walkman_frm.submit();
walkman_frm.Submit.disabled=true
submitflag=true
return true
}
else
{
alert("请不要重复提交");
return false;
}
}
</script>
<form action="uploadphoto.asp" method="post" enctype="multipart/form-data" name="form1" onsubmit="return check_walkman_form(this)">
<table width="100%" border="1" cellspacing="0" cellpadding="1" bordercolor="#666666" style="border-collapse:collapse;font-family:Verdana, Arial, Helvetica, sans-serif;">
<tr>
<td colspan="3" bgcolor="#F1F1F1" class="title">上载照片</td>
</tr>
<tr>
<td width="341" height="25" bgcolor="#F1F1F1" style="font-weight:bold;text-align:center;">注意事项:<img src="../images/null.gif" id="preimg" name="preimg" onload="javascript:if(this.width>=200)this.width=200"><a name="pub"></a></td>
<td width="74" bgcolor="#FFFFFF" class="tar">提 供 :</td>
<td width="340" bgcolor="#FFFFFF" class="content"><%=Session("username")%>
</td>
</tr>
<tr>
<td rowspan="4" bgcolor="#Ffffff" style="padding-top:15px;line-height:1.5;padding-right:15px;"><ol>
<li> 请不要在此发布和与本站内容无关的照片(如卡通、壁纸、电影剧照、海报、明星、球星、宠物、植物等),一经发现,立即删除。</li>
<li>仅接受<font color="#FF0000"><%=const_PhotoFormat%></font>格式的图片,大小不超过<font color="#FF0000"><%=const_PhotoMaxSize%>K</font>。</li>
</ol></td>
<td bgcolor="#F1F1F1" class="tar" >大 小 :</td>
<td bgcolor="#F1F1F1" class="content"><font color="#FF0000"><<%=const_PhotoMaxSize%>K</font></td>
</tr>
<tr>
<td bgcolor="#FFFFFF" class="tar" >格 式 :</td>
<td bgcolor="#FFFFFF" style="padding-left:7px; padding-right:3px;line-height:1.5;"><font color="#FF0000"><%=const_PhotoFormat%></font></td>
</tr>
<tr>
<td bgcolor="#F1F1F1" class="tar">说 明 : </td>
<td bgcolor="#F1F1F1" style="padding-left:7px; padding-right:3px;line-height:1.5;"><input name="intro" type="text" id="intro" size="30" maxlength="50"></td>
</tr>
<tr>
<td bgcolor="#FFFFFF" class="tar">浏 览 : </td>
<td bgcolor="#FFFFFF" style="padding-left:7px; padding-right:3px;line-height:1.5;"><input type="file" name="filexx"></td>
</tr>
<tr align="center">
<td height="30" colspan=3>如果你的图片文件较大或网络速度太慢,上载过程可能要一段时间,请耐心等待!</td>
</tr>
<tr>
<td height="40" colspan="3" bgcolor="#F1F1F1" align=center><input type="submit" name="Submit" value="开始上传"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<%
End Sub
Sub del
dim limitflag,dealuser,picimgname,username,tmpstr
Dim rs,dellogid,picid,sql
picid=Request.QueryString("picid")
if picid="" or (not isnumeric(picid)) Then
Call printerror("删除相片出错"," <li>参数错误!</li>",779)
Exit Sub
end if
set rs=conn.execute ("select * from photo where picid="&picid)
IF rs.eof then
errstr="<li>不存在标号为"&picid&"的班级相片,该相片可能已经被删除</li>"
errstr=errstr&"<li>请选择<a href='showphoto.asp'班级相册</a>重新进入</li>"
Call printerror("读取相片出错",errstr,779)
exit sub
end if
picimgname=rs("pic")
limitflag=false
If session("adminname")<>"" Then
limitflag=true
dealuser="管理员"
End If
username=Session("username")
If rs("studentid")=username Then
limitflag=true
dealuser=username
end if
rs.close
set rs=nothing
If not(limitflag) Then
Call printerror ("删除相片出错!","<li>你没有操作该功能的权限!</li>",779)
exit sub
Else
If Request("queren")<>"true" Then
Response.write "<div align=center><br><font color=red>本操作正在删除班级照片,且不可恢复。你确实要进行该操作吗?<br>请点击下面的“确定”按钮继续执行操作,点击“取消”来撤消本次操作。</font><br><br>"
Response.write "<input type=button value='确定' onclick=""javascript:window.location.href='?action=del&picid="&picid&"&queren=true&url="&Request.ServerVariables("HTTP_REFERER")&"'""> <input type=button value='取消' onclick='javascript:history.back()'><br><br></div>"
Else
conn.Execute ("delete from photoforum where picid="&picid) '删除回复留言
conn.Execute ("delete from photo where picid="&picid) '删除相片
set rs=conn.execute ("select top 1 id from dellog order by id desc")
if rs.eof then
dellogid=1
else
dellogid=rs(0)+1
end if
sql="insert into dellog(id,sname,pic,deltime)values("
sql=sql&dellogid&",'"&dealuser&"','"&picimgname&"','"&now()&"')"
conn.execute (sql) '做删除记录
tmpstr="<li>已经成功删除标号为"&picid&"的照片,照片下面的回复帖也已经删除!</li>"
tmpstr=tmpstr&"<li>回<a href='showphoto.asp'>班级相册</a>!</li>"
tmpstr=tmpstr&"<li>回<a href='"&Request("url")&"'>"&Request("url")&"</a>!</li>"
Call printsuc("删除照片成功!",tmpstr,779)
End IF
End If
end sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -