<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%option explicit%>
<!--#include file="../Conn.asp"-->
<!--#include file="../Task/TaskConfig.asp"-->
<!--#include file="../HSK_Cls/HSK.CommonCls.asp"-->
<!--#include file="../HSK_Cls/HSK.AdministratorCls.asp"-->
<!--#include file="../HSK_Cls/HSK.Label.CommonCls.asp"-->
<!--#include file="Include/Session.asp"-->
<%
Dim KSCls
Set KSCls = New Admin_ShopNameManage
KSCls.Run()
Set KSCls = Nothing

Class Admin_ShopNameManage
        Private KS,KSCls
		Private totalPut,rs, Page, MaxPerPage,DomainStr,SearchType,SQLParam
		Private Sub Class_Initialize()
		  Set KS=New PublicCls
		  Set KSCls=New ManageCls
		End Sub
        Private Sub Class_Terminate()
		 Call CloseConn()
		 Set KS=Nothing
		 Set KSCls=Nothing
		End Sub
	
	Sub DoDel()		'删除任务
	Dim RSObj, ID ,Total_Point
	ID = KS.G("ID")
	IF KS.CheckOuterUrl()=False Then
		If ID <> "" Then
			Conn.Execute("Delete From ShopNameBuy Where ID IN("& ID & ")")
			KS.AlertHintScript("删除成功！")
		Else
			KS.AlertHintScript("提交参数有误！")
		End If
	End If
	End Sub

Sub DoAdds()
	%>
    <html>
<head><title>批量添加淘宝小号</title>
<meta http-equiv=Content-Type content="text/html; charset=gb2312">
<link href="include/Admin_Style.css" type=text/css rel=stylesheet>
<script src="../HSK_JS/jquery.js" type="text/javascript"></script>
<script src="../HSK_JS/common.js" language="JavaScript"></script>
<script language="javascript" src="../HSK_JS/popcalendar.js"></script>
</head>
<Script Language='javascript'>
function CheckForm(){
	var form=document.myform; 
	if (form.AccountType.value==''){
		alert('请选择账号类型!');
		form.AccountType.focus(); 
		return false;    }
	if (form.RegDate.value==''){
		alert('请选择注册时间!');
		form.RegDate.focus(); 
		return false;    }
	if (form.Price.value==''){
		alert('请填写价格!');
		form.Price.focus(); 
		return false;    }
	if (form.Account.value==''){
		alert('请填写账号信息!');
		form.Account.focus(); 
		return false;    }

	   form.submit();
	   return true;
}</Script>
<body leftMargin=2 topMargin=0 marginheight="0" marginwidth="0">
<table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='ctable' style='margin-top:5px;border-collapse: collapse'>
<form action='?page=<%=KS.S("p")%>' method='post' name='myform' onsubmit='return(CheckForm())'>
<input type='hidden' value='AddSaves' name='action'>
<tr class='tdbg'>
	<td width='120' height='30' align='right' class='clefttitle'><strong>账号类型：</strong></td>
	<td><input name='AccountType' value='' type='text' id='AccountType' class='textbox'> <select name="sType" id="sType" onChange="myform.AccountType.value=this.options[this.selectedIndex].value">
        <option selected="selected" value="">点这可选择类型</option>
        <option value="实名认证">实名认证</option>
        <option value="手机认证">手机认证</option>
        <option value="普通号">普通号</option>
        <option value="邮箱号">邮箱号</option>
        <option value="手机号">手机号</option>
        </select></td>
</tr>
<tr class='tdbg'>
	<td width='120' height='30' align='right' class='clefttitle'><strong>账号注册时间：</strong></td>
	<td><input name='RegDate' type='text' id='RegDate' value='' onChange="this.value=this.value.substr(0,10)" onBlur="this.value=this.value.substr(0,10)" class='textbox'> <a href='#' onClick="popUpCalendar(this, $('input[name=RegDate]').get(0), dateFormat,-1,-1)"><img src='Images/date.gif'  border='0' align='absmiddle' title='点击选择日期'></a>日期格式如：2013-08-10</td>
</tr>
<tr class='tdbg'>
	<td width='120' height='30' align='right' class='clefttitle'><strong>出售单价：</strong></td>
	<td><input name='Price' value='' type='text' id='Price' class='textbox'> 元</td>
</tr>
<tr class='tdbg'>
	<td width='120' height='30' align='right' class='clefttitle'><strong>小号信誉值：</strong></td>
	<td><input name='Credit' value='0' type='text' id='Credit' class='textbox'>（即该小号的淘宝信誉值，留空表示0）</td>
</tr>
<tr class='tdbg'>
	<td width='120' height='30' align='right' class='clefttitle'><strong>账号信息：</strong><br>
	<font color="#FF0000">(批量添加，一行一个)</font></td>
	<td><font color="#0099FF">填写格式：tb_135221|a123456|meta1991@163.com|a123456|MM2211|120105196102124664|张小敏<br>
