<!-- #include file="include/onlogin.asp" -->
<!-- #include file="include/config_edit.asp" -->
<!-- #include file="include/jk_md5.asp" -->
<!-- #include file="include/common_other.asp" -->
<%
dim tit_menu
tit_menu="<a href='?'>配置修改</a> | "&_
	 "<a href='javascript:Do_b_data();'>备份配置</a> | "&_
	 "<a href='javascript:Do_h_data();'>还原配置</a>"
response.write header(3,tit_menu)
%>
<script language=JavaScript><!--
function Do_b_data()
{
if (confirm("此操作将 备份 现有的网站配置！\n\n真的要进行吗？\n备份后将无法恢复！"))
  window.location="?action=b"
}
function Do_h_data()
{
if (confirm("此操作将 还原 现有的网站配置！\n\n真的要进行吗？\n还原后将无法恢复！"))
  window.location="?action=h"
}
//--></script>
<%
if action="b" or action="h" then call config_bh(action)
response.write admin_bar("配置修改",1,"99%")
select case trim(request.querystring("edit"))
case "chk"
  call config_chk()
case else
  call config_main()
end select
response.write admin_bar("",2,"99%")
'response.write ender()

sub config_chk()
  dim t1,t2,tp,tps,tn
  web_font_family=code_config(request.form("web_font_family"),0):web_font_size=code_config(request.form("web_font_size"),0)
  top_pic=code_config(request.form("top_pic"),0):top_url=code_config(request.form("top_url"),0)
  top_type=code_config(request.form("top_type"),0):top_wh=code_config(request.form("top_wh"),0)
  banner_pic=code_config(request.form("banner_pic"),0):banner_url=code_config(request.form("banner_url"),0)
  banner_type=code_config(request.form("banner_type"),0):banner_wh=code_config(request.form("banner_wh"),0)
  scroll_head=code_config(request.form("scroll_head"),0)
  tp=code_config(request.form("web_config_12"),0)
  if action="config" then
    tps=code_config(request.form("web_config_12s"),0)
    if len(tps)>0 then
      tp=jk_md5(tps,"short")
      if tps="null" then tp=""
    end if
  end if
  web_config=code_config(request.form("web_config_1"),3) &"|"& code_config(request.form("web_config_2"),3) &"|"& _
	     code_config(request.form("web_config_3"),3) &"|"& code_config(request.form("web_config_4"),3) &"|"& _
	     code_config(request.form("web_config_5"),3) &"|"& code_config(request.form("web_config_6"),3) &"|"& _
	     code_config(request.form("web_config_7"),3) &"|"& code_config(request.form("web_config_8"),3) &"|"& _
	     trim(request.form("web_config_9_1")) & trim(request.form("web_config_9_2")) & _
	     trim(request.form("web_config_9_3")) & trim(request.form("web_config_9_4")) & _
	     trim(request.form("web_config_9_5")) &"|"& code_config(request.form("web_config_10"),3) &"|"& _
	     code_num(trim(request.form("web_config_11_1")),0)&":"&code_num(trim(request.form("web_config_11_2")),0) &"|"& tp
	     
  web_reg=code_config(request.form("web_reg_1"),4)&"|"&code_config(request.form("web_reg_2"),4)&"|"&_
	   code_config(request.form("web_reg_3"),4)&"|"&code_config(request.form("web_reg_4"),4)&"|"&_
	   code_config(request.form("web_reg_5"),4)&"|"&code_config(request.form("web_reg_6"),4)&"|"&_
	   code_config(request.form("web_reg_7"),4)&"|"&code_config(request.form("web_reg_8"),4)&"|"&_
	   code_config(request.form("web_reg_9"),4)&"|"&code_config(request.form("web_reg_10"),4)&"|"&_
	   code_config(request.form("web_reg_11"),4)&"|"&code_config(request.form("web_reg_12"),4)&"|"&_
	   code_config(request.form("web_reg_13"),4)&"|"&code_config(request.form("web_reg_14"),4)&"|"&_
	   code_config(request.form("web_reg_15"),4)&"|"&code_config(request.form("web_reg_16"),4)
  web_lst=code_config(request.form("web_lst_1"),4)&"|"&code_config(request.form("web_lst_2"),4)&"|"&_
	   code_config(request.form("web_lst_3"),4)&"|"&code_config(request.form("web_lst_4"),4)&"|"&_
	   code_config(request.form("web_lst_5"),4)&"|"&code_config(request.form("web_lst_6"),4)&"|"&_
	   code_config(request.form("web_lst_7"),4)&"|"&code_config(request.form("web_lst_8"),4)&"|"&_
	   code_config(request.form("web_lst_9"),4)&"|"&code_config(request.form("web_lst_10"),4)&"|"&_
	   code_config(request.form("web_lst_11"),4)&"|"&code_config(request.form("web_lst_12"),4)&"|"&_
	   code_config(request.form("web_lst_13"),4)&"|"&code_config(request.form("web_lst_14"),4)&"|"&_
	   code_config(request.form("web_lst_15"),4)&"|"&code_config(request.form("web_lst_16"),4)

  
  web_cookies=code_config(request.form("web_cookies"),3):web_login=trim(request.form("web_login")):web_skins_open=trim(request.form("web_skins_open"))
  web_setup=trim(request.form("web_setup_1"))&trim(request.form("web_setup_2"))&trim(request.form("web_setup_3"))&_
	    trim(request.form("web_setup_4"))&trim(request.form("web_setup_5"))&trim(request.form("web_setup_6"))&_
	    trim(request.form("web_setup_7"))&trim(request.form("web_setup_8"))
  web_num=code_num(trim(request.form("web_num_1")),20) &"|"& code_num(trim(request.form("web_num_2")),20) &"|"& _
	  code_num(trim(request.form("web_num_3")),10) &"|"& code_num(trim(request.form("web_num_4")),5) &"|"& _
	  code_num(trim(request.form("web_num_5")),3) &"|"& code_num(trim(request.form("web_num_6")),12) &"|"& _
	  code_num(trim(request.form("web_num_7")),150) &"|"& code_num(trim(request.form("web_num_8")),112) &"|"& _
	  code_num(trim(request.form("web_num_9")),430) &"|"& code_num(trim(request.form("web_num_10")),350) &"|"& _
	  code_num(trim(request.form("web_num_11")),24) &"|"& code_num(trim(request.form("web_num_12")),16) &"|"& _
	  code_num(trim(request.form("web_num_13")),20) &"|"& code_num(trim(request.form("web_num_14")),20) &"|"& _
	  code_num(trim(request.form("web_num_15")),2) &"|"& code_num(trim(request.form("web_num_16")),5)
  if action="menu" then
    web_menu="":tn=int(trim(request.form("web_menu_num")))
    for i=1 to tn
      t1=code_config(request.form("web_menu_"&i),4)
      if len(t1)>1 then if instr(1,t1,":")>0 then web_menu=web_menu&t1&"|"
    next
    t1=code_config(request.form("web_menu_new"),4)
    if len(t1)>1 then if instr(1,t1,":")>0 then web_menu=web_menu&t1
    if right(web_menu,1)="|" then web_menu=left(web_menu,len(web_menu)-1)
  else
    web_menu=trim(request.form("web_menu"))
  end if
  web_color=code_config(request.form("web_color_1"),2)&"|"&code_config(request.form("web_color_2"),2)&"|"&code_config(request.form("web_color_3"),2)&"|"&_
	    code_config(request.form("web_color_4"),2)&"|"&code_config(request.form("web_color_5"),2)&"|"&code_config(request.form("web_color_6"),2)&"|"&_
	    code_config(request.form("web_color_7"),2)&"|"&code_config(request.form("web_color_8"),2)&"|"&code_config(request.form("web_color_9"),2)&"|"&_
	    code_config(request.form("web_color_10"),2)&"|"&code_config(request.form("web_color_11"),2)&"|"&code_config(request.form("web_color_12"),2)
  web_upload=code_config(request.form("web_upload_1"),2)&"|"&code_config(request.form("web_upload_2"),2)&"|"&code_config(request.form("web_upload_3"),2)&"|"&_
  	     code_config(request.form("web_upload_4"),2)&"|"&code_config(request.form("web_upload_5"),2)
  web_safety=replace(trim(request.form("web_safety_1")),"""","""&chr(34)&""")&"'"&"|"&trim(request.form("web_safety_2"))&"|"&trim(request.form("web_safety_3"))&"|"&trim(request.form("web_safety_4"))
  web_error=code_config(request.form("web_error_1"),3)&"|"&code_config(request.form("web_error_2"),3)&"|"&code_config(request.form("web_error_3"),3)&"|"&code_config(request.form("web_error_4"),3)
  web_news_art=trim(request.form("web_news_art"))
  web_down=code_num(trim(request.form("web_down_1")),95)&"|"&code_num(trim(request.form("web_down_2")),75)&"|"&_
	   code_config(request.form("web_down_3"),4)&"|"&code_config(request.form("web_down_4"),4)&"|"&code_config(request.form("web_down_5"),4)
  web_shop=trim(request.form("web_shop"))
  web_stamp=code_config(request.form("web_stamp_1"),3)&"|"&code_config(request.form("web_stamp_2"),3)&"|"&code_config(request.form("web_stamp_3"),3)
  if action="user" then
    user_power="":tn=int(trim(request.form("user_power_num")))
    for i=1 to tn
      t1=code_config(request.form("user_power_"&i),4)
      if len(t1)>1 then if instr(1,t1,":")>0 then user_power=user_power&t1&"|"
    next
    t1=code_config(request.form("user_power_new"),4)
    if len(t1)>1 then if instr(1,t1,":")>0 then user_power=user_power&t1
    if right(user_power,1)="|" then user_power=left(user_power,len(user_power)-1)
  else
    user_power=trim(request.form("user_power"))
  end if
  if action="grade" then
    user_grade="":tn=int(trim(request.form("user_grade_num")))
    for i=1 to tn
      t1=code_config(request.form("user_grade_"&i),4)
      if len(t1)>1 then if instr(1,t1,":")>0 then user_grade=user_grade&t1&"|"
    next
    t1=code_config(request.form("user_grade_new"),4)
    if len(t1)>1 then if instr(1,t1,":")>0 then user_grade=user_grade&t1
    if right(user_grade,1)="|" then user_grade=left(user_grade,len(user_grade)-1)
  else
    user_grade=trim(request.form("user_grade"))
  end if
  if action="forum" then
    forum_type="":tn=int(trim(request.form("forum_type_num")))
    for i=1 to tn
      t1=replace(trim(request.form("forum_type_"&i&"_1"))," ","")
      t2=code_config(request.form("forum_type_"&i&"_2"),2)
      if len(t1)>0 and len(t2)>0 then t1=replace(t1,",","."):forum_type=forum_type&t1&":"&t2&"|"
    next
    t1=replace(trim(request.form("forum_type_new_1"))," ","")
    t2=code_config(request.form("forum_type_new_2"),2)
    if len(t1)>0 and len(t2)>0 then t1=replace(t1,",","."):forum_type=forum_type&t1&":"&t2
    if right(forum_type,1)="|" then forum_type=left(forum_type,len(forum_type)-1)
  else
    forum_type=trim(request.form("forum_type"))
  end if
  
  call config_file()
  call csk3000_config_js()
  if action="user" then call web_user_js()
  if action="forum" then call forum_label_js()
  if action="color" then call config_css()
  if action="menu" then call config_menu()
  response.write "<script language=javascript>alert(""配置修改成功！"");</script>"
  call config_main()
end sub

sub config_bh(bht)
  dim vv,filetype,file_name1,file_name2,filetemp,fileos,filepath:filetype=""
  if bht="h" then
    file_name1="include/back_common.asp"
    file_name2="include/common.asp"
    vv="还原"
  else
    file_name1="include/common.asp"
    file_name2="include/back_common.asp"
    vv="备份"
  end if
  
  
  filetype=get_file(file_name1)
  call create_file(file_name2,filetype)
  response.write "<script language=javascript>alert("""&vv&" 网站配置成功！"");</script>"
end sub

function code_num(strers,cnum)
  dim strer:strer=trim(strers)
  if not(isnumeric(strer)) then strer=cnum
  if int(strer)<1 then strer=cnum
  code_num=strer
end function

function code_config(strers,ct)
  dim strer:strer=trim(strers)
  if isnull(strer) or strer="" then code_config="":exit function
  select case ct
  case 1
    strer=replace(strer,"'","&#39;")
    strer=replace(strer,CHR(34),"&quot;")
  case 2
    strer=replace(strer,CHR(34),"")
    strer=replace(strer,"'","")
    strer=replace(strer,":","")
    strer=replace(strer,"|","")
  case 3
    strer=replace(strer,"'","&#39;")
    strer=replace(strer,CHR(34),"&quot;")
    strer=replace(strer,"|","")
  case 4
    strer=replace(strer,CHR(34),"")
    strer=replace(strer,"'","")
    strer=replace(strer,"|","")
  case else
    strer=replace(strer,"'","")
    strer=replace(strer,CHR(34),"")
  end select
  code_config=strer
end function
%>