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

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


filename="0"
set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open "select id,filename from [News] where ID="&ID&" order by id desc",conn,1,1
if rs.recordcount<>0 then
	filename=rs("filename")
end if
rs.close:set rs=nothing

url=hrefID(ID,filename)

if action="" then
	Response.Redirect "newspl.asp?id="&id
else
	Response.Redirect URL
end if

conn.close
set conn=nothing
%>