格式解释：淘宝账号|登陆密码|邮箱号|邮箱密码|支付宝的支付密码|身份证号码|身份证姓名</font><br>
    <textarea name="Account" cols="50" rows="20" class="textarea" id="Account" style="width:650px" title="一行一个账号信息，用半角|号隔开！"></textarea></td>
</tr>
</form>
</table>
<br>
<div id='save' style="padding-left:300px">
<li class='parent' onClick="return(CheckForm())">
	<span class=child onMouseOver="this.parentNode.className='parent_border'" onMouseOut="this.parentNode.className='parent'"><img src='images/ico/save.gif' border='0' align='absmiddle'>确定保存</span>
</li>
<li class='parent' onClick="parent.closeWindow()">
    <span class=child onMouseOver="this.parentNode.className='parent_border'" onMouseOut="this.parentNode.className='parent'"><img src='images/ico/back.gif' border='0' align='absmiddle'>关闭取消</span>
</li>
</div>

  </body>
  </html>
	<%
	End Sub
	
	Sub DoAdd()
	%>
    <html>
<head><title>添加账号</title>
<meta http-equiv=Content-Type content="text/html; charset=gb2312">
<link href="include/Admin_Style.css" type=text/css rel=stylesheet>
<script src="../HSK_JS/jquery.js" type="text/javascript"></script>
<script src="../HSK_JS/common.js" language="JavaScript"></script>
<script language="javascript" src="../HSK_JS/popcalendar.js"></script>
</head>
<Script Language='javascript'>
function CheckForm(){
	var form=document.myform; 
	if (form.Account.value==''){
		alert('请输入淘宝账号!');
		form.Account.focus(); 
		return false;    }
	if (form.Password.value==''){
		alert('请输入账号密码!');
		form.Account.focus(); 
		return false;    }

	   form.submit();
	   return true;
}</Script>
<body leftMargin=2 topMargin=0 marginheight="0" marginwidth="0">
<%
Dim ID: ID = KS.S("ID")
If KS.S("Optype") = "Edit" Then
	 Set RS = Server.CreateObject("ADODB.RECORDSET")
	 Dim Sql: Sql = "Select * From ShopNameBuy Where ID='" & ID & "'"
	 RS.Open Sql, conn, 1, 1
	If Not RS.EOF Then
		Dim Password: Password = Trim(RS("Password"))
		Dim Account: Account = Trim(RS("Account"))
		Dim Email: Email = Trim(RS("Email"))
		Dim EmailPassword: EmailPassword = Trim(RS("EmailPassword"))
		Dim IDCard: IDCard = Trim(RS("IDCard"))
		Dim IDCardName: IDCardName = Trim(RS("IDCardName"))
		Dim Alipay: Alipay = Trim(RS("Alipay"))
		Dim AlipayPassword: AlipayPassword = Trim(RS("AlipayPassword"))
		Dim Credit: Credit = Trim(RS("Credit"))
		Dim AccountType: AccountType = Trim(RS("AccountType"))
		Dim Price: Price = Trim(RS("Price"))
		Dim RegDate: RegDate = Trim(RS("RegDate"))
		Dim sStatus: sStatus = Trim(RS("Status"))
		Dim remark: remark = Trim(RS("remark"))
	End If
	RS.Close
	Set RS=Nothing
End If
%>
<table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' class='ctable' style='margin-top:5px;border-collapse: collapse'>
<form action='?ID=<%=ID%>&page=<%=KS.S("p")%>' method='post' name='myform' onsubmit='return(CheckForm())'>
<input type='hidden' value='AddSave' name='action'>
<tr class='tdbg'>
	<td width='180' height='30' align='right' class='clefttitle'><strong>淘宝账号：</strong></td>
	<td><input name='Account' value='<%=Account%>' type='text' id='Account' class='textbox'></td>
</tr>
<tr class='tdbg'>
	<td width='180' height='30' align='right' class='clefttitle'><strong>账号密码：</strong></td>
	<td><input name='Password' value='<%=Password%>' type='text' id='Password' class='textbox'></td>
</tr>
<tr class='tdbg'>
	<td width='180' height='30' align='right' class='clefttitle'><strong>账号类型：</strong></td>
	<td><input name='AccountType' value='<%=AccountType%>' type='text' id='AccountType' class='textbox'> <select name="sType" id="sType" onChange="myform.AccountType.value=this.options[this.selectedIndex].value">
        <option selected="selected" value="">点这可选择类型</option>
        <option value="实名认证">实名认证</option>
        <option value="手机认证">手机认证</option>
        <option value="普通号">普通号</option>
        <option value="邮箱号">邮箱号</option>
        <option value="手机号">手机号</option>
        </select></td>
</tr>

