<!--#include virtual="/incs/config.asp" -->
<%
chk_log()
chk_newpwr 4,0,0
module=trim(SafeRequest("module"))
select case module
case "pwr_add" '产品类型添加

pwr_str=""
for i=0 to 31
pwrstr="1234567890"
pwrrequests=SafeRequest("p"&i)
pwrrequests=replace(pwrrequests," ","")
   pwrrequest_sgl=split(pwrrequests,",")
   for j=0 to ubound(pwrrequest_sgl)
   pwrstr=replace(pwrstr,pwrrequest_sgl(j),"a")
   next
pwr_str=pwr_str&","&pwrstr  
next
pwr_str=replace(pwr_str,"1","0")
pwr_str=replace(pwr_str,"2","0")
pwr_str=replace(pwr_str,"3","0")
pwr_str=replace(pwr_str,"4","0")
pwr_str=replace(pwr_str,"5","0")
pwr_str=replace(pwr_str,"6","0")
pwr_str=replace(pwr_str,"7","0")
pwr_str=replace(pwr_str,"8","0")
pwr_str=replace(pwr_str,"9","0")
pwr_str=replace(pwr_str,"a","1")

if left(pwr_str,1)="," then
pwr_str=right(pwr_str,len(pwr_str)-1)
end if
if right(pwr_str,1)="," then
pwr_str=left(pwr_str,len(pwr_str)-1)
end if
   substrContent = "entryclass:sys_mng"&Vend
   substrContent =substrContent& "entrytype:pwr_add"&Vend
   substrContent =substrContent& "entryuser:"&entryuser&Vend
   substrContent =substrContent& "entrypass:"&entrypass&Vend
   substrContent =substrContent& "agentname:"&agentname&Vend
   substrContent =substrContent& "agentpass:"&agentpass&VEnd
   substrContent = substrContent & "pw_nme:" &trim(SafeRequest("pw_nme"))& Vend
   substrContent = substrContent & "pw_cnt:" &trim(SafeRequest("pw_cnt"))& Vend
   substrContent = substrContent & "pw_str:" &pwr_str& Vend
   substrContent = substrContent & "pw_cls:" &trim(SafeRequest("pw_cls"))& Vend
   substrContent = substrContent & "." & Vend

case "pwr_edt" '产品类型添加

pwr_str=""
for i=0 to 31
pwrstr="1234567890"
pwrrequests=SafeRequest("p"&i)
pwrrequests=replace(pwrrequests," ","")
   pwrrequest_sgl=split(pwrrequests,",")
   for j=0 to ubound(pwrrequest_sgl)
   pwrstr=replace(pwrstr,pwrrequest_sgl(j),"a")
   next
pwr_str=pwr_str&","&pwrstr  
next
pwr_str=replace(pwr_str,"1","0")
pwr_str=replace(pwr_str,"2","0")
pwr_str=replace(pwr_str,"3","0")
pwr_str=replace(pwr_str,"4","0")
pwr_str=replace(pwr_str,"5","0")
pwr_str=replace(pwr_str,"6","0")
pwr_str=replace(pwr_str,"7","0")
pwr_str=replace(pwr_str,"8","0")
pwr_str=replace(pwr_str,"9","0")
pwr_str=replace(pwr_str,"a","1")

if left(pwr_str,1)="," then
pwr_str=right(pwr_str,len(pwr_str)-1)
end if
if right(pwr_str,1)="," then
pwr_str=left(pwr_str,len(pwr_str)-1)
end if

pw_nme_new=SafeRequest("pw_nme_new")
if trim(pw_nme_new)<>"" and   instr(pw_nme_new,"新组名")<=0  then
  module="pwr_add"
   substrContent = "entryclass:sys_mng"&Vend
   substrContent =substrContent& "entrytype:pwr_add"&Vend
   substrContent =substrContent& "entryuser:"&entryuser&Vend
   substrContent =substrContent& "entrypass:"&entrypass&Vend
   substrContent =substrContent& "agentname:"&agentname&Vend
   substrContent =substrContent& "agentpass:"&agentpass&VEnd
   substrContent = substrContent & "pw_nme:" &pw_nme_new& Vend
else
   substrContent = "entryclass:sys_mng"&Vend
   substrContent =substrContent& "entrytype:pwr_edt"&Vend
   substrContent =substrContent& "entryuser:"&entryuser&Vend
   substrContent =substrContent& "entrypass:"&entrypass&Vend
   substrContent =substrContent& "agentname:"&agentname&Vend
   substrContent =substrContent& "agentpass:"&agentpass&VEnd
   substrContent = substrContent & "pwid:" &trim(SafeRequest("pwid"))& Vend
   substrContent = substrContent & "pw_nme:" &trim(SafeRequest("pw_nme"))& Vend

end if
   substrContent = substrContent & "pw_str:" &pwr_str& Vend
   substrContent = substrContent & "pw_cnt:" &trim(SafeRequest("pw_cnt"))& Vend
   substrContent = substrContent & "pw_cls:" &trim(SafeRequest("pw_cls"))& Vend
   substrContent = substrContent & "." & Vend
pageturn="/master/sysmng/pwr_mng/pwr_edt.asp?pwid="&trim(SafeRequest("pwid"))

case "pwr_del" '产品类型添加

   substrContent = "entryclass:sys_mng"&Vend
   substrContent =substrContent& "entrytype:pwr_del"&Vend
   substrContent =substrContent& "entryuser:"&entryuser&Vend
   substrContent =substrContent& "entrypass:"&entrypass&Vend
   substrContent =substrContent& "agentname:"&agentname&Vend
   substrContent =substrContent& "agentpass:"&agentpass&VEnd
   substrContent = substrContent & "pwid:" &trim(SafeRequest("pwid"))& Vend
   substrContent = substrContent & "." & Vend
pageturn="/master/sysmng/pwr_mng/pwr_lst.asp"

case "pwr_mem_add" '产品类型添加

   substrContent = "entryclass:sys_mng"&Vend
   substrContent =substrContent& "entrytype:pwr_mem_add"&Vend
   substrContent =substrContent& "entryuser:"&entryuser&Vend
   substrContent =substrContent& "entrypass:"&entrypass&Vend
   substrContent =substrContent& "agentname:"&agentname&Vend
   substrContent =substrContent& "agentpass:"&agentpass&VEnd
   substrContent = substrContent & "pwid:" &trim(SafeRequest("pwid"))& Vend
   substrContent = substrContent & "u_nme:" &trim(SafeRequest("u_nme"))& Vend
   substrContent = substrContent & "." & Vend
pageturn="/master/sysmng/pwr_mng/pwr_mem.asp?k_tpe=pwr&k_wrds="&trim(SafeRequest("pwid"))

end select
   doresult = hzsocket(substrContent)
   left5=left(doresult,5)
   If left5= "10000" Then
     if module="pwr_add" then
	 pageturn="/master/sysmng/pwr_mng/pwr_edt.asp?pwid="&getval(doresult,"pw_id")
	 end if
      call okpage(pageturn)
   Else
      call errorpage(-2,doresult)
   end if



%>
