<!--#include file="conn.asp"-->
<!--#include file="inc/cookies_check.asp"-->
<!--#include file="inc/cnzz_md5.asp"-->
<!--#include file="../include/Lebi_Cache_cls.asp"-->
<%
'**************************************
'* 软件名称 乐彼网上开店软件(56770 EShop)
'* 软件开发 http://www.56770.com
'* 版权所有 http://www.56770.com
'* 文件名称 Admin_cnzz.asp
'* 最后更新 2012-06-18 by 56770.kingdge
'**************************************
include "lang/"& LangFilePath &"/lang_sys.inc"
include "lang/"& LangFilePath &"/lang_menu.inc"
include "lang/"& LangFilePath &"/lang_cnzz.inc"
CurrentId = 7
CurrentUrl = "admin_cnzz.asp"
LB_Head()
LB_Menu()
action = request("do")
%>
<div class="tabmenu mainwidth">
      <ul>
        <li <%If action = "" Then Response.Write("class=""current""") End If%>><a href="admin_cnzz.asp"><span><%=Lang_Menu(178)%></span></a></li>
		<li <%If action = "config" Or action = "update" Then Response.Write("class=""current""") End If%>><a href="admin_cnzz.asp?do=config"><span><%=Lang_Menu(179)%></span></a></li>
		<li <%If action = "repair" Or action = "repair_ok" Then Response.Write("class=""current""") End If%>><a href="admin_cnzz.asp?do=repair"><span><%=Lang_Cnzz(14)%></span></a></li>
      </ul>
</div>
<%
Response.Write("<div class=""tab-mainbody"">")
Response.Write("<div class=""tab-mainbody2"">")
If Eshop_Lebi_name="" Then
        adminflag()
		response.End
Else
		If OutSubmit = 1 Then CheckOutSubmit()
        Select Case request("do")
			   Case "config" config()
			   Case "apply" apply()
			   Case "update" update()
			   Case "repair" repair()
			   Case "repair_ok" repair_ok()
			   Case Else
			        main()
		End Select
End If
Response.Write("</div>")
Response.Write("</div>")
LB_Footer()

function WebRequest(url)
        set xmlhttp = Server.CreateObject("Msxml2.XMLHTTP")
        xmlhttp.Open "GET",url, false
        xmlhttp.Send ""
        if xmlhttp.statusText = "OK" then
                webRequest = xmlhttp.responseText
        else
                Response.Write Lang_Cnzz(15)
        end if
End Function

Sub apply()
		domain = Request.ServerVariables("SERVER_NAME")
	    url = "http://intf.cnzz.com/user/companion/56770.php"
	    url = url & "?domain=" & domain & "&key=" & md5(domain&"Jsit7Kd3") &"&cms=56770"
        strret = WebRequest(url)
	    If strret = "-1" Then
		        Call Up_mes(Lang_sys(46),"·"& Lang_Cnzz(1),0,"javascript:history.back()",0,0,2,0)
		ElseIf strret = "-2" Then
		        Call Up_mes(Lang_sys(46),"·"& Lang_Cnzz(2),0,"javascript:history.back()",0,0,2,0)
		ElseIf strret = "-3" Then
		        Call Up_mes(Lang_sys(46),"·"& Lang_Cnzz(3),0,"javascript:history.back()",0,0,2,0)
		ElseIf strret = "-4" Then
		        Call Up_mes(Lang_sys(46),"·"& Lang_Cnzz(4),0,"javascript:history.back()",0,0,2,0)
		ElseIf strret = "-5" Then
		        Call Up_mes(Lang_sys(46),"·"& Lang_Cnzz(5),0,"javascript:history.back()",0,0,2,0)
		Else
				set rs=server.CreateObject("adodb.recordset")
				rs.open "select sys_cnzz from [Lebi_system]", conn, 1, 3
				rs(0)=Request.ServerVariables("SERVER_NAME") &"$$$"& Split(strret,"@")(0) &"$$$"& Split(strret,"@")(1) &"$$$1"
				rs.update
				rs.close:Set rs = Nothing
				Set Cache = New Cls_Cache
				cache.DelCache("Lebi_sys_config")
				Call Up_mes(Lang_Menu(179),"·"& Lang_Cnzz(6),0,"?",0,0,3,1)
        End if
End Sub

Sub update()
		state = checknum(request("state"),2)
		set rs=server.CreateObject("adodb.recordset")
		rs.open "select sys_cnzz from [Lebi_system]", conn, 1, 3
		rs(0)=Split(rs(0),"$$$")(0) &"$$$"& Split(rs(0),"$$$")(1) &"$$$"& Split(rs(0),"$$$")(2) &"$$$"& state
		rs.update
		rs.close:Set rs = Nothing
		Set Cache = New Cls_Cache
		cache.DelCache("Lebi_sys_config")
		Call Up_mes(Lang_sys(69),"·"& Lang_sys(68),0,"?do=config",0,0,2,1)