<tr class='tdbg'>
	<td width='180' height='30' align='right' class='clefttitle'><strong>邮箱账号：</strong></td>
	<td><input name='Email' type='text' class='textbox' id='Email' value='<%=Email%>'></td>
</tr>
<tr class='tdbg'>
	<td width='180' height='30' align='right' class='clefttitle'><strong>邮箱密码：</strong></td>
	<td><input name='EmailPassword' value='<%=EmailPassword%>' type='text' id='EmailPassword' class='textbox'></td>
</tr>
<tr class='tdbg'>
	<td width='180' height='30' align='right' class='clefttitle'><strong>支付宝账号：</strong></td>
	<td><input name='Alipay' type='text' class='textbox' id='Alipay' value='<%=Alipay%>'></td>
</tr>
<tr class='tdbg'>
	<td width='180' height='30' align='right' class='clefttitle'><strong>支付密码：</strong></td>
	<td><input name='AlipayPassword' value='<%=AlipayPassword%>' type='text' id='AlipayPassword' class='textbox'></td>
</tr>
<tr class='tdbg'>
	<td width='180' height='30' align='right' class='clefttitle'><strong>身份证号码：</strong></td>
	<td><input name='IDCard' value='<%=IDCard%>' type='text' id='IDCard' class='textbox' size="40"></td>
</tr>
<tr class='tdbg'>
	<td width='180' height='30' align='right' class='clefttitle'><strong>身份证姓名：</strong></td>
	<td><input name='IDCardName' value='<%=IDCardName%>' type='text' id='IDCardName' class='textbox'></td>
</tr>
<tr class='tdbg'>
	<td width='180' height='30' align='right' class='clefttitle'><strong>账号信誉值：</strong></td>
	<td><input name='Credit' value='<%=Credit%>' type='text' id='Credit' class='textbox'> （即该小号的淘宝信誉值）</td>
</tr>
<tr class='tdbg'>
	<td width='180' height='30' align='right' class='clefttitle'><strong>注册时间：</strong></td>
	<td><input name='RegDate' type='text' id='RegDate' value='<%=RegDate%>' onChange="this.value=this.value.substr(0,10)" onBlur="this.value=this.value.substr(0,10)" class='textbox'> <a href='#' onClick="popUpCalendar(this, $('input[name=RegDate]').get(0), dateFormat,-1,-1)"><img src='Images/date.gif'  border='0' align='absmiddle' title='选择日期'></a>日期格式如：2013-08-10</td>
</tr>
<tr class='tdbg'>
	<td width='180' height='30' align='right' class='clefttitle'><strong>出售价格：</strong></td>
	<td><input name='Price' value='<%=Price%>' type='text' id='Price' class='textbox'> 元</td>
</tr>
<tr class='tdbg'>
	<td width='180' height='30' align='right' class='clefttitle'><strong>初始状态设置：</strong></td>
	<td><select name="Status">
	  <option value="0"<%If KS.ChkClng(sStatus)=0 Then KS.Echo " selected"%>>未使用</option>
	  <option value="1"<%If KS.ChkClng(sStatus)=1 Then KS.Echo " selected"%>>已出售</option>
	  <option value="2"<%If KS.ChkClng(sStatus)=2 Then KS.Echo " selected"%>>停用</option>
	</select></td>
</tr>
<tr class='tdbg'>
	<td width='180' height='30' align='right' class='clefttitle'><strong>备注说明：</strong></td>
	<td><textarea name="remark" id="remark" cols="48" rows="5"><%=remark%></textarea></td>
</tr>
</form>
</table>
<br>
<div id='save'>
<li class='parent' onClick="return(CheckForm())">
	<span class=child onMouseOver="this.parentNode.className='parent_border'" onMouseOut="this.parentNode.className='parent'"><img src='images/ico/save.gif' border='0' align='absmiddle'>确定保存</span>
</li>
<li class='parent' onClick="parent.closeWindow()">
    <span class=child onMouseOver="this.parentNode.className='parent_border'" onMouseOut="this.parentNode.className='parent'"><img src='images/ico/back.gif' border='0' align='absmiddle'>关闭取消</span>
</li>
</div>

  </body>
  </html>
	<%
	End Sub

