 <% 
	data_path="../" 
	numid="51"
	dir="../err.asp" 
  %>
 <!--#include file="../conn/conn.asp"-->
<%
id=Request("tyid")
//response.write id
 pl_name=request.form("userName")
 pl_nrong=request.form("fcontent")
 pl_sx=request.form("hasName")
pl_nrong=replace(pl_nrong,"<","[")
pl_nrong=replace(pl_nrong,">","]")
		Set rs1= Server.CreateObject("ADODB.Recordset") 
	sq1="select * from websen_Dirty where type=1"
rs1.open sq1,conn,3,3
Dirty=rs1("Dirty")
gl="******"
bytes=split(Dirty,",")

     for ii=0 to ubound(bytes)
         
	  pl_nrong=replace(pl_nrong,trim(bytes(ii)),gl)

  next
rs1.close
//Rem 判断验证码输入是否正确的函数
Function ValidCode(pSN,k,c)
	Dim s,i
	s = Session(pSN)
	k = ";"&k&":"
	ValidCode = False
	i = InStr(s,k)
	If i > 0 Then
		If InStr(s,k&c&";") > 0 Then ValidCode = True
		Session(pSN) = Left(s,i) & Right(s,Len(s)-InStr(i+1,s,";"))
	End If
End Function

if pl_sx ="" then
pl_sx=0
else
pl_sx=1
end if
set rs12=server.CreateObject("adodb.recordset")
sql="select count(*) as co from websen_Review where pl_name='"&pl_name&"'"
rs12.open sql,conn,1,3
co=rs12("co")
if co<>0 and pl_sx=0 then
set rs123=server.CreateObject("adodb.recordset")
sql="select * from websen_Review where pl_name='"&pl_name&"'"
pl_Name=rs123("pl_name")
if pl_Name<>"" then
response.Write("<script>alert('名称已存在');history.back(-1)</script>")
response.End()
rs123.open sql,conn,1,3
end if
rs123.close
rs12.close
end if
set rss=server.CreateObject("adodb.recordset")
sp1="select typeid,title,newsid, pl_date from  websen_news where newsid="&id
rss.open sp1,conn,1,3
 rss("pl_date")=now()
 rss.update
 pl_typeid=rss("typeid")
 pl_title=rss("title")
 pl_newsid=rss("newsid")
 rss.close
set rs=server.CreateObject("adodb.recordset")
spl="select * from  websen_Review where pl_newsid="&id
rs.open spl,conn,1,3
rs.addnew
rs("pl_time")=now()
rs("pl_nrong")=pl_nrong
rs("pl_typeid")=pl_typeid
rs("pl_title")=pl_title
rs("pl_newsid")=pl_newsid
If Request.Form("code") <> "" Then
	If ValidCode("CSName",Request.Form("codeKey"),Request.Form("code")) Then
if pl_sx=1 then
rs("pl_name")="本站网友"
rs("pl_sx")=1
rs.update
else
rs("pl_name")=pl_name
rs("pl_sx")=pl_sx
rs.update
end if
response.Write("<script>alert('保存成功！间隔不要过快！');window.location.href='asb.asp?id="&id&"'</script>")
Else
response.write("<script language='javascript'>alert('验证码错误！');window.location.href='asb.asp?id="&id&"'</script>")
	End If
	
	Response.End
End If
rss.close
rs.close
%>