End Sub

Sub main()
        set rs=conn.execute("select sys_cnzz from [Lebi_system]")
        sys_cnzz=rs(0)
        rs.close:Set rs = Nothing
		domain = Split(sys_cnzz,"$$$")(0)
		site_id = Split(sys_cnzz,"$$$")(1)
		pass = Split(sys_cnzz,"$$$")(2)
		state = Split(sys_cnzz,"$$$")(3)
		If state = "1" Then
				If domain = Request.ServerVariables("SERVER_NAME") Then
						Response.Write("<iframe name=""cnzz"" id=""cnzz"" src=""http://intf.cnzz.com/user/companion/56770_login.php?site_id="& site_id &"&password="& pass &"&cms=56770"" width=""100%"" height=""1400"" frameborder=""0"" scrolling=""yes""></iframe>")
				Else
						Call Up_mes(Lang_sys(46),"·"& Lang_Cnzz(13),0,"?do=config",0,0,2,0)
				End If
		Else
				Call Up_mes(Lang_sys(46),"·"& Lang_Cnzz(9),0,"?do=config",0,0,2,0)
		End If
End Sub

Sub config()
        set rs=conn.execute("select sys_cnzz from [Lebi_system]")
        sys_cnzz=rs(0)
        rs.close:Set rs = Nothing
		domain = Split(sys_cnzz,"$$$")(0)
		site_id = Split(sys_cnzz,"$$$")(1)
		pass = Split(sys_cnzz,"$$$")(2)
		state = Split(sys_cnzz,"$$$")(3)
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="config" class="classtable">
<form method="post" action="?" name="form">
<tr>
  <td height="30" colspan="2" align="right" class="classhead">
  <%=QuickMenu("admin_data.asp?do=yasuo|"& Lang_Menu(159) &"","?do=repair|"& Lang_Cnzz(14) &"")%>
  </td>
 </tr>
<tr>
   <td height="30" colspan="2" class="classtop"><%=Lang_Menu(179)%></td>
</tr>
<tr class="classrow">
<%
If domain <> Request.ServerVariables("SERVER_NAME") Or state = "0" Then
%>
<td height="50" align="center" class="classrow" colspan="2"><input type="button" name="Submit" value="<%=Lang_Cnzz(7)%>"  onClick="location.href='?do=apply'" class="button"></td>
<%Else%>
  <td width="15%" height="30" class="classrow"><%=Lang_Cnzz(10)%></td>
  <td width="85%" class="classrow"><select name="state"><option value="1" <%=judge2(state,1)%>><%=Lang_Cnzz(11)%></option><option value="2" <%=judge2(state,2)%>><%=Lang_Cnzz(12)%></option></select></td>
<%End If%>
</tr>
<tr>
  <td height="30" colspan="2" align="left" class="classfooter">
	<input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" title=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle"><input type="hidden" name="do" value="update">
  </td>
</tr>
</form>
</table>
<script>tdshow("config");</script>
<%
End Sub

Sub repair()
        set rs=conn.execute("select sys_cnzz from [Lebi_system]")
        sys_cnzz=rs(0)
        rs.close:Set rs = Nothing
		domain = Split(sys_cnzz,"$$$")(0)
		site_id = Split(sys_cnzz,"$$$")(1)
		pass = Split(sys_cnzz,"$$$")(2)
		state = Split(sys_cnzz,"$$$")(3)
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="config" class="classtable">
<form method="post" action="?" name="form">
<tr>
  <td height="30" colspan="2" align="right" class="classhead">
  <%=QuickMenu("?action=config|"& Lang_Menu(179) &"","|")%>
  </td>
 </tr>
<tr>
   <td height="30" colspan="2" class="classtop"><%=Lang_Menu(179)%></td>
</tr>
<tr class="classrow">
<td height="50" align="center" class="classrow" colspan="2"><input type="button" name="Submit" value="<%=Lang_Cnzz(16)%>"  onClick="location.href='?do=apply'" class="button"></td>
</tr>
<tr>
  <td height="30" colspan="2" align="left" class="classfooter">
	<input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" title=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle"><input type="hidden" name="do" value="update">
  </td>
</tr>
</form>
<tr>
<td colspan="2" class="classfaq">
<div class="faq_main">
<p class="faq_title"><%=Lang_sys(49)%></p>
<%=Lang_Cnzz(17)%>
</div>
</td>
</tr>
</table>
<script>tdshow("config");</script>
<%
End Sub
%>