'单个添加/编辑保存账号
Sub AddSave()
	If KS.CheckOuterUrl()=False Then
		Dim RS,Sql
		Dim ID: ID = KS.S("ID")
		Dim Password: Password = Trim(KS.S("Password"))
		Dim Account: Account = Trim(KS.S("Account"))
		Dim Email: Email = Trim(KS.S("Email"))
		Dim EmailPassword: EmailPassword = Trim(KS.S("EmailPassword"))
		Dim AccountType: AccountType = Trim(KS.S("AccountType"))
		Dim IDCard: IDCard = Trim(KS.S("IDCard"))
		Dim IDCardName: IDCardName = Trim(KS.S("IDCardName"))
		Dim Alipay: Alipay = Trim(KS.S("Alipay"))
		Dim AlipayPassword: AlipayPassword = Trim(KS.S("AlipayPassword"))
		Dim Credit: Credit = Trim(KS.S("Credit"))
		Dim Price: Price = Trim(KS.S("Price"))
		Dim RegDate: RegDate = Left(Trim(KS.S("RegDate")),10)
		Dim sStatus: sStatus = Trim(KS.S("Status"))
		Dim remark: remark = Trim(KS.S("remark"))

		 If Account = "" Then Call KS.AlertHistory("请输入淘宝账号!", -1): Exit Sub
		 If Not IsDate(RegDate) Then Call KS.AlertHistory("你输入的账号注册日期格式不正确，请按格式输入如：2013-08-10", -1): Exit Sub
		 Set RS = Server.CreateObject("ADODB.RECORDSET")
		 If ID = "" Then
		 	 Sql = "Select Top 1 * From ShopNameBuy Where Account='" & Account & "'"
			 RS.Open Sql, conn, 1, 3
			 If Not RS.Eof Then
				RS.Close
			  	Set RS = Nothing
			 	Call KS.AlertHistory("抱歉！该账号已存在，不可重复添加!", -1)
				Exit Sub
			 End If
			 RS.AddNew
		 Else
			 Sql = "Select Top 1 * From ShopNameBuy Where ID=" & ID
			 RS.Open Sql, conn, 1, 3
			 If RS.EOF Then
			 	RS.Close
				Set RS = Nothing
			 	Call KS.AlertHistory("数据库中不存在该账号!", -1)
			   	Exit Sub
			 End If
		 End If
		  RS("Password") = Password
		  RS("Account") = Account
		  RS("Email") = Email
		  RS("EmailPassword") = EmailPassword
		  RS("AccountType") = AccountType
		  RS("IDCard") = IDCard
		  RS("IDCardName") = IDCardName
		  RS("Alipay") = Alipay
		  RS("AlipayPassword") = AlipayPassword
		  RS("Credit") = Credit
		  RS("Price") = Price
		  RS("RegDate") = RegDate
		  RS("Status") = KS.ChkClng(sStatus)
		  RS("remark") = remark
		  RS("AddDate") = Now()
		  If KS.ChkClng(sStatus) = 0 Then RS("IP") = NULL
		  RS.Update
		  RS.Close
		  Set RS = Nothing
		  If ID = "" Then
			  KS.Echo ("<Script> if (confirm('账号添加成功,还继续添加吗?')) { location.href='?Action=Add';} else{top.frames[""MainFrame""].location.reload();}</script>")
		  Else
			  KS.Echo ("<Script> alert('账号修改成功！'); top.frames[""MainFrame""].location.reload();</script>")
		  End If
	End If
End Sub

'批量添加保存
Sub AddSaves()
	If KS.CheckOuterUrl()=False Then
		Dim RS,Sql,i,n
		Dim Password, Account, Email, EmailPassword, IDCard, IDCardName, Alipay, AlipayPassword,sStatus
		Dim Account_Arr: Account_Arr = Trim(KS.S("Account"))
		Dim AccountType: AccountType = Trim(KS.S("AccountType"))
		Dim Credit: Credit = KS.ChkClng(KS.S("Credit"))
		Dim Price: Price = Trim(KS.S("Price"))
		Dim RegDate: RegDate = Left(Trim(KS.S("RegDate")),10)

		If Account_Arr = "" Then Call KS.AlertHistory("请输入淘宝账号!", -1): Exit Sub
		If Not IsDate(RegDate) Then Call KS.AlertHistory("你输入的账号注册日期格式不正确，请按格式输入如：2013-08-10", -1): Exit Sub
		If InStr(Account_Arr ,"|") = 0 Then Call KS.AlertHistory("请填写的账号信息格式不对，请按格式填写提交！", -1): Exit Sub
		Account_Arr = Split(Account_Arr, vbCrlf)
		Set RS = Server.CreateObject("ADODB.RECORDSET")
		For i=0 To Ubound(Account_Arr)
			If Not KS.IsNul(Trim(Account_Arr(i))) Then
				Account = Split(Account_Arr(i), "|")
				If Ubound(Account) = 6 Then					
					Sql = "Select Top 1 * From ShopNameBuy Where Account='" & Trim(Account(0)) & "'"
					RS.Open Sql, Conn, 1, 3
					If Not RS.Eof Then
						RS.Close
						Set RS = Nothing
						Call KS.AlertHistory("抱歉！" & Account(0) & " 账号已存在，不可重复添加!", -1)
						Exit Sub
					End If
					RS.AddNew					
					RS("Account") = Account(0)
					RS("Password") = Account(1)
					RS("Email") = Account(2)
					RS("EmailPassword") = Account(3)
					RS("AccountType") = AccountType
					RS("IDCard") = Account(5)
					RS("IDCardName") = Account(6)
					RS("Alipay") = Account(2)
					RS("AlipayPassword") = Account(4)
					RS("Credit") = Credit
					RS("Price") = Price
					RS("RegDate") = RegDate
					RS("AddDate") = Now()
					RS.Update
					RS.Close
				Else
					n = n + 1
				End If
			End If
		Next
		Set RS = Nothing
		If n = Ubound(Account_Arr) + 1 Then
			Call KS.AlertHistory("抱歉！添加失败，原因是格式填写不对！", -1)
		ElseIf n > 0 Then
			KS.Echo ("<Script> if (confirm('批量添加成功，但有" & n & "条由于格式填写不对添加失败的。\n\n还继续添加吗?')) { location.href='?Action=Adds';} else{top.frames[""MainFrame""].location.reload();}</script>")
		Else
			KS.Echo ("<Script> if (confirm('批量添加成功，还继续添加吗?')) { location.href='?Action=Adds';} else{top.frames[""MainFrame""].location.reload();}</script>")
		End If
	End If
