<% response.charset="gb2312" Chk_Admin_Login() Action=zhcx.CheckRequest(request("Action")) Select Case lcase(Action) Case "del" Call Del() Case "save" Call Save() Case else zhcx.ErrAlert("非法操作") end select Sub Del() Dim Id,pathhtml,class_Id Id=zhcx.checkstr(request("Id")) if Id="" then zhcx.ErrAlert("参数错误") end if For i=0 to ubound(split(Id,",")) Sql="Select Id,pathhtml,Class_Id From Z_news where Id="&zhcx.checknumeric(split(Id,",")(i)) Set rs=zhcx.conn(sql) if not rs.eof then pathhtml=trim(rs(1)) Class_Id=rs(2) rs.delete end if rs.close set rs=nothing '删除文件 Call Del_file(Syspath&pathhtml) Next Call zhcx.SuccHref("删除成功","sDir.asp?Class_Id="&class_Id,"self") End Sub Sub Save() Id=zhcx.checknumeric(request("Id")) Class_Id=zhcx.checknumeric(request("Class_Id")) Title=zhcx.checkStr(request("Title")) Click_num=zhcx.checknumeric(request("Click_num")) Autor=zhcx.checkStr(request("Autor")) Tag=zhcx.checkStr(request("Tag")) UpdateTime=zhcx.checkStr(request("UpdateTime")) P_title=zhcx.checkStr(request("P_title")) P_keyword=zhcx.checkStr(request("P_keyword")) P_description=zhcx.checkStr(request("P_description")) pathhtml=getClassPath(class_Id)&"/"&getPath(Class_Id) Content=request("Content") if Content<>"" then else zhcx.ErrAlert("内容不能为空") end if if not Isdate(UpdateTime) then UpdateTime=now end if if P_title<>"" then else P_title=Title end if if P_keyword<>"" then else P_keyword=Title end if if P_description<>"" then else P_description=trim(content) P_description=trim(titlen(RemoveHTML(P_description),100,0)) end if Sql="Select * From Z_news where Id="&Id Set rs=zhcx.conn(sql) if not rs.eof then '修改 Str="修改成功" else Str="添加成功" rs.addnew rs("addTime")=Now rs("fk_rnd")=getRnd() rs("pathhtml")=pathhtml end if rs("Class_Id")=Class_Id rs("Title")=Title rs("Content")=Content rs("P_title")=P_title rs("P_keyword")=P_keyword rs("P_description")=P_description rs("UpdateTime")=UpdateTime rs("Click_num")=Click_num rs("Autor")=Autor rs("Tag")=Tag rs.update rs.close set rs=nothing if Id=0 then Id=getNewsTopId(Class_Id) End if '生成新闻页面 Randomize Call zhcx.SuccHref(Str,"url.asp?Id="&Id,"self") End Sub Function getNewsTopId(Class_Id) Sql="Select Id From Z_News where Class_Id="&Class_Id&" order by id desc" Set rs=zhcx.conn(sql) if not rs.eof then getNewsTopId=rs(0) else exit function End if rs.close set rs=nothing End Function function getPath(Class_Id) dim sql,rs,info Sql="Select top 1 Id From Z_News where Class_Id="&Class_Id&" order by id desc" Set rs=zhcx.conn(sql) if not rs.eof then info=rs(0) else info=0 end if rs.close set rs=nothing info=year(now)&month(now)&day(now)&"/"&right("000000"&info,6)&".html" getPath=info end function %>