📄 classboard.asp
字号:
<td>
<table border="0" cellspacing="1" width="100%">
<tr>
<td align="center"><br>
</p>
<form style="MARGIN: 0px" name="frmgbk" action="classboard.asp?action=modify" method="post"
onsubmit="return submitonce(this)">
<input type="hidden" name="bbsid" value="<%=bbsid%>">
<input type="hidden" name="action" value="modify">
<table border="0" cellspacing="1" width="470" cellpadding="4"
bgcolor="<%=tablebordercolor%>">
<tr bgcolor="<%=tabletitlecolor%>">
<td height="20" align="center" colspan=2>
<img height="30" src="images/icon04.gif" width="30" align="absMiddle"> <b>修改班级留言</b></td>
<tr bgcolor="<%=tablebodycolor2%>">
<td height="13"> 留 言 人</td><td>
<%=htmlencode(getrealname(rs("name")))%></td>
</tr>
<tr bgcolor="<%=tablebodycolor2%>">
<td height="13"> 留言主题</td><td> <input size="38" name="title" value=<%=htmlencode(rs("title"))%>></td>
</tr>
<tr bgcolor="<%=tablebodycolor2%>">
<td height="13"> 留言心情</td><td><br><table border=0 width=100%><tr><td align=center>
<%for i=1 to 18%>
<input type="radio" value="face<%=i%>" name="mood" <%if "face"&i&".gif"=rs("mood") then response.write "checked"%>><img src="<%=MoodURL%>face<%=i%>.gif" WIDTH="15" HEIGHT="15">
<%if i=9 then response.write "<br>"
next%>
</td></tr></table>
</td>
</tr>
<tr bgcolor="<%=tablebodycolor2%>">
<td width=80> 留言内容<br><br>(支持<font color=brown>UBB</font>代码,请不要超过<font color=brown><%=MaxBoardSize%></font>个字符。)
</td>
<td> <textarea name="content" rows="10" cols="50" ><%=rs("content")%></textarea></td>
</tr>
<tr bgcolor="<%=tabletitlecolor%>">
<td height="30" align="center" colspan=2><input
style="WIDTH: 90px; HEIGHT: 20px" type="submit" value="修改" name="submit">
<input style="WIDTH: 90px; HEIGHT: 20px" type="button" value="返回" onclick="javascript:history.go(-1)"
name="reset"> </td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<%
end if
set rs=nothing
call endconnection()
end sub
rem ====================================================================
sub modify()
bbsid=request.form("bbsid")
if bbsid="" then
errmsg=errmsg+"<br>"+"<li>没有操作请求,您正试图进行非法操作!"
founderr=true
call error(errmsg)
exit sub
end if
sql="select name,classid from [classboard] where id="&bbsid
set rs=conn.execute(sql)
bisclsadm=isclassadmin(0)
if bisclsadm=true and clsid<>rs("classid") then
errmsg=errmsg+"<br>"+"<li>非法操作,您无权修改其他班级同学的留言!"
founderr=true
elseif bisystemadmin=false and bisclsadm=false and rs("name")<>membername then
errmsg=errmsg+"<br>"+"<li>非法操作,您无权修改班内其他同学的留言!"
founderr=true
end if
if founderr=true then
call error(errmsg)
exit sub
end if
if request.form("title")="" then
Errmsg=Errmsg+"<br>"+"<li>请确认输入了留言主题。"
founderr=true
else
title=trim(request.form("title"))
end if
content=rtrim(request.form("content"))
if content="" then
Errmsg=Errmsg+"<br>"+"<li>留言内容不能为空。"
founderr=true
elseif strLength(content)>MaxBoardSize then
ErrMsg=ErrMsg+"<Br>"+"<li>留言内容不得大于" & CSTR(MaxBoardSize) & "bytes"
FoundErr=true
end if
if founderr=true then
call error(errmsg)
exit sub
end if
min=minute(now)
if len(min)=1 then min="0"&min
edittime=year(date)&"-"&month(date)&"-"&day(date)&" "&hour(now)&":"&min
if bisclsadm=true or bisystemadmin=true then
char_changed = "[align=right][color=#000066][此留言已被"&getrealname(membername)&"于"&edittime&"编辑过][/color][/align]"
else
char_changed = "[align=right][color=#000066][此留言已被作者于"&edittime&"编辑过][/color][/align]"
end if
Body=Content+chr(13)+chr(10)+chr(13)+chr(10)+char_changed+chr(13)
mood=request.form("mood")&".gif"
sql="update [classboard] set title='"&title&"',mood='"&mood&"',content='"&body&"' where id="&clng(bbsid)
conn.execute(sql)
sql="update [student] set point=point+"&pEditBoard&" where userid='"&membername&"'"
conn.execute(sql)
stitle="修改留言"
smsg="您已经成功的修改了班级留言!"
call success(stitle,smsg)
set rs=nothing
call endconnection()
end sub
rem ---------------------------------------------------------------------
sub saveboard()
if request.servervariables("content_length")=0 then
Errmsg=Errmsg+"<br>"+"<li>没有操作请求!您正试图进行非法操作。"
founderr=true
call error(errmsg)
else
if request.form("title")="" then
Errmsg=Errmsg+"<br>"+"<li>请确认输入了留言主题。"
founderr=true
else
title=trim(request.form("title"))
end if
content=rtrim(request.form("content"))
if content="" then
Errmsg=Errmsg+"<br>"+"<li>留言内容不能为空。"
founderr=true
elseif strLength(content)>MaxBoardSize then
ErrMsg=ErrMsg+"<Br>"+"<li>留言内容不得大于" & CSTR(MaxBoardSize) & "bytes"
FoundErr=true
end if
if founderr=true then
call error(errmsg)
else
call savedata()
call signsuccess()
end if
end if
call endconnection()
end sub
sub savedata()
dim rs
name=request.form("name")
min=minute(now())
if len(min)=1 then min="0"&min
adddate=year(date())&"-"&month(date())&"-"&day(date())&" "&hour(now())&":"&min
Set rs = Server.CreateObject("ADODB.Recordset")
rs.open "classboard",conn,1,3
rs.addnew
rs("ip")=Request.ServerVariables("REMOTE_ADDR")
rs("name")=request.form("name")
rs("title")=title
rs("mood")=request.form("mood")&".gif"
rs("content")=content
rs("adddate")=adddate
rs("classid")=clng(request.form("clsid"))
rs.update
rs.close
StrSQL = "update [student] set point=point+"&pSignBoard&" where userid='"&name&"'"
conn.execute(StrSQL)
StrSQL = "select distinct email from [student] where classid="&clng(request.form("clsid"))&" and NewAnnounceFlag=true and userid<>'"&membername&"'"
set rs=conn.execute(StrSQL)
if not rs.eof and EmailFlag<>0 then
mailto=rs("email")
rs.movenext
do until rs.eof
mailto=mailto&","&rs("email")
rs.movenext
loop
StrSQL = "select classname from [class] where classid="&clng(request.form("clsid"))
set rs=conn.execute(StrSQL)
mailfrom=SystemEmail
mailtopic="新班级留言"
crlf=chr(13)&chr(10)
mailbody=crlf&"您好!您的班级:"&rs("classname")&"有新留言,请注意查看!"&crlf&crlf
mailbody=mailbody&" -------"&SchoolMateName&crlf
mailbody=mailbody&" "&SchoolmateURL&clf
on error resume next
if EmailFlag=1 then
call jmail()
elseif EmailFlag=2 then
call Cdonts()
elseif EmailFlag=3 then
call aspemail()
end if
end if
set rs=nothing
end sub
sub signsuccess()
response.write "<meta http-equiv=refresh content=""2;URL=classboard.asp"">"
response.write "<br><br><table cellpadding=0 cellspacing=1 border=0 width=85% bgcolor="&tablebordercolor&" align=center>"&_
"<tr><td><table cellpadding=3 cellspacing=1 border=0 width=""100%"">"&_
"<tr align=center><td width=100% bgcolor="&tabletitlecolor&"><b><FONT COLOR="&TableFontcolor&">状态:发表留言成功</font></b></td>"&_
"</tr><tr><td width=100% bgcolor="&tablebodycolor2&">"&_
"<FONT COLOR="&TableContentcolor&">本页面将在2秒后自动返回班级留言页面<br><ul>"&_
"<li><a href=classboard.asp><font color="&TableContentcolor&">返回留言簿</font></a></li>"&_
"</ul></td></tr></table></td></tr></table>"
end sub
sub confirm()
bbsid=request("id")
set rs=conn.execute("select * from [classboard] where id="&bbsid)
if rs.eof or rs.bof then
errmsg=errmsg+"<br>"+"<li>非法操作,该留言信息不存在"
call error(errmsg)
else
%><br><br>
<script language="JavaScript" src="script/jsfun.js"></script>
<form style="MARGIN: 0px" name="frmtconfirm" action="classboard.asp" method="post"
onsubmit="return submitonce(this)">
<input type="hidden" name="bbsid" value="<%=bbsid%>">
<input type="hidden" name="action" value="delete">
<table cellpadding=0 cellspacing=0 border=0 width=350 bgcolor=<%=TableborderColor%> align=center>
<tr>
<td>
<table cellpadding=5 cellspacing=1 border=0 width=100%>
<tr align="center">
<td width="100%" bgcolor=<%=TabletitleColor%>><font color="<%=TableFontColor%>"><b>同学录提示信息</b></font></td>
</tr>
<tr>
<td width="100%" bgcolor=<%=TablebodyColor2%> class=mp align=center valign=center><font color="<%=TableContentColor%>"><br>
<img src=images/question1.gif> 您是否真的要删除<%if isclassadmin(0)=true then response.write "<font color=#cc0000><b>"&getrealname(rs("name"))&"</b></font>同学" else response.write "您" end if%>的留言?<br><br></font>
</td>
</tr>
<tr align="center">
<td width="100%" bgcolor=<%=TabletitleColor%>>
<input style="WIDTH: 80px; HEIGHT: 20px" type="submit" value="确认" name="submit">
<input style="WIDTH: 80px; HEIGHT: 20px" type="button" value="取消"
onclick="javascript:history.go(-1)">
</td>
</tr>
</table> </td></tr></table></form>
<%
end if
set rs=nothing
call endconnection()
end sub
sub delete()
dim rs,sql
bbsid=request.form("bbsid")
if bbsid="" then
errmsg=errmsg+"<br>"+"<li>没有操作请求,您正试图进行非法操作!"
founderr=true
call error(errmsg)
exit sub
end if
sql="select name,classid from [classboard] where id="&bbsid
set rs=conn.execute(sql)
if rs.eof then
errmsg=errmsg+"<br>"+"<li>非法操作,该留言信息不存在!"
founderr=true
else
bisclsadm=isclassadmin(0)
if bisclsadm=true and clsid<>rs("classid") then
errmsg=errmsg+"<br>"+"<li>非法操作,您无权删除其他班级同学的留言!"
founderr=true
elseif bisystemadmin=false and bisclsadm=false and rs("name")<>membername then
errmsg=errmsg+"<br>"+"<li>非法操作,您无权删除班内其他同学的留言!"
founderr=true
end if
end if
if founderr=true then
call error(errmsg)
exit sub
end if
sql="update [student] set point=point+"&pDelBoard&" where userid='"&rs("name")&"'"
conn.execute(sql)
sql="delete from [classboard] where id="&bbsid
conn.execute(sql)
stitle="删除留言"
smsg="您已经成功的删除了班级留言!"
call success(stitle,smsg)
set rs=nothing
call endconnection()
end sub
%>
<!--#INCLUDE FILE="footer.asp" -->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -