<%
'乘风多用户计数器 Sql版
'作者QQ：178575
'作者EMail：yliangcf@163.com
'作者网站：http://www.qqcf.com
'详细简介：http://www.qqcf.com/cfcount.htm
'上面有程序在线演示，安装演示，使用疑难解答，最新版本下载等内容
'因为这些内容可能时常更新，就没有放在程序里，请自己上网站上查看
'有完整版本的演示
%>
<SCRIPT>
function ashow(){
b_1.style.display = "none";
b_2.style.display = "none";
b_3.style.display = "none";
b_4.style.display = "none";
b_5.style.display = "none";
b_6.style.display = "none";
b_7.style.display = "none";
c_1.style.display = "none";
c_2.style.display = "none";
c_3.style.display = "none";
c_4.style.display = "none";
c_5.style.display = "none";
}
function bshow(){
b_1.style.display = "";
b_2.style.display = "";
b_3.style.display = "";
b_4.style.display = "";
b_5.style.display = "";
b_6.style.display = "";
b_7.style.display = "";
c_1.style.display = "none";
c_2.style.display = "none";
c_3.style.display = "none";
c_4.style.display = "none";
c_5.style.display = "none";
}
function cshow(){
b_1.style.display = "none";
b_2.style.display = "";
b_3.style.display = "";
b_4.style.display = "";
b_5.style.display = "";
b_6.style.display = "";
b_7.style.display = "";
c_1.style.display = "";
c_2.style.display = "";
c_3.style.display = "";
c_4.style.display = "";
c_5.style.display = "";

t1.innerHTML="SqlServer数据库IP：";
t2.innerHTML="SqlServer数据库名称：";
t3.innerHTML="SqlServer数据库连接用户名：";
t4.innerHTML="SqlServer数据库连接密码：";
t5.innerHTML="SqlServer数据库连接端口：";
t5_2.innerHTML="SqlServer数据库默认连接端口是1433";
  
}
function dshow(){
b_1.style.display = "none";
b_2.style.display = "";
b_3.style.display = "";
b_4.style.display = "";
b_5.style.display = "";
b_6.style.display = "";
b_7.style.display = "";
c_1.style.display = "";
c_2.style.display = "";
c_3.style.display = "";
c_4.style.display = "";
c_5.style.display = "";

t1.innerHTML="Mysql数据库IP：";
t2.innerHTML="Mysql数据库名称：";
t3.innerHTML="Mysql数据库连接用户名：";
t4.innerHTML="Mysql数据库连接密码：";
t5.innerHTML="Mysql数据库连接端口：";
t5_2.innerHTML="Mysql数据库默认连接端口是3306";
}
</SCRIPT>


<%
 If RsSet("RegType")=1 Then
  show="ashow()"
 ElseIf RsSet("RegType")=2 Then
  show="bshow()"
 ElseIf RsSet("RegType")=3 Then
  show="cshow()"
 ElseIf RsSet("RegType")=4 Then
  show="dshow()"
 End If
 