End Sub

Sub DoMod()
	Dim ID: ID=KS.ChkClng(KS.G("ID"))
	IF KS.CheckOuterUrl()=False Then
		Dim StatusID : StatusID = KS.ChkClng(KS.S("Status"))
		If ID <> 0 Then
			Conn.Execute("Update ShopNameBuy Set Status=" & StatusID & " Where ID=" & ID)
			KS.AlertHintScript("设置成功！")
		End If
	End If
End Sub
	
	
		Public Sub Run()
	    If Not (KS.ReturnPowerResult(0, "KMUA10007") or KS.ReturnPowerResult(5,"M510014"))Then
			  Call KS.ReturnErr(1, "")
		End If
		SearchType=KS.ChkClng(KS.G("SearchType"))
		Dim begindate:begindate=request("begindate")
		Dim enddate:enddate=request("enddate")

		Dim ID,Action : Action=KS.S("Action")
		IF Action="Add" Then
			Call DoAdd()
			Exit Sub
		ElseIF Action="Adds" Then
			Call DoAdds()
			Exit Sub
		ElseIf Action="AddSave" Then
			Call AddSave()
			Exit Sub
		ElseIf Action="AddSaves" Then
			Call AddSaves()
			Exit Sub
		ElseIf Action="Mod" Then
			Call DoMod()
			Exit Sub
		ElseIF Action="Del" And KS.G("ID") <>"" then
			Call DoDel()
			Exit Sub
		ElseIF Action="del" then	'暂时没用到
			Dim Param
			Select Case KS.ChkClng(KS.G("DelType"))
				Case 1 Param="datediff(" & DataPart_D & ",adddate," & SqlNowString & ")>3"
				Case 2 Param="datediff(" & DataPart_D & ",adddate," & SqlNowString & ")>5"
				Case 3 Param="datediff(" & DataPart_D & ",adddate," & SqlNowString & ")>10"
				Case 4 Param="datediff(" & DataPart_D & ",adddate," & SqlNowString & ")>30"
			End Select
			If Param<>"" Then
				Conn.Execute("Delete From ShopNameBuy Where 1=1 and " & Param)
				KS.AlertHintScript "已按所选的条件，删除了相关记录！"
			End IF
			Exit Sub
		End If
		%>
<html>
<head><title>账号管理</title>
<meta http-equiv=Content-Type content="text/html; charset=gb2312">
<link href="include/Admin_Style.css" type=text/css rel=stylesheet>
<script src="../HSK_JS/jquery.js" type="text/javascript"></script>
<script src="../HSK_JS/common.js" language="JavaScript"></script>
<script language="JavaScript" src="../HSK_JS/HSK.Box.js"></script>
</head>
<body leftMargin=2 topMargin=0 marginheight="0" marginwidth="0">
  <div class="topdashed" style="padding:4px;">
  <table cellpadding="0" cellspacing="0" width="100%">
    <tr>
      <td>&nbsp; <a href="javascript:;" onClick="new KesionPopup().PopupCenterIframe('添加淘宝小号','?Action=Add',620,550,'no')"><strong style="color:red">【添加淘宝小号】</strong></a>
      &nbsp; <a href="javascript:;" onClick="new KesionPopup().PopupCenterIframe('批量添加淘宝小号','?Action=Adds',790,540,'no')"><strong style="color:red">【批量添加淘宝小号】</strong></a></td>
<FORM name="form2" action="?" method="post">
      <td style="border:1px #cccccc dashed">高级查询： 
