<!--#include file = admin_conn.asp -->

<%
function chkhtm(stra)
  stra=replace(stra,"<","&lt;")
  stra=replace(stra,">","&gt;")
  stra=replace(stra,"'","")
  stra=replace(stra,"(","£¨")
  stra=replace(stra,")","£©")
  stra=replace(stra,";","£»")
  stra=replace(stra,",","£¬")
  stra=replace(stra,"%","£¥")
  stra=replace(stra,"+","£«")
  chkhtm=stra
end function

id=int(chkhtm(trim(request("id"))))
action=trim(request("action"))
username=chkhtm(trim(request("username")))
content=chkhtm(trim(request("content")))
addtime=date()

userip = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If userip = "" Then userip = Request.ServerVariables("REMOTE_ADDR")

if id<>"" and username<>"" and content<>"" then
  conn.Execute = "insert into newspl (username,content,addtime,ip,newsid) values('"&username&"','"&content&"','"&addtime&"','"&userip&"',"&id&")"
end if

conn.close
set conn=nothing

if action="" then
	Response.Redirect "newspl.asp?id="&id
else
	Response.Redirect "news_view.asp?newsid="&id
end if
%> 
