<!--#include file = "tuzh_pri.asp"-->
<!--#include file="../connadmin.asp"-->
<!--#include file = "../setup.asp"-->

<%action=request("action")
select case action
    case "addnews"  call addnews()
	case "delenews" call delenews()
	case "modi" call modi()
end select
function checkpic(picstr)
		checkpic=""
	if left(picstr,17)="image/uploadfile/" then
		if  lcase(right(picstr,3))="gif" or lcase(right(picstr,3))="jpg" or lcase(right(picstr,3))="bmp" then
		checkpic=picstr
		end if
	end if
end function
'***********************************************************
sub addnews()
shoupic=HX_Replace(request.form("shoupic"))
yiid=HX_Replace(request.form("langmu"))
erid=HX_Replace(request.form("langmu2"))
title=HX_Replace(request.form("txttitle"))
For i = 1 To Request.Form("content").Count
  Content = Content & Request.Form("content")(i)
Next
'sql="insert into [news] (yiid,erid,title,content,shoupic) values("&yiid&","&erid&",'"&title&"','"&content&"','"&shoupic&"')"
'conn.execute sql 

set rs1=server.createobject("ADODB.recordset")
sql="select * from news"
rs1.open sql,conn,3,3
			rs1.addnew
			rs1("yiid") = yiid
			rs1("title") = title
			rs1("erid") = erid
			rs1("shoupic") = shoupic  'checkpic(shoupic)
			rs1("content") = Content
			rs1.update
rs1.close

end sub
'***********************************************************
sub delenews()
delstyle=request("style")
deleid=request("id")
if delstyle="many" then
for i=1 to request.form("ArticleID").count
conn.execute("delete from news where id="&cint(request.form("ArticleID")(i)))
next

else
sql="delete from [news] where id="&cint(deleid)&""
conn.execute sql 
end if
end sub
'***********************************************************
sub modi()
shoupic=HX_Replace(request.form("shoupic"))
yiid=HX_Replace(request.form("langmu"))
erid=HX_Replace(request.form("langmu2"))
title=HX_Replace(request.form("txttitle"))
'newstime=request.form("newstime")
For i = 1 To Request.Form("content").Count
  Content = Content & Request.Form("content")(i)
Next
set rs=server.createobject("ADODB.recordset")
sql="select * from news where id="&cint(request("newsid"))
rs.open sql,conn,1,3
			rs("yiid") = yiid
			rs("title") = title
			rs("erid") = erid
			rs("content") = content
			rs("shoupic") = checkpic(shoupic)
			'rs("newstime") = newstime
			rs.update
rs.close
end sub
'***********************************************************
conn.close
%>
<script>window.location.href ="manage.asp"</script>