<!--#include file="conn.asp"-->
<!--#include file="chkadmin.asp"-->
<!--#include file="inc/char.asp"-->
<%dim id,ClassName
id=Cint(Trim(Request.Form("id")))
ClassName=Trim(Request.Form("ClassName"))

dim errmsg,founderr
founderr=false

if chkadmin=true and power(5)="0" then
	founderr=true
	errmsg=errmsg+"<li>您没有修改分类的权限</li>"
end if

if ClassName="" then
	founderr=true
	errmsg=errmsg+"<li>类别名称不能为空</li>"
elseif strlen(ClassName)>20 then
	founderr=true
	errmsg=errmsg+"<li>类别名称应在20个字符内</li>"
end if

if founderr=false then
	conn.execute("update Class set ClassName='"&ClassName&"' where ID="&id)
	dim sql,rs
	sql="select ParentID from Class where ID="&id
	set rs=conn.execute(sql)
	dim gourl,msg
	gourl="class_list.asp?id="&rs(0)
	msg="分类修改成功！"
	set rs=nothing
	call ok()
else
	call error()
end if

conn.close
set conn=nothing
%>