comment_save.asp

来自「新闻管理系统,管理员登陆后能够实现对新闻的添加,删除以及更新等功能,操作比较简单」· ASP 代码 · 共 53 行

ASP
53
字号
<!--#include file="conn.asp"-->
<!--#include file="data.asp"-->
<!--#include file="char.asp"-->
<!--#include file="header.inc"-->
<%
dim id,mailX,CommentX
If IsEmpty(request("id")) Then
errorstr="URL错误"
errorbox(errorstr)
End If
id=request("id")
set rs=conn.execute("select ID,PingLun from newsdata where id="&id&"")
if rs.bof and rs.bof then
       errorstr="该主题不存在"
       errorbox(errorstr)
	   Else
If rs("PingLun")=0 Then
       errorstr="该主题不不接受评论"
       errorbox(errorstr)
End If
End If
rs.close
set rs=nothing
	mailX=replace(trim(request("MailX")),"'","")
	CommentX=replace(trim(Request("CommentX")),"'","")
    if mailX="" or CommentX="" then
     errorstr="必须项为空时系统不接受"
     errorbox(errorstr)
	end if
If Not IsValidEmail(mailX) Then
     errorstr="系统否认您的E-Mail"
     errorbox(errorstr)
End If
mailX = checkStr(mailX)
mailX = HTMLEncode(mailX)
set rs=conn.execute("select ID,DataID,MailX from Comment where DataID="&id&" and MailX='"&mailX&"'")
if not rs.bof and not rs.bof then
       errorstr="E-Mail被占用.系统否认重复的E-Mail评论同一主题"
       errorbox(errorstr)
End If
rs.close
set rs=nothing
CommentX = checkStr(CommentX)
CommentX = HTMLEncode(CommentX)
If strLength(CommentX) > 250 Then
       errorstr="您所提交的字节超出系统限定"
       errorbox(errorstr)
End If
  conn.execute("insert into Comment(dataid,mailX,CommentX) values ('"&id&"','"&mailX&"','"&CommentX&"')")
  Successstr="您所提交的评论已经成功存储入"
  Successbox(Successstr)
%>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?