<!--#include file="conn.asp"-->
<!--#include file="inc/cookies_check.asp"-->
<!--#include file="../include/Lebi_Cache_cls.asp"-->
<%
'**************************************
'* 软件名称 乐彼网上开店软件(56770 EShop)
'* 软件开发 http://www.56770.com
'* 版权所有 http://www.56770.com
'* 文件名称 Admin_51kehu.asp
'* 最后更新 2011-09-14 by 56770.kingdge
'**************************************
include "lang/"& LangFilePath &"/lang_sys.inc"
include "lang/"& LangFilePath &"/lang_menu.inc"
include "lang/"& LangFilePath &"/lang_51kehu.inc"
CurrentId = 7
CurrentUrl = "admin_51kehu.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_51kehu.asp"><span><%=Lang_Menu(147)%></span></a></li>
		<li <%If action = "reg" Or action = "reg_ok" Then Response.Write("class=""current""") End If%>><a href="?do=reg"><span><%=Lang_51kehu(7)%></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 "update" update()
			   Case "reg" reguser()
			   Case "reg_ok" reguser_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_51kehu(1)
        end if
End Function

Sub update()
        Set Cache = New Cls_Cache
        set rs=server.CreateObject("adodb.recordset")
        sql="select sys_51kehu from [Lebi_system]"
        rs.open sql, conn, 1, 3
        rs("sys_51kehu")=safereplace(request("kehu_state"))&"$$$"&Replace(Replace(Trim(request("kehu_code")),"'+'",""),"'","""")
        rs.update
        rs.close:Set rs = Nothing
		cache.DelCache("Lebi_sys_config")
        m_t=Lang_51kehu(2)
        m_s="·"& Lang_51kehu(3)
        m_u="admin_51kehu.asp"
        m_time="2"
        Call Up_mes(m_t,m_s,0,m_u,0,0,m_time,1)
End Sub

Sub reguser_ok()
	    url = "http://www.56770.com/post/51kehu_api.asp"
	    url = url & "?domain=" & Request("51kehu_domain") & "&admin=" & Request("51kehu_user") & "&pass="& Request("51kehu_pass")
        strret = WebRequest(url)
	    If strret <> "" then
                Set ret = Server.CreateObject("Scripting.Dictionary")
		        arr = Split(strret,"&")
		        For i=0 To UBound(arr)
		                temp = Split(arr(i),"=")
		                ret(CStr(temp(0))) = CStr(temp(1))
		        next
		        If ret("code") = "200" Then
                        Response.Write "<div style=""border:1px solid #cccccc;background:#F7F7F7;width:98%;padding:5px;color:#000;line-height:220%;"">"& Lang_51kehu(4) &""& Server.HTMLEncode("<script language=javascript src=http://"& ret("webcall_server") &"/Init/Init.aspx?SiteID="& ret("webcall_siteid") &"</script>") &""
						Response.Write "<script language=javascript>window.opener.document.formmain.kehu_code.value=""<scr'+'ipt language=javascript src=http://"& ret("webcall_server") &"/Init/Init.aspx?SiteID="& ret("webcall_siteid") &"></scr'+'ipt>"";</script>"
                        Response.Write "<br>"& Lang_51kehu(5) &""
                        Response.Write "<br>"& Lang_51kehu(6) &" <a href='http://chat.51kehu.com/' target='_blank'>http://chat.51kehu.com/</a></div><script>setTimeout('window.close();',30000); </script>"
                Else
                        m_t=Lang_51kehu(7)
		                m_s=Lang_51kehu(8) &"<br>" & ret("msg") & "<br>LOG:"& ret("logg") &""
		                m_u="javascript:history.back()"
		                m_time="5"
		                Call Up_mes(m_t,m_s,0,m_u,0,0,m_time,0)
                End if
        Else
                m_t=Lang_51kehu(7)
		        m_s=Lang_51kehu(36)
		        m_u="javascript:history.back()"
		        m_time="3"
		        Call Up_mes(m_t,m_s,0,m_u,0,0,m_time,0)
        End if
End Sub

Sub main()
        set rs=conn.execute("select sys_51kehu from [Lebi_system]")
        sys_51kehu=rs(0)
        rs.close:Set rs = Nothing
		kehu_code = Split(sys_51kehu,"$$$")(1)
		kehu_state = Split(sys_51kehu,"$$$")(0)
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="classtable">
<Form name="formmain" Method="Post" Action="admin_51kehu.asp">
<tr>
  <td height="30" align="left" class="classhead">
  <input type="button" name="Submit" value=" <%=Lang_51kehu(10)%> " onClick="window.open('http://chat.51kehu.com/ctrl/')" class="button"></td>
  <td height="30" align="right" class="classhead">
  <%=QuickMenu("Admin_cnzz.asp?do=config|"& Lang_Menu(178) &"","")%>
  </td>
 </tr>
<tr>
   <td height="30" colspan="2" class="classtop"><%=Lang_51kehu(2)%></td>
</tr>
<tr class="classrow">
<td height="30" align="left" colspan="2" class="classrow">
<%=Lang_51kehu(11)%><br/>
<%=Lang_51kehu(12)%><a href="http://www.51kehu.com/ctrl/51kehu.rar" target="_blank">http://www.51kehu.com/ctrl/51kehu.rar</a>
<div id="divCode" style="border:1px solid #cccccc;background:#F7F7F7;width:98%;padding:5px;margin-top:8px;">
<table width="100%" border="0">
  <tr>
    <td><%=Lang_51kehu(13)%><a href="http://www.51kehu.com/ctrl/setting/AdminGetCodeTeach.html" target="_blank"><%=Lang_51kehu(14)%></a></td>
  </tr>
  <tr>
    <td><textarea name="kehu_code" rows="6" cols="80" class="text"><%=kehu_code%></textarea></td>
  </tr>
  <tr>
    <td><%=Lang_51kehu(15)%><select name="kehu_state"><option value='0'><%=Lang_51kehu(16)%></option><option value='1'<%If kehu_state="1" Then response.write(" selected") End If%>><%=Lang_51kehu(17)%></option></select></td>
  </tr>
</table>
</div>
</td>
</tr>
<tr class="classfooter">
   <td height="30" align="left" colspan="2" class="classfooter"><input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" value=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" border="0" alt=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle">
   <input type="hidden" name="do" value="update">
  </td>
 </tr>
 </Form>
</table>
<%
End Sub

Sub reguser()
%>
<script language="javascript">
function checkApply(form){
	if(form['51kehu_domain'].value == ""){
		alert("<%=Lang_51kehu(18)%>");
		form['51kehu_domain'].focus();
		return false;
	}
	if(form['51kehu_user'].value == ""){
		alert("<%=Lang_51kehu(19)%>");
		form['51kehu_user'].focus();
		return false;
	}
	if(form['51kehu_pass'].value == ""){
		alert("<%=Lang_51kehu(20)%>");
		form['51kehu_pass'].focus();
		return false;
	}
	if(form['51kehu_pass'].value != form['51kehu_pass2'].value){
		alert("<%=Lang_51kehu(21)%>");
		form['51kehu_pass'].focus();
		return false;
	}
}
function getDomain()
{
	return location.host;
}
window.onload = function(){
	document.forms['frmApply']['51kehu_domain'].value = getDomain();
}
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="reg" class="classtable">
<Form Name="frmApply" Method="Post" Action="admin_51kehu.asp" onsubmit="return checkApply(this)">
<tr>
	<td height="30" align="left" class="classhead"><input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" value=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" border="0" alt=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle">
	<input type="hidden" name="IS_UP" value="1">
	</td>
	<td class="classhead" align="right">
	<%=QuickMenu("","")%>
	</td>
 </tr>
<tr>
   <td height="30" colspan="2" class="classtop"><%=Lang_51kehu(7)%></td>
</tr>
<tr class="classrow">
	<td width="15%" height="30" class="classrow"><%=Lang_51kehu(23)%></td>
	<td width="85%" class="classrow"><input type="text" name="51kehu_domain" class="form" style="width: 150px"></td>
</tr>
<tr class="classrow">
	<td height="30" class="classrow"><%=Lang_51kehu(24)%></td>
	<td class="classrow"><input type="text" name="51kehu_user" class="form" style="width: 150px"></td>
</tr>
<tr class="classrow">
	<td height="30" class="classrow"><%=Lang_51kehu(25)%></td>
	<td class="classrow"><input type="password" name="51kehu_pass" class="form" style="width: 150px"></td>
</tr>
<tr class="classrow">
	<td height="30" class="classrow"><%=Lang_51kehu(26)%></td>
	<td class="classrow"><input type="password" name="51kehu_pass2" class="form" style="width: 150px"></td>
</tr>
<tr>
<td height="30" colspan="2" class="classfooter">
<input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" value=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" border="0" alt=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle">
<input type="hidden" name="do" value="reg_ok">
</td>
</tr>
</Form>
<tr>
<td height="30" class="classfaq" colspan="2">
  <div class="faq_main">
  <p class="faq_title"><%=Lang_sys(49)%></p>
   <%=Lang_51kehu(22)%>
</td>
</tr>
</table>
<script>tdshow("reg");</script>
<%
End Sub
%>