📄 classboard.asp
字号:
<tr bgcolor="<%=tablebodycolor1%>">
<td height="30" align="center" colspan=2><input
style="WIDTH: 90px; HEIGHT: 20px" type="submit" value="提交留言" name="sbmt">
<input style="WIDTH: 90px; HEIGHT: 20px" type="reset" value="清除重写"
name="reset"> </td>
</tr>
</table>
</form>
</body>
</html>
<script language="javascript">
function checklength(theform) {
var ly=frmgbk.content.value;
var strlen=strlength(ly);
alert("您的留言长度为 "+strlen+" 字符.");
}
</script>
<%end sub
rem ================================================================
sub editform()
bbsid=request("id")
set rs=conn.execute("select * from [classboard] where id="&bbsid)
if rs.eof and rs.bof then
errmsg=errmsg+"<br>"+"<li>操作失败,该留言信息不存在!"
call error("Exclamation",errmsg)
else
%>
<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="page" value="<%=request("page")%>">
<input type="hidden" name="action" value="modify">
<table border="0" cellspacing="1" width="100%" cellpadding="4"
bgcolor="<%=tablebordercolor%>">
<tr bgcolor="<%=tabletitlecolor%>">
<th height="20" align="center" colspan=2>
<b>修改班级留言</b></th>
<tr bgcolor="<%=tablebodycolor2%>">
<td height="13" width=30%> <b>留 言 人</b></td><td>
<%=htmlencode(getrealname(rs("name")))%></td>
</tr>
<tr bgcolor="<%=tablebodycolor2%>">
<td height="13"> <b>留言主题</b></td><td> <input size="38" name="title" value=<%=htmlencode(rs("title"))%>></td>
</tr>
<tr bgcolor="<%=tablebodycolor2%>">
<td height="13"> <b>留言心情</b></td><td><br><table border=0 width=100%><tr><td>
<%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="mood/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=120> <B>留言内容</B><BR><br><li>HTML标签:<font color=brown>OFF</font><BR><li>UBB标签:<%if ubbflag=true then response.write "<font color=#003399>ON" else response.write "<font color=brown>OFF"%></font><BR><li>最大长度:<font color=brown><%=MaxBoardSize%>KB</font><BR><BR><a href="javascript:openScript('help.asp?about=ubb',670,500)" style="cursor:help"><IMG SRC="IMAGES/help.gif" WIDTH="42" HEIGHT="17" BORDER=0 ALT="查看UBB代码使用说明"></a>
</td>
<td> <textarea name="content" rows="10" cols="50" ><%=rs("content")%></textarea></td>
</tr>
<tr bgcolor="<%=tablebodycolor1%>">
<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>
<%
end if
set rs=nothing
end sub
rem ====================================================================
sub modify()
bbsid=request.form("bbsid")
if bbsid="" then
errmsg=errmsg+"<br>"+"<li>没有操作请求,您正试图进行非法操作!"
founderr=true
call error("Exclamation",errmsg)
exit sub
end if
sql="select name,classid from [classboard] where id="&bbsid
set rs=conn.execute(sql)
bisclsadm=isclassadmin(0)
if bisclsadm<>0 and clng(clsid)<>rs("classid") then
errmsg=errmsg+"<br>"+"<li>非法操作,您无权修改其他班级同学的留言!"
founderr=true
elseif not sysadmin and bisclsadm=false and rs("name")<>membername then
errmsg=errmsg+"<br>"+"<li>非法操作,您无权修改班内其他同学的留言!"
founderr=true
end if
if founderr=true then
errorlevel="Exclamation"
call error(errorlevel,errmsg)
exit sub
end if
if request.form("title")="" then
Errmsg=Errmsg+"<br>"+"<li>请确认输入了留言主题。"
founderr=true
else
title=checkstr(trim(request.form("title")))
end if
content=checkstr(rtrim(request.form("content")))
if content="" then
Errmsg=Errmsg+"<br>"+"<li>留言内容不能为空。"
founderr=true
elseif strLength(content)>(MaxBoardSize*1024) then
ErrMsg=ErrMsg+"<Br>"+"<li>留言内容不得大于"&MaxBoardSize& "KBytes"
FoundErr=true
end if
if founderr=true then
errorlevel="Information"
call error(errorlevel,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 sysadmin then
char_changed = "[align=right][此留言已被"&getrealname(membername)&"于"&edittime&"编辑过][/align]"
else
char_changed = "[align=right][此留言已被作者于"&edittime&"编辑过][/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)
rURL="classboard.asp?page="&request("page")
rtitle="修改留言成功"
rmsg="<FONT COLOR="&TableContentcolor&">本页面将在2秒后自动返回班级留言页面<br><ul>"&_
"<li><a href=classboard.asp?page="&request("page")&"><font color="&TableContentcolor&">返回留言簿</font></a></li>"&_
"</ul>"
redirect 2,rurl,rtitle,rmsg
set rs=nothing
end sub
rem ---------------------------------------------------------------------
sub saveboard()
if not isnull(session("lastpost")) then
if DateDiff("s",session("lastpost"),Now())<10 then
ErrMsg=ErrMsg+"<Br>"+"<li>留言簿限制发言间隔时间为10秒,请稍后再发。"
call error("Exclamation",errmsg)
session("lastpost")=Now()
exit sub
end if
end if
if chkpost=false then
ErrMsg=ErrMsg+"<Br>"+"<li>您提交的数据不合法,请不要从同学录外部提交信息。"
founderr=true
exit sub
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*1024) then
ErrMsg=ErrMsg+"<Br>"+"<li>留言内容不得大于"&MaxBoardSize&"KBytes"
FoundErr=true
end if
end if
if founderr=true then
call error("Exclamation",errmsg)
session("lastpost")=Now()
else
call savedata()
session("lastpost")=Now()
rURL="classboard.asp"
rtitle="发表留言成功"
rmsg="<FONT COLOR="&TableContentcolor&">本页面将在2秒后自动返回班级留言页面<br><ul>"&_
"<li><a href=classboard.asp><font color="&TableContentcolor&">返回留言簿</font></a></li>"&_
"</ul>"
redirect 2,rurl,rtitle,rmsg
end if
end sub
sub savedata()
dim rs
Set rs = Server.CreateObject("ADODB.Recordset")
rs.open "classboard",conn,1,3
rs.addnew
rs("ip")=Request.ServerVariables("REMOTE_ADDR")
rs("name")=membername
rs("title")=title
rs("mood")=request.form("mood")&".gif"
rs("content")=content
rs("signtime")=now()
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 NewAnnounceFlag=true and userid in (select userid from joinclass where classid="&clng(request.form("clsid"))&" 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
if EmailFlag=1 then
call jmail_smtp()
elseif EmailFlag=2 then
call Cdonts()
elseif EmailFlag=3 then
call aspemail()
elseif EmailFlag=4 then
call jmail_msg()
end if
end if
set rs=nothing
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>非法操作,该留言信息不存在"
errorlevel="Exclamation"
call error(errorlevel,errmsg)
else
%><br><br>
<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="page" value="<%=request("page")%>">
<input type="hidden" name="action" value="delete">
<table cellpadding=0 cellspacing=0 border=0 width=90% bgcolor=<%=TableborderColor%> align=center>
<tr>
<td>
<table cellpadding=5 cellspacing=1 border=0 width=100%>
<tr align="center">
<th width="100%" bgcolor=<%=TabletitleColor%>><font color="<%=TableFontColor%>"><b>同学录提示信息</b></font></th>
</tr>
<tr bgcolor=<%=TablebodyColor2%>> <td><table width=100% height=100% bgcolor=<%=TablebodyColor2%>><tr>
<td width=80 class=mp align=center valign=center>
<img src=images/question.gif></td><td><font color="<%=TableContentColor%>"> 您是否真的要删除<%if isclassadmin(0)=true then response.write "<font color=#cc0000><b>"&getrealname(rs("name"))&"</b></font>同学" else response.write "您" end if%>的留言?</font></td></tr></table>
</td>
</tr>
<tr align="center">
<td width="100%" bgcolor=<%=TablebodyColor1%>>
<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
end sub
sub delete()
dim rs,sql
bbsid=request.form("bbsid")
if bbsid="" then
errmsg=errmsg+"<br>"+"<li>没有操作请求,您正试图进行非法操作!"
founderr=true
errorlevel="Critical"
call error(errorlevel,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<>0 and clng(clsid)<>rs("classid") then
errmsg=errmsg+"<br>"+"<li>非法操作,您无权删除其他班级同学的留言!"
founderr=true
elseif not sysadmin and bisclsadm=false and rs("name")<>membername then
errmsg=errmsg+"<br>"+"<li>非法操作,您无权删除班内其他同学的留言!"
founderr=true
end if
end if
if founderr=true then
errorlevel="Exclamation"
call error(errorlevel,errmsg)
exit sub
end if
sql="update [student] set point=point+"&pDelBoard&" where userid='"&rs("name")&"'"
conn.execute(sql)
set rs=nothing
sql="delete from [classboard] where id="&bbsid
conn.execute(sql)
rURL="classboard.asp?page="&request("page")
rtitle="删除留言成功"
rmsg="<FONT COLOR="&TableContentcolor&">本页面将在2秒后自动返回班级留言页面<br><ul>"&_
"<li><a href=classboard.asp?page="&request("page")&"><font color="&TableContentcolor&">返回留言簿</font></a></li>"&_
"</ul>"
redirect 2,rurl,rtitle,rmsg
end sub
function isOnline(UserName)
dim ors
set ors=conn.execute("select userid from online where userid='"&username&"'")
if ors.eof and ors.bof then
isonline="<img src=images/isofF.gif alt=离线! height=17 hspace=4>"
else
isonline="<img src=images/ison.gif alt=在线!快来找我吧! height=17 hspace=4>"
end if
ors.close
set ors=nothing
end function
call footer()
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -