<!--#include file="conn/HL_DataConn.asp"-->
<%
'……………………版权信息……………………
'本软件已登记软件著作权，版权归广州恒浪网络科技有限公司所有。所有代码都已经注册登记！
'任何未经许可的修改、复制、提供下载、出售等均属违法侵权行为，请尊重版权，勿以身试法！谢谢！
'请保留此版权信息，请尊重版权，勿以身试法！谢谢！
'网    址：http://www.Howave.Net
'技术论坛：http://BBS.Howave.Net
'联系邮箱：websky888@gmail.com 
'……………………版权信息……………………
%>
<%
 adminUserId= Request.Cookies("hl_manage")("username")
 adminPassword=Request.Cookies("hl_manage")("password")
if adminUserId="" or adminPassword="" then
	  response.write"<SCRIPT language=JavaScript>alert('请先登陆管理系统');"
      response.write"this.location.href='Admin_Login.asp'</SCRIPT>" 
      response.end
end if
sql_admin="select * from hl_admin where hl_adminuser='" & adminUserId & "'"  '-----用户名检测
set rs_admin= Server.CreateObject("ADODB.Recordset") 
rs_admin.open sql_admin,hl_conn,1,1
if not(rs_admin.bof and rs_admin.eof) then
    if rs_admin("hl_adminpass")<>adminPassword then
	 	  response.write"<SCRIPT language=JavaScript>alert('请先登陆管理系统');"
          response.write"this.location.href='Admin_Login.asp'</SCRIPT>" 
          response.end
     end if
	 rs_admin.close
	 set rs_admin=nothing
	
else
	response.write"<SCRIPT language=JavaScript>alert('请先登陆管理系统');"
    response.write"this.location.href='javascript:history.back();'</SCRIPT>" 
	response.end
	rs_admin.close
	set rs_admin=nothing
end if
%>
<%
Dim DataType,DataToType,AcData_Path,AcToData_Path,Data_Source,DataTo_Source,Data_Name,DataTo_Name,Data_user,DataTo_user,Data_Pass,DataTo_Pass
Dim ChkConnected,ChkConnectedTo
Dim connstr,conn,totaluser
Dim FromType,ToType,UserTable,UserToTable
Dim connTostr,connTo
Dim FoundErr,ErrMsg
Dim user_dir,user_domainroot
Dim TransType
Dim jumpnum,SusNum
Dim Interface_id,Interface_name,Transfer_id
jumpnum=0
SusNum=0
		  
if FoundErr=True then
	show_err(errmsg)
end If
FromType=Trim (Request.Form("FromType"))
ToType=Trim (Request.Form("ToType"))
Transfer_Table_name=Trim(Request.Form("Transfer_Table_name"))
other_userid=Trim(Request.Form("other_userid"))
If FromType="0" And ToType<>"0" Then 
UserTable ="[hl_user]"
UserToTable=Transfer_Table_name
TransType="1"'从恒浪传送数据到其它系统
userid="id"
usertoid=other_userid
ElseIf FromType<>"0" And ToType="0" Then 
UserTable =Transfer_Table_name
UserToTable= "[hl_user]"
userid=other_userid
usertoid="id"
TransType="2"'从其它系统传送数据到恒浪
else
FoundErr=True
End If 

DataType=Trim (Request.Form("DataType"))' 为数据库类型
If DataType="0" Then AcData_Path=Trim (Request.Form("AcData_Path"))
If DataType="1" Then 
Data_Source=Trim (Request.Form("Data_Source"))
Data_Name=Trim (Request.Form("Data_Name"))
Data_user=Trim (Request.Form("Data_user"))
Data_Pass=Trim (Request.Form("Data_Pass"))
End If 
DataToType=Trim (Request.Form("DataToType"))
If DataToType="0" Then AcToData_Path=Trim (Request.Form("AcToData_Path"))'0为　Access数据库，则只需记录地址则可
If DataToType="1" Then '1为Ms SQL server则需要记录参数包括有数据库IP地址，用户名，密码
DataTo_Source=Trim (Request.Form("DataTo_Source"))
DataTo_Name=Trim (Request.Form("DataTo_Name"))
DataTo_user=Trim (Request.Form("DataTo_user"))
DataTo_Pass=Trim (Request.Form("DataTo_Pass"))
End If
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>恒浪整合用户表转移程序</title>
<style type="text/css" >
body {
    font-size: 12px;

}