Set Rs = Server.CreateObject("ADODB.Recordset")
Sql="Select * From CFCount_Admin"
Rs.open Sql,Conn,1,1
%>
<table class="tb_1">
  <tr> 
  <form name="form2" method="post" action="AdminUser.aspx?action=sysrecsetsave">
    <tr> 
      <td colspan="2">如果你使用推广系统自带的会员注册功能请选择接口类型-系统自带,否则根据你网站的数据库类型选择相应的接口类型 </td>
    </tr>
    <tr class="tr_1"> 
      <td colspan="2">网站接口设置</td>
    </tr>
    <tr> 
      <td width="30%">接口类型：</td>
      <td> <div> 
          <input type="radio" name="RegType" value="1"<%If Rs("RegType")=1 Then Response.Write " checked"%> onclick="ashow()">
          本系统自带 
          <input type="radio" name="RegType" value="2"<%If Rs("RegType")=2 Then Response.Write " checked"%> onclick="bshow()">
          Access数据库 
          <input type="radio" name="RegType" value="3"<%If Rs("RegType")=3 Then Response.Write " checked"%> onclick="cshow()">
          SQLSERVER数据库
          <input type="radio" name="RegType" value="4"<%If Rs("RegType")=4 Then Response.Write " checked"%> onclick="dshow()">
          MySql数据库</td>
    </tr>
    <tr id="b_1"> 
      <td>ACCESS数据库文件路径：</td>
      <td><input name="AccessPath" type="text" id="AccessPath" value="<%=Rs("AccessPath")%>" size="30">
        如数据库文件夹data.mdb放在网站根目录aa里的bb目录里,路径应该设置为/aa/bb/data.mdb</td>
    </tr>
    <tr id="c_1"> 
      <td><span id="t1">SqlServer数据库IP： </span></td>
      <td><input name="SqlIP" type="text" id="SqlIP" value="<%=rs("SqlIP")%>" size="15"></td>
    </tr>
    <tr id="c_2"> 
      <td><span id="t2">SqlServer数据库名称：</span></td>
      <td><input name="SqlDbName" type="text" id="SqlDbName" value="<%=rs("SqlDbName")%>" size="15"></td>
    </tr>
    <tr id="c_3"> 
      <td><span id="t3">SqlServer数据库连接用户名：</span></td>
      <td><input name="SqlLinkName" type="text" id="SqlLinkName" value="<%=rs("SqlLinkName")%>" size="15"></td>
    </tr>
    <tr id="c_4"> 
      <td><span id="t4">SqlServer数据库连接密码：</span></td>
      <td><input name="SqlLinkPassword" type="password" id="SqlLinkPassword" value="<%=rs("SqlLinkPassword")%>" size="15"> 
      </td>
    </tr>
    <tr id="c_5"> 
      <td><span id="t5">SqlServer数据库端口：</span></td>
      <td><input name="SqlPort" type="text" id="SqlPort" value="<%=rs("SqlPort")%>" size="15"><span id="t5_2"></span></td>
    </tr>
	<tr id="b_2"> 
      <td>存放注册用户的表名：</td>
      <td><input name="SaveRegTable" type="text" id="SaveRegTable" value="<%=Rs("SaveRegTable")%>" size="15"></td>
    </tr>
    <tr id="b_3"> 
      <td>存放注册用户名称的字段名：</td>
      <td><input name="SaveRegUserName" type="text" id="SaveRegUserName" value="<%=Rs("SaveRegUserName")%>" size="15"></td>
    </tr>
    <tr id="b_4"> 
      <td>存放注册用户密码的字段名：</td>
      <td><input name="SaveRegPassword" type="text" id="SaveRegPassword" value="<%=Rs("SaveRegPassword")%>" size="15"></td>
    </tr>
    <tr id="b_5"> 
      <td>存放注册用户密码加密方式:</td>
      <td><input name="PassWordType" type="radio" value="1"<%If Rs("PassWordType")=1 Then Response.Write " checked"%>>
        没有加密 
        <input type="radio" name="PassWordType" value="2"<%If Rs("PassWordType")=2 Then Response.Write " checked"%>>
        经过了16位Md5加密 
        <input type="radio" name="PassWordType" value="3"<%If Rs("PassWordType")=3 Then Response.Write " checked"%>>
        经过了32位Md5加密</td>
    </tr>
    <tr id="b_6"> 
      <td height="24">你的网站注册用户页面网址:</td>
      <td><input name="RegUrl" type="text" id="RegUrl" value="<%=Rs("RegUrl")%>" size="50"></td>
    </tr>
    <tr id="b_7"> 
      <td>你的网站用户登陆页面网址:</td>
      <td><input name="LoginUrl" type="text" id="LoginUrl" value="<%=rs("LoginUrl")%>" size="50"></td>
    </tr>
    <tr> 
      <td>&nbsp;</td>  <td>   
          <input type="submit" name="Submit322" value="修改">
          　　 
          <input type="reset" name="Submit5232" value="取消">
        </td>
    </tr>  </form>

  <tr> 
      <td colspan="2" class="td_1">接口选择说明：</td>
  </tr>
	<tr> 
      <td colspan="2" class="td_1">
          本系统自带:原先网站没有会员注册系统或者不想和原先的注册系统集成在一起使用的网站则选择此项<br>
          Access数据库: 你的网站使用Access数据库并自带会员注册系统的网站选择此项<br>
          SQLSERVER数据库:你的网站使用Sqlserver数据库并自带会员注册系统的网站选择此项<br>
		  Mysql数据库:你的网站使用Mysql数据库并自带会员注册系统的网站选择此项
      </td>
    </tr>

    <%If RsSet("RegType")=2 Or RsSet("RegType")=3 Or RsSet("RegType")=4 Then%>
    <tr>
      
    <td colspan="2" class="td_1">数据库接口设置是否正确的测试结果：<a name="sysrecsetresultview"></a></td>
    </tr>
    <tr> 
      <td colspan="2" class="td_1">
<%


If RsSet("RegType")=2 Or RsSet("RegType")=3 Then