<Select id=Field name=Field class='textbox'> 
  <Option value=1<%=KS.IIF(KS.ChkClng(KS.G("Field"))=1," selected","")%>>淘宝账号</Option> 
  <Option value=2<%=KS.IIF(KS.ChkClng(KS.G("Field"))=2," selected","")%>>邮箱账号</Option>
  <Option value=3<%=KS.IIF(KS.ChkClng(KS.G("Field"))=3," selected","")%>>账号类型</Option> 
  <Option value=4<%=KS.IIF(KS.ChkClng(KS.G("Field"))=4," selected","")%>>身份证姓名</Option> 
  <Option value=5<%=KS.IIF(KS.ChkClng(KS.G("Field"))=5," selected","")%>>购买人姓名</Option>
  <Option value=6<%=KS.IIF(KS.ChkClng(KS.G("Field"))=6," selected","")%>>支付宝号</Option>
</Select> 关键字：
  <Input id=Keyword class='textbox' maxLength=30 name=Keyword value="<%=KS.G("KeyWord")%>"> 
  <Input class='button' type=submit value=" 查 询 " name=Submit2> 
        <Input id=SearchType type=hidden value=5 name=SearchType> </td></FORM>
    </tr>
  </table>
  </div>

  <div style="border:1px #cccccc dashed;overflow:hidden"></div>
  
   <table width="100%" border="0">
<form action="?action=search&SearchType=100&Field=3" method=post name="myform">
   
   <tr>
     <td width="12%"><strong>按时间段查询</strong></td>
     <td width="48%">
       
       <table width="100%"  align="center" border=0 cellPadding=0 cellSpacing=0>
         <tr>
           <td nowrap="nowrap" class=form-left>起始日期：
             <%if isdate(begindate) then%>
             <input type="text" name="begindate" value="<%=begindate%>" size="12" class="form-input">
             <%else%>
             <input type="text" name="begindate" value="<%=year(now)&"-"&month(now)&"-1"%>" size="12" class="form-input">
             <%end if%>
            </td>    
		    <td  class=form-left>终止日期：  
		      <%if isdate(enddate) then%>            
		      <input type="text" name="enddate" value="<%=enddate%>" size="12" class="form-input">
		      <%else%>
		      <input type="text" name="enddate" value="<%=formatdatetime(now,2)%>" size="12" class="form-input">
		      <%end if%>
		      </td>    
			</tr>
        </table>	 </td>
     <td width="40%">购买人用户名：
      <input type="text" class='textbox' name="keyword" size="10" value="<%If KS.ChkClng(KS.G("Field"))=3 Then KS.Echo Request("keyword")%>" /> &nbsp;
      <input name="submit2" type="submit" value="按日期查找" class='button' />
      </td>
    </tr>
</form>
 </table>