table{
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
}
A:link {
	COLOR: #800000;
	TEXT-DECORATION: none;
}
A:active {
	COLOR: #800000;
	TEXT-DECORATION: none;
}
A:visited {
	COLOR: #800000;
	TEXT-DECORATION: none;
}
A:hover {
	COLOR: #cc0000;
}
li{
	line-height: 30px;
}
.STYLE1 {color: #FF0000}
.STYLE2 {
	color: #000000;
	font-weight: bold;
}
.STYLE4 {color: #FF0000; font-size: 14px; }
</style>
<body>
<%
Dim action
Action = Trim(Request("action"))
Select Case action
    
	Case "go1"
	   Call go1
	Case "go2"
	   Call go2
	Case "go3"
	   Call go3()
	Case "Add"
	   Call Add()
	Case "ModifyField"
	   Call ModifyField()
	Case "DelField"
	   Call DelField()
	Case "transfer"
	   Call Transfer()
	Case "DelTransferSet"
	   Call DelTransferSet()
	Case Else 
	   Call main
End Select 
Sub main()'主程序
%>
<TABLE cellSpacing=1 cellPadding=3 width="88%" align=center bgColor=#b7cef4 border=0>
<TR bgColor="#185195">
<TD colSpan=2 height=2></TD></TR>
<TR bgColor="#e9effc">
<TD width="80%"><div align="center">恒浪整合V4.05用户表转移程序</div></TD>
<TD width="20%"><div align="center"><a href="http://bbs.howave.net" target="_blank">官方论坛</a></div></TD></TR>
<TR align="middle" bgColor="#ffffff">
<TD colspan="2" align="left">
<ol start="1">
<li><strong>阅读转移说明</strong></li>
<li>选择源系统及目的系统 此转换程序为一对多的程序，在转换过程中一定要保证所有系统都有用户数据才能同步！ </li>
<li>设置源数据库地址和目的数据库地址</li>
<li>设置源数据库转移字段和目的数据库转移字段</li>
<li>执行转换</li>
<li>成功（错误）提示</li>
</ol></TD></TR>

<TR align="middle" bgColor="#ffffff">
<TD colspan="2" align="left">
<li><strong>　　转移说明</strong></li>
<OL start="1">
<li>此程序主要实现了恒浪数据库用户表与其它系统用户表互相转移的功能</li>
<li>使用此程序之前必须确认，您所用的恒浪数据库用户表为官方原版,并看清楚转换操作说明</li>
<li>转换之前请备份好目的数据库，如果转换失败请查看出错提示进行下一步的工作</li>
<li>此程序并不保证转换100%成功，对于使用此程序后出现的问题，官方不承担一切责任</li>
</OL></TD></TR>
<br />
<form name="oBlogform1" id="oBlogform1" method="post" action="">
<tr align="middle" bgColor="#ffffff">
<td colspan="2" align="center">
<input name="action" type="hidden" value="go1" />
<input name="submit" type="submit" value="点击进入下一步" /></td>
</tr>
</form>
</table>
<%
dim hl_rs,hl_sql,iii,FromName,ToName
set hl_rs=server.CreateObject("Adodb.recordset")
hl_sql="select * from hl_transfer_set"
hl_rs.open hl_sql,hl_conn,1,1
iii=1
%>
<table width="88%" border="1"  align="center" cellpadding="2" cellspacing="0" bordercolor="#A0D3FE" bgcolor="#EEF9FD" style="BORDER-COLLAPSE: collapse">
  <tr>
    <td width="5%">序号</td>
    <td width="47%">已保存转换设置表</td>
    <td width="48%">操作</td>
  </tr>
  <% do while not hl_rs.eof
       if hl_rs("FromType")="0" then
	      FromName="恒浪整合系统V4.05"
	      ToName=hl_rs("Interface_name")
	   else
	      FromName=hl_rs("Interface_name")
	      ToName="恒浪整合系统V4.05"
	  end if
  %>
  <form action="Admin_Data_Transfer2.asp" name="form_set<%=iii%>" method="post">
  <tr>
    <td><%=iii%></td>
    <td><%=FromName&"-->"&ToName%></td>
    <td><input type="submit" name="submit_form_set<%=iii%>" value="用户数据转换">
	<input type="hidden" name="Transfer_id" value="<%=hl_rs("id")%>"><a href="Data_Transfer_Set.asp?Transfer_id=<%=hl_rs("id")%>">修改数据库设置</a>&nbsp;&nbsp;   
      <a href="Admin_Data_Transfer.asp?action=go3&Transfer_id=<%=hl_rs("id")%>">修改字段</a>&nbsp;&nbsp;<a href="Admin_Data_Transfer.asp?action=DelTransferSet&id=<%=hl_rs("id")%>" target="_self">删除</a></td>
  </tr></form>
  <%  iii=iii+1
      hl_rs.movenext
      loop
      hl_rs.close
	 set hl_rs=nothing
  %>
</table>
<%
End Sub

Sub go1()'1＝＝＝＝＝＝＝＝＝定义数据库，包括选择源数据库地址，源数据库类型，源数据库参数；目标数据库地址，类型，
%>

<table width="88%" border="1"  align="center" cellpadding="2" cellspacing="0" bordercolor="#A0D3FE" bgcolor="#EEF9FD" style="BORDER-COLLAPSE: collapse">
  <form action="Admin_Data_Transfer.asp" method="post" name="Data_Transfer">
  <input name="action" type="hidden" value="go2" />
  <tr>
    <td colspan="3"><strong> 1选择转移数据的源系统和目的系统(<span class="STYLE1">请先查看数据库要转移的表的表名和表里的ID字段名</span>)</strong></td>
  </tr>
 <tr><td colspan="3"><table width="100%"><tr>
    <td colspan="2"><label>请选择源系统
        
    </label></td>
    <td>请选择目标系统
            <label></label></td>
    <td width="22%">转移数据库表名</td>
    <td width="20%">表ID字段名</td>
    <td width="25%">表UserName字段名</td>
 </tr>
       <tr>
         <td colspan="2"><select name="FromType" id="FromType">
           <% 
          set hl_rs=server.CreateObject("Adodb.recordset")
              hl_sql="select * from hl_config where hl_open=1"
			  hl_rs.open hl_sql,hl_conn,1,1
			  response.Write "<option value=0>恒浪V4.0系统</option>"
			  do while not hl_rs.eof
			  response.Write "<option value="&hl_rs("id")&">"&hl_rs("hl_name")&"</option>"
			  hl_rs.movenext
			  loop
			  hl_rs.close
			  set hl_rs=nothing
		  %>
                  </select></td>
         <td width="17%"><select name="ToType" id="ToType">
           <%
              set hl_rs=server.CreateObject("Adodb.recordset")
              hl_sql="select * from hl_config where hl_open=1"
			  hl_rs.open hl_sql,hl_conn,1,1
			  do while not hl_rs.eof
			  response.Write "<option value="&hl_rs("id")&">"&hl_rs("hl_name")&"</option>"
			  hl_rs.movenext
			  loop
			  response.Write "<option value=0>恒浪V4.0系统</option>"
			  hl_rs.close
			  set hl_rs=nothing
		  %>
                  </select></td>
         <td>如:PE_User
           <input name="Transfer_Table_name" type="text" id="Transfer_Table_name" size="12"></td>
         <td><label>如userid
             <input name="other_userid" type="text" id="other_userid" size="12">
         </label></td>
         <td>如UserName
           <input name="other_username" type="text" id="other_username" size="12"></td>
       </tr>
	</table>
	</td>
	</tr>
	<tr>
	<td colspan="3">
	<table width="100%"><tr bgColor="#ffffff"><tr><td colspan="3"><strong>2选择数据库类型及数据库相对路径</strong></td>
	</tr>
	  <td width="20%" colspan="3" bgcolor="#EEF9FD">　源数据库类型：
        
<INPUT TYPE="radio" value="1" NAME="DataType" onClick="AcData.style.display='none',SqlData.style.display=''"/>MS SQL
<INPUT TYPE="radio" value="0" NAME="DataType" onClick="SqlData.style.display='none',AcData.style.display=''"/>
ACCESS</td>
</tr>
<tr  bgColor="#ffffff"><td colspan="3">
<div id="AcData" style="display:none;">
<table width="88%" border="1"  align="center" cellpadding="2" cellspacing="0" bordercolor="#A0D3FE" bgcolor="#EEF9FD" style="BORDER-COLLAPSE: collapse">
<tr bgColor="#ffffff">
<td width="10%">数据库路径：</td>
<td width="90%">
<INPUT TYPE="text" NAME="AcData_Path" size="40" value="/manage/database/Howave4.mdb"/></td>
</tr>
</table>
</div>
<div id="SqlData" style="display:none;">
<table width="88%" border="1"  align="center" cellpadding="2" cellspacing="0" bordercolor="#A0D3FE" bgcolor="#EEF9FD" style="BORDER-COLLAPSE: collapse">
<tr  bgColor="#ffffff">
<td width="20%">数据库服务器：</td>
<td width="80%"><INPUT TYPE="text" NAME="Data_Source" size="20" value="(local)"/></td>
</tr>
<tr  bgColor="#ffffff">
<td>数据库名称：</td>
<td><INPUT TYPE="text" NAME="Data_Name" size="20" value=""/></td>
</tr>
<tr  bgColor="#ffffff">
<td>登陆帐号：</td>
<td><INPUT TYPE="text" NAME="Data_user" size="20" value="sa"/></td>
</tr>
<tr  bgColor="#ffffff">
<td>登陆密码：</td>
<td><INPUT TYPE="text" NAME="Data_Pass" size="20" /></td>
</tr>
</table>
</div>
</td></tr>
</table>
	  <table width="100%">
        <tr bgColor="#ffffff">
          <td width="20%" colspan="2" bgcolor="#EEF9FD">目的数据库类型：
            
             <INPUT TYPE="radio" value="1" NAME="DataToType" onClick="AcToData.style.display='none',SqlToData.style.display=''"/>MS SQL
<INPUT TYPE="radio" value="0" NAME="DataToType" onClick="SqlToData.style.display='none',AcToData.style.display=''"/>
            ACCESS</td>
        </tr>
        <tr  bgColor="#ffffff">
          <td colspan="2"><div id="AcToData" style="display:none;">
              <table width="88%" border="1"  align="center" cellpadding="2" cellspacing="0" bordercolor="#A0D3FE" bgcolor="#EEF9FD" style="BORDER-COLLAPSE: collapse">
                <tr bgColor="#ffffff">
                  <td width="10%">数据库路径：</td>
                  <td width="90%"><INPUT TYPE="text" NAME="AcToData_Path" size="40" value="/manage/database/Howave4.mdb"/></td>
                </tr>
              </table>
          </div>
              <div id="SqlToData" style="display:none;">
                <table width="88%" border="1"  align="center" cellpadding="2" cellspacing="0" bordercolor="#A0D3FE" bgcolor="#EEF9FD" style="BORDER-COLLAPSE: collapse">
                  <tr  bgColor="#ffffff">
                    <td width="20%">数据库服务器：</td>
                    <td width="80%"><INPUT TYPE="text" NAME="DataTo_Source" size="20" value="(local)"/></td>
                  </tr>
                  <tr  bgColor="#ffffff">
                    <td>数据库名称：</td>
                    <td><INPUT TYPE="text" NAME="DataTo_Name" size="20" value=""/></td>
                  </tr>
                  <tr  bgColor="#ffffff">
                    <td>登陆帐号：</td>
                    <td><INPUT TYPE="text" NAME="DataTo_user" size="20" value="sa"/></td>
                  </tr>
                  <tr  bgColor="#ffffff">
                    <td>登陆密码：</td>
                    <td><INPUT TYPE="text" NAME="DataTo_Pass" size="20" /></td>
                  </tr>
                </table>
              </div></td>
        </tr>
      </table></td>
	</tr>
	<tr>
	   <td colspan="3"><span class="STYLE2">3遇到相同用户名的处理方式：</span>
         <INPUT TYPE="radio" NAME="jumpuser" value="1" />
用户名加随机数字
<INPUT TYPE="radio" NAME="jumpuser" value="0" checked  />
跳过 </td>
	</tr>
	<tr>
	   <td colspan="3"><strong>4如果<span class="STYLE1">目标系统</span>或其它<span class="STYLE1">ID字段不是自动增加</span>的系统请勾先</strong>
	     <input type="checkbox" name="ID_Auto" value="1">      </td>
	</tr>
	<tr>
	   <td colspan="3"><strong>5请填写该系统所采用的MD5加密位数</strong>
         <label>
         <input name="md5_size" type="text" id="md5_size" value="16" size="4">
         </label>	     
         只能是16或者是32      </td>
	</tr>
	<tr>
	  <td colspan="3" align="center">
	  <input name="action2" type="button" value="返回上一步" onClick="window.history.back()" />
      <input name="submit2" type="submit" value="点击进入下一步" /></td>
    </tr>
  </form>
</table>
<TR align="middle" bgColor="#ffffff">
<TD colspan="2" align="left">

</TD></TR>
<br />
<TR align="middle" bgColor="#ffffff">
<TD colspan="2" align="left">

</div>
</td></tr>
</TD></TR>
<tr align="middle" bgColor="#ffffff">
<td colspan="2">
</td>
</tr>

</table>
<%
End Sub

Sub go2()'------------GO2程序开始－－－－－－－－－－－－－－－－－－－－－
link_database()'调用连接源数据库程序，检测连接是否正确
If ChkConnected=True And totaluser<>0 Then' 如果检测连接正确并且返回用户数不为0则显示以下信息 
%>
 <table width="88%" border="1"  align="center" cellpadding="2" cellspacing="0" bordercolor="#A0D3FE" bgcolor="#EEF9FD" style="BORDER-COLLAPSE: collapse">
<TR bgColor="#e9effc">
<TD colspan="2">
<strong>读取源数据库信息</strong>
</td>
</tr>
<tr bgColor="#ffffff">
<td width="20%" colspan="2" height="42"><li><font color='green'>一共从源数据库读取了</font><font color="red"><%=totaluser%></font><font color='green'>个用户</font></li></td>
</tr>
<%
ElseIf ChkConnected=True And totaluser=0 Then ' 如果检测连接正确并且返回用户数为0则显示以下信息%>
<TR bgColor="#e9effc">
<TD colspan="2">
<strong>读取源数据库信息</strong>
</td>
</tr>
<tr bgColor="#ffffff">
<td width="20%" colspan="2" height="42"><li><font color='red'>数据库用户表无用户，不需要转换</font></li></td>
</tr>
<%
Response.End 
Else 
FoundErr=True
End If 
link_databaseTo()'调用目标数据库检测连接程序
If ChkConnected=True And ChkConnectedTo= True  Then '如果源数据库和目标数据库检测正确则
%>
<TR bgColor="#e9effc">
<TD colspan="2">
<strong>读取目的数据库信息</strong>
</td>
</tr>
<tr bgColor="#ffffff">
<td width="20%" colspan="2" height="50"><li><font color='green'>目的数据库检查正常，可以转换</font></li>
</td>
</tr>
<%
Else 
FoundErr=True
errmsg=errmsg&"<br><li><font color='red'>数据库连接出错，无法进行下一步操作，请返回重试</font></li>"
End If 
If FoundErr<>True And ChkConnected=True And ChkConnectedTo = True Then
          if TransType="1" then 
			    Interface_id=Trim(Request("ToType"))
		  else
			    Interface_id=Trim(Request("FromType"))
		  end if
		  
		   set hl_rs=server.CreateObject("Adodb.recordset")
              hl_sql="select * from hl_config where id="&interface_id
			  hl_rs.open hl_sql,hl_conn,1,1
			  Interface_name=hl_rs("hl_name")
			  hl_rs.close
		   set hl_rs=nothing
		   set hl_rs=server.CreateObject("Adodb.recordset")
             if Request("T_type")="modify" then 
			  hl_sql="select * from hl_transfer_set where id="&Replace(Trim(Request("DataChannelID")),"'","")
			  hl_rs.open hl_sql,hl_conn,1,3
			  else
			  hl_sql="select * from hl_transfer_set"
			   hl_rs.open hl_sql,hl_conn,1,3
			   hl_rs.addnew
			  end if
			  hl_rs("FromType")=Trim(Request("FromType"))
			  hl_rs("ToType")=Trim(Request("ToType"))
			  hl_rs("Transfer_Table_name")=Trim(Request("Transfer_Table_name"))
			  hl_rs("other_userid")=Trim(Request("other_userid"))
			  hl_rs("DataType")=Trim(Request("DataType"))
			  hl_rs("DataToType")=Trim(Request("DataToType"))
			  hl_rs("jumpuser")=Trim(Request("jumpuser"))
			  hl_rs("AcToData_Path")=Trim(Request("AcToData_Path"))
			  hl_rs("DataTo_Source")=Trim(Request("DataTo_Source"))
			  hl_rs("DataTo_Name")=Trim(Request("DataTo_Name"))
			  hl_rs("DataTo_user")=Trim(Request("DataTo_user"))
			  hl_rs("DataTo_Pass")=Trim(Request("DataTo_Pass"))
			  hl_rs("AcData_Path")=Trim(Request("AcData_Path"))
			  hl_rs("Data_Source")=Trim(Request("Data_Source"))
			  hl_rs("Data_Name")=Trim(Request("Data_Name"))
			  hl_rs("AcData_Path")=Trim(Request("AcData_Path"))
			  hl_rs("Data_user")=Trim(Request("Data_user"))
			  hl_rs("Data_Pass")=Trim(Request("Data_Pass"))
			  hl_rs("other_username")=Trim(Request("other_username"))
			  hl_rs("Interface_id")=Interface_id
			  hl_rs("Interface_name")=Interface_name
			  hl_rs("ID_Auto")=Request("ID_Auto")
			  hl_rs("md5_size")=Trim(Request("md5_size"))
			  hl_rs("TransType")=TransType
			  hl_rs.update
			  Transfer_id=hl_rs("id")
			  hl_rs.close
			  set hl_rs=nothing
			  
%>
<TR bgColor="#e9effc">
<TD colspan="2">
<strong>用户转移资料设置保存成功</strong>
</td>
</tr>
<tr bgColor="#ffffff">
<td width="20%" colspan="2" height="42">现在将进行源，目的数据库传送字段设置</td>
</tr><form action="Admin_Data_Transfer.asp" method="post" name="transfer_set">
<tr><td align="center"><input type="submit" name="submit" value=" 下一步 ">
<input type="hidden" name="Transfer_id" value="<%=Transfer_id%>">
<input type="hidden" name="action" value="go3"></td>
</tr></form>
</table>
<%
Response.Flush'将已经执行的数据在用户端输出
'Call Transfer()'调用传送数据程序

End If 
if FoundErr=True then
	show_err(errmsg)
end If
End Sub '-----------GO 2程序结束---------------------------

Sub go3()
Transfer_id=request("Transfer_id")
Set hl_rs=Server.CreateObject("ADODB.Recordset") 
hl_sql="select * from hl_transfer_set where id="&Transfer_id
hl_rs.open hl_sql,hl_conn,1,1
Interface_name=hl_rs("Interface_name")
TransType=hl_rs("TransType")
FromType=hl_rs("FromType")
ToType=hl_rs("ToType")
hl_rs.close
set hl_rs=nothing
if FromType="0" Then
FromName="恒浪整合系统V4.05"
ToName=Interface_name
else 
FromName=Interface_name
ToName="恒浪整合系统V4.05"
end if
%>
<table width="88%" border="1"  align="center" cellpadding="2" cellspacing="0" bordercolor="#A0D3FE" bgcolor="#EEF9FD" style="BORDER-COLLAPSE: collapse">
  <tr>
    <td colspan="4"><font color="#FF0000"><%=FromName&"-->"&ToName%></font><strong>&nbsp;&nbsp;数据库传送字段设置</strong></td>
  </tr>
 
  <tr>
    <td width="31%"><font color="#FF0000">恒浪整合系统V4.05</font>数据库用户表字段</td>
    <td width="26%"><font color="#FF0000"><%=Interface_name%></font>数据库相对应字段</td>
    <td width="23%">该字段在此系统中的默认值</td>
    <td width="20%">&nbsp;</td>
  </tr><form action="Admin_Data_Transfer.asp" name="" method="post">
  <tr>
    <td><label>
      <select name="hl_field_name" id="hl_field_name">
	  <%if TransType="1" then%>
	  <option value="other">用户自定义字段:other</option>
<%end if

set hl_rs=server.CreateObject("Adodb.recordset")
hl_sql="select * from hl_control where control_datadisplay=1"
hl_rs.open hl_sql,hl_conn,1,1
i=0
do while not hl_rs.eof
response.Write "<option value='"&hl_rs("control_name")&"'>"&hl_rs("control_intro")&":"&hl_rs("control_name")&"</option>"
i=i+1
hl_rs.movenext
loop
hl_rs.close
set hl_rs=nothing
%>
       
      </select>
    </label></td>
    <td>
	<%
 
Set hl_rs=Server.CreateObject("ADODB.Recordset") 
hl_sql="select * from hl_transfer_set where id="&Transfer_id
hl_rs.open hl_sql,hl_conn,1,1
if hl_rs("TransType")="1" then'Transtype=1为从恒浪到其它系统
Transfer_Table_name=hl_rs("Transfer_Table_name")
DataToType=hl_rs("DataToType")
AcToData_Path=hl_rs("AcToData_Path")
DataTo_Source=hl_rs("DataTo_Source")
DataTo_Name=hl_rs("DataTo_Name")
DataTo_user=hl_rs("DataTo_user")
DataTo_Pass=hl_rs("DataTo_Pass")

elseif hl_rs("TransType")="2" then'TransType=2为从其它系统到恒浪
Transfer_Table_name=hl_rs("Transfer_Table_name")
DataToType=hl_rs("DataType")
AcToData_Path=hl_rs("AcData_Path")
DataTo_Source=hl_rs("Data_Source")
DataTo_Name=hl_rs("Data_Name")
DataTo_user=hl_rs("Data_user")
DataTo_Pass=hl_rs("Data_Pass")
end if
If DataToType="0"  Then 
		connTostr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath(AcToData_Path)		
  Else
 		connTostr = "Provider = Sqloledb; User ID = " & DataTo_user & "; Password = " & DataTo_pass & "; Initial Catalog = " & DataTo_Name & "; Data Source = " & DataTo_Source & ";"
  End If 
    
	Set connTo = Server.CreateObject("ADODB.Connection")	
	connTo.open connTostr
	connTo.CommandTimeOut = 9999
Dim i,j,Sql
Set rs=Server.CreateObject("ADODB.Recordset") 
Sql="select * from ["&Transfer_Table_name&"] where 1<>1" 
rs.open sql,connTo,1,1 
j=rs.Fields.count 
response.Write "<select name='other_field_name' id='other_field_name'>"
For i=0 to (j-1) 
response.Write "<option value='"&rs.Fields(i).Name&"'>"&rs.Fields(i).Name&"</option>"
Next
response.Write "</select>" 
%> 
      </td>
    <td><label>
      <input name="other_default" type="text" id="other_default">
    </label></td>
    <td><input type="hidden" name="Transfer_id" value=<%=Transfer_id%>>
      <input type="hidden" name="action" value="Add">
      <input type="submit" name="Submit_field_set" value="保存添加字段"></td>
  </tr></form>
  <tr>
    <td colspan="4">&nbsp;</td>
  </tr>
  <tr>
    <td>恒浪整合系统V4.05数据库用户表字段</td>
    <td><%=Interface_name%>数据库用户表字段</td>
    <td>&nbsp;</td>
    <td>操作</td>
  </tr>
<%
set hl_rs=server.CreateObject("Adodb.recordset")
hl_sql="select * from hl_field_set where Transfer_id="&replace(request("Transfer_id"),"'","")
hl_rs.open hl_sql,hl_conn,1,1
if hl_rs.eof then 
else
i=0
do while not hl_rs.eof
response.Write "<form action='Admin_Data_Transfer.asp' name='Form"&i&"' method='post'>"
response.Write "<input type='hidden' name='action' value='ModifyField'>"
response.Write "<input type='hidden' name='FieldId' value='"&hl_rs("id")&"'>"
response.Write "<input type='hidden' name='Transfer_id' value='"&replace(request("Transfer_id"),"'","")&"'>"
response.Write "<tr><td><input type='text' name='"&hl_rs("hl_field_name")&"' value='"&hl_rs("hl_field_name")&"' readonly='readonly'></td>"
response.Write "<td><input type='text' name='other_field_name' value='"&hl_rs("field_name")&"'></td>"
response.Write "<td><input type='text' name='other_default' value='"&hl_rs("other_default")&"'></td>"
response.Write "<td><input type='submit' name='submit"&i&"' value='修改'>&nbsp;<a href='Admin_Data_Transfer.asp?action=DelField&FielId="&hl_rs("id")&"&Transfer_id="&Transfer_id&"' target='_self'>删除</a></td></tr></form>"    
hl_rs.movenext
i=i+1
loop
end if
hl_rs.close
set hl_rs=nothing
%>
  <form action="Admin_Data_Transfer2.asp" method="post" name="Admin_Data_Transfer">
  <input type="hidden" name="Transfer_id" value="<%=replace(request("Transfer_id"),"'","")%>">
  <tr><td colspan="4" align="center"><input type="submit" name="submit3" value="进行数据传送"></td>
  </tr></form>
</table>
<table width="88%" border="1"  align="center" cellpadding="2" cellspacing="0" bordercolor="#A0D3FE" bgcolor="#EEF9FD" style="BORDER-COLLAPSE: collapse"><tr>
  <td>用户数据同步操作说明<br>
    1、不能用恒浪V4.05的<span class="STYLE1">id,username</span>对应其它系统的<span class="STYLE1">id,UserName</span>,因为前面的设置已经设置过，否则会出错。<br>
    2、如转换不成功请检查是<span class="STYLE1">目的数据库</span>里<span class="STYLE1">必填的字段</span>是否有遗漏或者有<span class="STYLE1">目的数据库</span>中必填字段的值在<span class="STYLE1">源数据库</span>为<span class="STYLE1">空值<br>
    </span>一般来说转移字段都要包括userpassword,useremail,useranswer,userquestion<br>
    <span class="STYLE1"> 如果采用了激活博客的方式（在blog/inc/Upiconfig.asp设置ActiveBlog=True），那么可以不需要把数据导入博客。当用户用到博客时才会显示激活选项，激活后才会把数据导入到数据库。</span><br>
    <span class="STYLE4">※不建议把数据导入博客</span><br>
    *注：针对恒浪V4.05－－＞博客Oblog的用户数据同步操作说明<br>
    1、设置恒浪V4.05的other字段对应blog的userdir,设默认值为你的博客系统的目录名，如user1<br>
    2、设置恒浪V4.05的username或者id字段对应blog的user_floder,建议用UserName,但博客二级域名不支持中文，若有用户ID为中文名请自行修改<br></td>
</tr></table>
<%
End sub
%>
<br /><br /><br /><br /><br />
</body>
</html>
<%
Sub Add()
set hl_rs=server.CreateObject("Adodb.recordset")
hl_sql="select * from hl_field_set"
hl_rs.open hl_sql,hl_conn,1,3
hl_rs.addnew
hl_rs("Transfer_id")=Trim(request("Transfer_id"))
hl_rs("hl_field_name")=Trim(request("hl_field_name"))
hl_rs("field_name")=Trim(request("other_field_name"))
hl_rs("other_default")=Trim(request("other_default"))
hl_rs.update
hl_rs.close
set hl_rs=nothing
ComeUrl = "Admin_Data_Transfer.asp?action=go3&Transfer_id="&Replace(Trim(request("Transfer_id")),"'","")
response.Redirect ComeUrl
End Sub

Sub ModifyField()
set hl_rs=server.CreateObject("Adodb.recordset")
hl_sql="select * from hl_field_set where id="&Replace(Trim(request("FieldId")),"'","")
hl_rs.open hl_sql,hl_conn,1,3
hl_rs("field_name")=Trim(request("other_field_name"))
hl_rs("other_default")=Trim(request("other_default"))
hl_rs.update
hl_rs.close
set hl_rs=nothing
ComeUrl = "Admin_Data_Transfer.asp?action=go3&Transfer_id="&Trim(request("Transfer_id"))
response.Redirect ComeUrl
End Sub

Sub DelField()
set hl_rs=server.CreateObject("Adodb.recordset")
hl_sql="delete * from hl_field_set where id="&Replace(Trim(request("FielId")),"'","")
hl_rs.open hl_sql,hl_conn,1,3
'hl_rs.close
set hl_rs=nothing
ComeUrl = "Admin_Data_Transfer.asp?action=go3&Transfer_id="&Trim(request("Transfer_id"))
response.Write ComeUrl
response.Redirect ComeUrl
End Sub

Sub link_database()'测试源数据库连接程序-----------Begin----------
Dim rschk
On Error Resume Next
 If DataType=0 Then'DataType=0为Access数据库 
		connstr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath(AcData_Path)		
  Else
 		connstr = "Provider = Sqloledb; User ID = " & Data_user & "; Password = " & Data_pass & "; Initial Catalog = " & Data_Name & "; Data Source = " & Data_Source & ";"
  End If 
	Set conn = Server.CreateObject("ADODB.Connection")	
	conn.open connstr
	Conn.CommandTimeOut = 9999
    If Err Then '首先检测对数据库是否能够连接－－－－
	   Err.clear
	   conn.close
	   Set conn=Nothing
	   FoundErr=True
	   errmsg=errmsg&"<br><li><font color='red'>源数据库连接出错，请检查字符串是否正确</font></li>"
	   ChkConnected=False
	 Else '其次检查对用户表是否存在
	  Set rschk=conn.execute("select count("&userid&") from "&UserTable)
	  If Err Then 
      Err.Clear
	  conn.close
	  Set conn=Nothing 
	  FoundErr=True
	  If UserTable<>"" Then errmsg=errmsg& "<br><li>请检查源数据库是否存在用户表<font color='red'>"&UserTable&"</font></li>"
	  ChkConnected=False
	 Else 
	 totaluser=rschk(0)'totaluser为检测用户id返回的数目
	 If totaluser="" Or IsNull (totaluser )  Then  totaluser=0
	 ChkConnected=True 
	  End If 
     End If 
End Sub '-------------源数据库检测连接程序　---------End
Sub link_databaseTo()'目标数据库检测连接程序--------Begin
Dim rschkTo
On Error Resume Next
 If DataToType=0 Then 
		connTostr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath(AcToData_Path)		
  Else
 		connTostr = "Provider = Sqloledb; User ID = " & DataTo_user & "; Password = " & DataTo_pass & "; Initial Catalog = " & DataTo_Name & "; Data Source = " & DataTo_Source & ";"
  End If 
	Set connTo = Server.CreateObject("ADODB.Connection")	
	connTo.open connTostr
	ConnTo.CommandTimeOut = 9999
    If Err Then 
	   Err.clear
	   connTo.close
	   Set connTo=Nothing
	   FoundErr=True
	   errmsg=errmsg&"<br><li><font color='red'>目的数据库连接出错，请检查字符串是否正确</font></li>"
	   ChkConnectedTo=False
	 Else 
	  Set rschkTo=connTo.execute("select * from "&UserToTable)
	  If Err Then 
      Err.Clear
	  connTo.close
	  Set connTo=Nothing 
	  FoundErr=True
	  If UserToTable<>"" Then errmsg=errmsg& "<br><li>请检查目的数据库是否存在用户表<font color='red'>"&UserToTable&"</font></li>"
	 ChkConnectedTo=False
	 Else 
	  ChkConnectedTo=True 
	  End If 
     End If  
End Sub '目标数据库检测连接程序--------End------------------

Sub Echo(sStr)
	Response.Write sStr
End Sub

sub chkErr(err,message)
		if err then
			err.clear
			response.write "<script language=""javascript"">alert('"&message&"');</script>"
			response.end
		end if
end Sub

sub Show_err(errmsg)
Dim strErr
		strErr=strErr & "  <br><tr align='center' bgColor='#e9effc'><td colspan='2' height='22' class='title'><strong>错误信息</strong></td></tr>" & vbcrlf
		strErr=strErr & "  <tr bgColor='#ffffff'><td colspan='2' height='100' class='tdbg' valign='top'><b>产生错误的可能原因：</b><br>" & errmsg &"</td></tr>" & vbcrlf
		strErr=strErr & "  <tr align='center' bgColor='#ffffff'><td colspan='2'><a href='javascript:history.go(-1)'>&lt;&lt; 返回上一页</a></td></tr>" & vbcrlf
		strErr=strErr & "</table>" & vbcrlf
		response.write strErr
end sub

Sub DelTransferSet()
set hl_rs=server.CreateObject("Adodb.recordset")
    hl_sql="delete * from hl_transfer_set where id="&replace(Trim(request("id")),"'","")
	hl_rs.open hl_sql,hl_conn,1,3
	'hl_rs.close
set hl_rs=nothing
response.Redirect "Admin_Data_Transfer.asp"
End Sub
%>