If RsSet("RegType")=2 Then
 Connstr_Rec="DBQ="+server.mappath(RsSet("AccessPath"))+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
 Set conn_Rec= Server.CreateObject ("ADODB.Connection")
 Conn_Rec.Open Connstr_Rec 
ElseIf RsSet("RegType")=3 Then
 Connstr_rec="DRIVER={SQL Server};SERVER="&RsSet("SqlIP")&","&RsSet("SqlPort")&";UID="&RsSet("SqlLinkName")&";PWD="&RsSet("SqlLinkPassword")&";DATABASE="&RsSet("SqlDbName")&""
 Set Conn_Rec= Server.CreateObject ("ADODB.Connection")
 Conn_Rec.Open Connstr_rec
End If

Pass=1

If Err Then Pass=0

Set Rs = Server.CreateObject("ADODB.Recordset")
Sql="Select Count(*) From "&RsSet("SaveRegTable")
Rs.Open Sql,Conn_Rec,1,1
ReguserTotal=Rs(0)
 
Set Rs = Server.CreateObject("ADODB.Recordset")
Sql="Select Count("&RsSet("SaveRegUserName")&") From "&RsSet("SaveRegTable")

Rs.Open Sql,Conn_Rec,1,1
ReguserTotal_2=Rs(0)
 
Set Rs = Server.CreateObject("ADODB.Recordset")
Sql="Select Count("&RsSet("SaveRegPassword")&") From "&RsSet("SaveRegTable")
Rs.Open Sql,Conn_Rec,1,1
ReguserTotal_3=Rs(0) 

Set Rs = Server.CreateObject("ADODB.Recordset")
Sql="Select Top 1 "&RsSet("SaveRegUserName")&","&RsSet("SaveRegPassword")&" From "&RsSet("SaveRegTable")
Rs.Open Sql,Conn_Rec,1,1
RegUserName=Rs(0)
RegUserPassword=Rs(1)
 
If Len(RegUserPassword)=16 Then
 Response.Write "其中一个用户密码长度：16位,可能是16位Md5加密方式!<br><br>"
ElseIf Len(RegUserPassword)=32 Then
 Response.Write "其中一个用户密码长度：32位,可能是32位Md5加密方式!<br><br>"
Else
 Response.Write "其中一个用户密码长度："&Len(RegUserPassword)&"位!<br><br>"
End if
%>
        注册用户数:<%=ReguserTotal%>,其中一个注册用户名是<%=RegUserName%><br>
        <br>
      <font color="#FF0000">测试结果：</font> 
<%
If RsSet("RegType")=2 And Pass=0 Then Response.write "ACCESS数据库文件路径设置有误!"
If RsSet("RegType")=3 And Pass=0 Then Response.write "SQLSERVER数据库IP或数据库名称或连接用户名或连接密码设置有误!"

If Pass=1 And Len(Cstr(ReguserTotal))=0 Then Response.write "数据库表名设置错误，请重新设置!"
If Pass=1 And Len(Cstr(ReguserTotal))>0 And Len(Cstr(ReguserTotal_2))=0 Then Response.write "数据库用户名字段设置错误，请重新设置!<br>"
If Pass=1 And Len(Cstr(ReguserTotal))>0 And Len(Cstr(ReguserTotal_3))=0 Then Response.write "数据库密码字段设置错误，请重新设置!<br>"

If Pass=1 And Len(Cstr(ReguserTotal))>0 And Len(Cstr(ReguserTotal_2))>0 And Len(Cstr(ReguserTotal_3))>0 Then 
 Response.write "数据库接口大致设置成功，还有密码的加密方式没有验证，请在以下用一个注册用户名和密码做登陆测试，可以登陆的话就一切正常，否则可能是密码的加密方式设置有错误!"
 Login=1
End If

ElseIf RsSet("RegType")=4 Then
 Login=1
End If

%>
<%If Login=1 Then%>

        <form name="form3" method="post" target="_blank" action="AdminUser.aspx?Action=sysreclogintest">
<table border="0" cellspacing="1" cellpadding="3"><tr>
            <td>登陆测试</td>
          </tr>
          <tr> 
            <td>用户名： <input name="UserName" type="text" id="UserName"> </td>
          </tr>
        
        <tr> 
          <td>密　码： <input name="Pwd" type="password" id="Pwd"></td>
        </tr>
        <tr> 
          <td>
                <input type="submit" name="Submit2" value="测试">
            </td>
        </tr>
      </table></form>
<%End If'结束login%>
</td>
    </tr>
    <%End If'结束RegType%>

</table>