<table width="100%">
    <tr>
      <td align=left>
	  <%
	  if begindate<>"" and enddate<>"" then
	   response.write "<br><div align=center style='font-size:14px'>"
	 response.write "查询时间段 <font color=red>" & begindate & "</font> 至 <font color=red>" & enddate & "</font><br></div>"
	  end if
	  %></td>
    </tr>
  </table>
  
  
  
  <table width="100%">
    <tr>
      <td align=left>您现在的位置：账号管理&nbsp;&gt;&gt;&nbsp;
	  <%Dim SearchTypeStr,SQLStr,TotalPages
	    Dim KeyWord:KeyWord=Trim(KS.G("KeyWord"))
	  Select Case SearchType
		 Case 5 
		    Select Case KS.ChkClng(KS.G("Field"))
			  Case 1:SearchTypeStr="淘宝账号含有<font color=red>""" & KeyWord & """</font>"
			  Case 2:SearchTypeStr="邮箱账号含有<font color=red>""" & KeyWord & """</font>"
			  Case 3:SearchTypeStr="账号类型含有<font color=red>""" & KeyWord & """</font>"
			  Case 4:SearchTypeStr="身份证姓名含有<font color=red>""" & KeyWord & """</font>"
			  Case 5:SearchTypeStr="购买人姓名含有<font color=red>""" & KeyWord & """</font>"
			  Case 6:SearchTypeStr="支付宝账号含有<font color=red>""" & KeyWord & """</font>"
			End Select
		Case 100:SearchTypeStr="时间段查询结果"
	  End Select
	  Response.Write SearchTypeStr%></td>
    </tr>
  </table>
    <div style="border:1px #cccccc dashed;overflow:hidden"></div>

  <table cellSpacing=0 cellPadding=0 width="100%" border=0>
  <form name="selform" method="post" action="?action=Del">
    <tr class=sort align=middle>
	  <td width="4%" nowrap>选择</td>
      <td width="9%" height="25">淘宝账号</td>
      <td width="8%">账号密码</td>
      <td width="7%">账号类型</td>
      <td width="7%">账号信誉值</td>
      <td width="9%">支付宝账号</td>
      <td width="8%">支付密码</td>
      <td width="7%">身份证姓名</td>
      <td width="8%">购买人</td>
      <td width="10%">购买时间</td>
      <td width="6%">价格</td>
      <td width="6%"><%If KS.S("q") <> "asc" Then%>
      <a href="?q=asc" title="点击按未出售的排序">状态<img src="/style/images/down_icon.gif" align="absmiddle" border=0 /></a>
	  <%Else%>
	  <a href="?" title="点击按默认新发布的排序">状态<img src="/style/images/down_icon2.gif" align="absmiddle" border=0 /></a>
	  <%End If%></td>
      <td width="">操作</td>
    </tr>
	<%
			MaxPerPage=20
			Page = KS.ChkClng(KS.G("page"))
			If Page<=0 Then  Page = 1
			SqlParam="1=1"
            If SearchType<>"0" Then
			  Select Case SearchType

			  Case 5
			      Select Case KS.ChkClng(KS.G("Field"))
				   Case 1
				   	 If KS.IsNul(Keyword) Then Keyword = 0
				     SqlParam=SqlParam &" And Account Like '%" & Keyword & "%'"
				   Case 2
				     SqlParam=SqlParam &" And Email Like '%" & Keyword & "%'"
				   Case 3
				     SqlParam=SqlParam &" And AccountType Like '%" & Keyword & "%'"
				   Case 4
				     SqlParam=SqlParam &" And IDCardName Like '%" & Keyword & "%'"
				   Case 5
				     SqlParam=SqlParam &" And BuyUserName Like '%" & Keyword & "%'"
				   Case 6
				     SqlParam=SqlParam &" And Alipay Like '%" & Keyword & "%'"
				  End Select
			  Case 100
			  		If Keyword <> "" Then
				  		SqlParam=SqlParam &" And BuyUserName Like '%" & Keyword & "%'"
					End If
			  End Select
			End If
			If CInt(DataBaseType) = 1 Then         'Sql
				if isdate(begindate) then SqlParam=SqlParam & " and AddDate>='" & begindate & "'"
				if isdate(enddate) then enddate=DateAdd("d", 1,EndDate):SqlParam=SqlParam & " and AddDate<='" & enddate & "'"
			else
				if isdate(begindate) then SqlParam=SqlParam & " and AddDate>=#" & begindate & "#"
				if isdate(enddate) then enddate=DateAdd("d", 1,EndDate):SqlParam=SqlParam & " and AddDate<=#" & enddate & "#"
			end if


    If DataBaseType=1 Then
					Dim Cmd : Set Cmd = Server.CreateObject("ADODB.Command")
					Set Cmd.ActiveConnection=conn
					Cmd.CommandText="KS_GetPageRecords"
					Cmd.CommandType=4	
					CMD.Prepared = true 
					Cmd.Parameters.Append cmd.CreateParameter("@tblName",202,1,200)
					Cmd.Parameters.Append cmd.CreateParameter("@fldName",202,1,200)
					Cmd.Parameters.Append cmd.CreateParameter("@pagesize",3)
					Cmd.Parameters.Append cmd.CreateParameter("@pageindex",3)
					Cmd.Parameters.Append cmd.CreateParameter("@ordertype",3)
					Cmd.Parameters.Append cmd.CreateParameter("@strWhere",202,1,1000)
					Cmd.Parameters.Append cmd.CreateParameter("@fieldIds",202,1,1000)
					Cmd("@tblName")="ShopNameBuy"
					Cmd("@fldName")= "ID"
					Cmd("@pagesize")=MaxPerPage
					Cmd("@pageindex")=page
					Cmd("@ordertype")=1
					Cmd("@strWhere")=SqlParam
					Cmd("@fieldIds")="*"
					If KS.S("q") = "asc" Then
						Cmd("@fldName")= "Status"
						Cmd("@ordertype")=0
					End If
					Set Rs=Cmd.Execute
					Set Cmd = Nothing
	 Else
			SQLStr=KS.GetPageSQL("ShopNameBuy","ID",MaxPerPage,Page,1,SqlParam,"*")
			Set RS = Server.CreateObject("AdoDb.RecordSet")
			RS.Open SQLStr, conn, 1, 1
	 End If
	If RS.Eof AND RS.Bof Then
	 Response.WRITE "<tr class=list onmouseover=""this.className='listmouseover'"" onmouseout=""this.className='list'""><td colspan=13 align=center height='25'>当前没记录或找不到" & SearchTypeStr & "!</td></tr></table></form>"
	Else
		totalPut = Conn.Execute("Select Count(0) From ShopNameBuy Where " & SqlParam)(0)
		Call showContent()
	End If
	RS.Close:Set RS=Nothing
   %>
<br/>
	<br/>
<div class="attention">
<strong>特别建议：</strong>
请谨慎操作，删除扣不可恢复。
<br />

<iframe src='about:blank' style='display:none' name='_hiddenframe' id='_hiddenframe'></iframe>
<form action="?action=del" target="_hiddenframe" method=post onSubmit="return confirm('确实要删除有关记录吗？请慎重!')">
删除范围：<input name="deltype" type="radio" value=1>
3天前 
    <input name="deltype" type="radio" value="2" checked="checked" />
    5天前
    <input name="deltype" type="radio" value="3" />
    10天前
    <input name="deltype" type="radio" value="4" />
    1个月前
    <input type="submit" value="执行删除" class="button">
	</form>

	<br/>
</body>
</html>
   <%
   End Sub
  
  Sub ShowContent()
     on error resume next
     Dim I
     Do While Not rs.eof 
	%>
    <tr class=list onMouseOver="this.className='listmouseover'" onMouseOut="this.className='list'" onClick="$('#C<%=rs("id")%>').toggle()">
	  <td align="center" class="splittd"><input type="checkbox" name="ID" value="<%=rs("id")%>"></td>
      <td  class="splittd" align=middle><a href="javascript:;" onClick="new KesionPopup().PopupCenterIframe('编辑账号','?Action=Add&Optype=Edit&ID=<%=rs("ID")%>',620,550,'no')"><%=rs("Account")%></a></td>
      <td  class="splittd" align=middle><%=rs("Password")%></td>
      <td  class="splittd" align=middle><%=rs("AccountType")%></td>
      <td  class="splittd" align=middle><%=rs("Credit")%></td>
      <td  class="splittd" align=middle><%=rs("Alipay")%>&nbsp;</td>
      <td  class="splittd" align=middle><%=rs("AlipayPassword")%>&nbsp;</td>
	  <td  class="splittd" align=middle><%=rs("IDCardName")%>&nbsp;</td>
      <td  class="splittd" align=middle><%=rs("BuyUserName")%>&nbsp;</td>
      <td  class="splittd" align=middle><%=rs("BuyDate")%>&nbsp;</td>
      <td  class="splittd" align=middle><%=rs("Price")%> 元</td>
      <td  class="splittd" align=middle><%
			  Select Case KS.ChkClng(rs("Status"))
					Case 0
						KS.Echo "<span style=""color:blue"">出售中</span>"
					Case 1
						KS.Echo "<span style=""color:green"">已出售</span>"
					Case 2
						KS.Echo "<span style=""color:#FF5500"">已停用</span>"
			  End Select
		  %></td>
      <td  class="splittd" align=center><%
	  If KS.ChkClng(rs("Status")) = 2 Then%>
      <a href="?Action=Mod&Status=0&ID=<%=rs("ID")%>" onClick="return confirm('您确定要恢复该账号吗？')">启用</a>|
      <%ElseIf KS.ChkClng(rs("Status")) = 0 Then%>
	  <a href="?Action=Mod&Status=2&ID=<%=rs("ID")%>" onClick="return confirm('您确定要停用该账号吗？')">停用</a>|
	  <%End If%><a href="javascript:;" onClick="new KesionPopup().PopupCenterIframe('编辑账号','?Action=Add&Optype=Edit&ID=<%=rs("ID")%>',620,550,'no')">修改</a>|<a href="?Action=Del&ID=<%=rs("ID")%>" onClick="return confirm('您确定要删除吗？')" title="删除账号">删除</a></td>
    </tr>
    <tr id="C<%=rs("id")%>" bgcolor="#EEEEEE" style="display:none;">
      <td class="splittd" align=center colSpan=13>身份证号码：<%=rs("IDCard")%> &nbsp; &nbsp; 邮箱账号：<%=rs("Email")%> &nbsp; &nbsp; 邮箱密码：<%=rs("EmailPassword")%> &nbsp; &nbsp; 账号注册日期：<%=rs("RegDate")%> &nbsp;  &nbsp; 发布时间：<%=rs("AddDate")%> &nbsp;  &nbsp; 购买人IP：<%=rs("IP")%></td>
    </tr>
	<%
	I = I + 1
	RS.MoveNext
	If I >= MaxPerPage Then Exit Do
	loop
	%>
<tr>
	<td class='list' onMouseOver="this.className='listmouseover'" onMouseOut="this.className='list'" height='25' colspan=11>
	&nbsp;&nbsp;<input id="chkAll" onClick="CheckAll(this.form)" type="checkbox" value="checkbox"  name="chkAll">全选
    <input class="button" type="submit" name="Submit2" value=" 删除选中的任务 " onClick="{if(confirm('确定要删除选中的记录吗?')){this.document.selform.submit();return true;}return false;}"></td>
</tr>
</form>
<tr>
	<td colspan=11 align=right>
	<%
	 Call KSCLS.ShowPage(totalPut, MaxPerPage, "", True, "条", Page, KS.QueryParam("page"))
	%></td>
</tr>
</table>
		<%
		End Sub
		
End Class
%>
