<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%option explicit%>
<!--#include file="../Conn.asp"-->
<!--#include file="../HSK_Cls/HSK.MemberCls.asp"-->
<%
Dim KSCls
Set KSCls = New ShopNameDetailCls
KSCls.Run()
Set KSCls = Nothing

Class ShopNameDetailCls
	Private ComeUrl,Action,LoginTF
	Private KS,KSUser,RS,I,ID
	Private Price
	Private Sub Class_Initialize()
		Set KS=New PublicCls
		Set KSUser = New UserCls
	End Sub
	Private Sub Class_Terminate()
		Set KS=Nothing
		Set KSUser=Nothing
		Call CloseConn()
	End Sub

	Public Sub Run()
		ComeUrl=Request.ServerVariables("HTTP_REFERER")
		LoginTF=Cbool(KSUser.UserLoginChecked)
		IF LoginTF=false  Then
		  GCls.ComeUrl=ComeUrl	'GCls.GetUrl()
		  Response.Write "<script>top.location.href='Login/';</script>"
		  Exit Sub
		End If
		
IF KS.CheckOuterUrl()=False Then
	ID=KS.ChkClng(KS.S("ID"))
	IF ID<>0 Then
		If KS.S("N") = "1" Then
			Call DoSucceed()
			Exit Sub
		End If
		If KS.S("Action")="Buy" Then
			Call DoBuy()
			Exit Sub
		ElseIf KS.S("Action")="Succeed" Then
			Call DoSucceed()
			Exit Sub
		End If
		
		Set RS=Server.CreateObject("ADODB.RECORDSET")
		RS.Open "Select Top 1 * From ShopNameBuy Where Status=0 And ID="& ID,Conn,1,1
		If Not RS.Eof Then
			Price = RS("Price")
%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>账号详细浏览</title>
<script src="../HSK_JS/jquery.js" type="text/javascript"></script>
<style type="text/css">
body {background:#ffffff; color:#106899; font:12px/20px Arial,Verdana,Tahoma,"宋体";margin:0 auto;}
*{padding:0px;margin:0px;}
.clear{	clear: both;height:0px;display:block;*display:inline;}
a{text-decoration:none;color:#20537A;}
a:hover{text-decoration:underline;}
.orange,.orange a{color:#FF5500;}
.center_tbl td {border-bottom:1px solid #E5F5FF; line-height:34px; height:35px; clear:both; background-color:#FFF}
.center_tbl tr:hover td{background-color:#EBF5FF}
</style>
</head>
<body>

<table  width="100%" border="0" align="center" cellpadding="1" cellspacing="1">
  <tr>
  	<td align="center" bgcolor="#FFFEDF" style="height:30px; line-height:30px; color:red; font-weight:bold; border:1px solid #FC3;">
    <p>好消息！接手任务没有买号的用户请注意了！<br />
    本站出售的买号绝对安全、放心，没有使用过的，可修改密码！欢迎选购！</p></td>
  </tr>
</table>
<br />
<table  width="100%" border="0" align="center" cellpadding="1" cellspacing="1" class="center_tbl">
 <form id="form1" name="form1" method="post" action="?ID=<%=ID%>&Action=Buy" onSubmit="return confirm('您确定要购买吗？')">
 <tr class="tdbg">
  <td width="30%" height="35" align="right" class="clefttitle"><strong><span>淘宝小号名：</span></strong></td>
  <td width="70%">&nbsp;<strong style="font-size:14px"><%=Left(RS("Account"),Len(RS("Account")) - 3) & "***"%></strong> &nbsp; [购买后显示完整账号]</td>
 </tr>
  <tr class="tdbg" height="35">
  	<td align="right" class="clefttitle"><strong>价 格：</strong></td>
    <td>&nbsp;<strong class="orange" style="font-size:16px">￥ <%=KS.GetN(Price, 2)%></strong> 元</td>
  </tr>
  <tr class="tdbg" height="35">
  	<td align="right" class="clefttitle"><strong>结算方式：</strong></td>
    <td>&nbsp;<label for="PayType" class="orange"><input name="PayType" type="radio" id="PayType" value="1" checked="checked" /> 账户余额</label> &nbsp; &nbsp; <%If KS.GetN(KSUser.GetUserInfo("Money"),3) < KS.GetN(Price,3) Then%><a href="/user/User_Transfer.asp" target="_blank" class="orange"><strong>我要充值>></strong></a><%Else KS.Echo "您当前账户余额：" & KS.GetN(KSUser.GetUserInfo("Money"),3) & " 元"%><%End If%></td>
  </tr>
  <tr>
  	<td colspan="2" align="center" bgcolor="#EEF1F1" style="height:80px; line-height:80px;"><input type="image" name="Save" src="/style/images/ConfirmButton.gif" /></td>
  </tr>
  </form>
</table>
</body>
</html>
<%
		RS.Close
		Set RS = Nothing
	Else
		KS.Die "<script language=""Javascript"">alert('抱歉！你下手太慢了，该账号已经被别人购买了！');parent.location.reload();parent.closeWindow();</script>"
	End If
End If
Else
	KS.AlertHistory "请不要非法提交，谢谢！","-1"	
End If
End Sub

Sub DoBuy()
Dim RS, Money, PayType
PayType = KS.ChkClng(KS.S("PayType"))


	Set RS=Server.CreateObject("ADODB.RECORDSET")
	RS.Open "Select Top 1 * From ShopNameBuy Where Status=0 And ID=" & ID,Conn,1,3
	If Not RS.Eof Then
		Money = RS("Price")
		
		If Round(Money, 2) > Round(KSUser.GetUserInfo("Money"),2) Then
			RS.Close
			Set RS = Nothing
			KS.AlertHistory "抱歉！您的账户余额不足，请充值后再来购买！","-1"
		End If

		RS("Status") = 1
		RS("BuyUserName") = KSUser.UserName
		RS("BuyDate") = Now()
		RS("IP") = KS.GetIP()
		RS.Update
		If Round(Money, 2) > 0 Then
			Call KS.MoneyInOrOut(KSUser.UserName,KSUser.GetUserInfo("RealName"),Money,4,2,now,0,"系统","购买一个淘宝小号！",0,0,1)
		End If
	
		Dim Content: Content="淘宝账号：" & RS("Account") & "<br>"
			Content = Content & "账号密码：" & RS("Password") & "<br>"
			Content = Content & "账号类型：" & RS("AccountType") & "<br>"
			Content = Content & "邮箱账号：" & RS("Email") & "<br>"
			Content = Content & "邮箱密码：" & RS("EmailPassword") & "<br>"
			Content = Content & "支付宝账号：" & RS("Alipay") & "<br>"
			Content = Content & "支付密码：" & RS("AlipayPassword") & "<br>"
			Content = Content & "身份证号码：" & RS("IDCard") & "<br>"
			Content = Content & "身份证姓名：" & RS("IDCardName") & "<br>"
			Content = Content & "账号信誉值：" & RS("Credit") & "<br>"
			Content = Content & "账号注册日期：" & RS("RegDate") & "<br>"
			IF Not KS.IsNul(RS("Remark")) Then
				Content = Content & "-------------------------------------------<br>"
				Content = Content & RS("Remark") & "<br>"
			End If
		RS.Close
		Set RS = Nothing
		Call KSUser.AddLog(KSUser.UserName,"购买一个淘宝小号！",1)
		Call KS.SendInfo(KSUser.UserName,"System","恭喜您成功购买一个淘宝小号","账号信息如下：<br>" & Content)
		KS.Alert "恭喜！购买成功！\n\n同时购买账号信息已发送到你的站内信箱，请注意查收！\n\n点击确定按钮后显示完整账号信息，请复制保存好！","?ID=" & ID & "&Action=Succeed"
	Else
		KS.AlertHistory "抱歉！你下手太慢了，该小号已经被别人领走了！","-1"
	End If

End Sub


Sub DoSucceed()
	Set RS=Server.CreateObject("ADODB.RECORDSET")
	RS.Open "Select Top 1 * From ShopNameBuy Where BuyUserName = '" & KSUser.UserName & "' And Status=1 And ID="& ID,Conn,1,1
	If Not RS.Eof Then
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>账号详细浏览</title>
<script src="../HSK_JS/jquery.js" type="text/javascript"></script>
<style type="text/css">
body {background:#ffffff; color:#106899; font:12px/20px Arial,Verdana,Tahoma,"宋体";margin:0 auto;}
*{padding:0px;margin:0px;}
.button{cursor: pointer;height:23px;border:1px solid #cccccc;background:url(/style/images/button/button_bg.gif) left repeat-x;}
</style>
</head>
<body>
<script language="javascript">
//复制内容进剪贴板
function copyToClipboard(txt,msg) {
	  if(window.clipboardData) {
			  window.clipboardData.clearData();		
			  window.clipboardData.setData("Text", txt);		
	  } else if (window.netscape) {		
		   try {		
				netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");		
		   } catch (e) {		
				alert("被浏览器拒绝！\n请在浏览器地址栏输入'about:config'并回车\n然后将 'signed.applets.codebase_principal_support'设置为'true'");		
		   }		
		   var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);		
		   if (!clip)		
				return;		
		   var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);		
		   if (!trans)		
				return;		
		   trans.addDataFlavor('text/unicode');		
		   var str = new Object();		
		   var len = new Object();		
		   var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);		
		   var copytext = txt;		
		   str.data = copytext;		
		   trans.setTransferData("text/unicode",str,copytext.length*2);		
		   var clipid = Components.interfaces.nsIClipboard;		
		   if (!clip)		
				return false;		
		   clip.setData(trans,null,clipid.kGlobalClipboard);
	  } else {	
			alert('抱歉！该浏览器(非IE内核)不支持复制，请用鼠标选中账号右键复制！');
			return;	
	  }			  
	  msg = (typeof(msg)=="undefined")?'复制成功！':msg;		
	  alert(msg);	
 }
</script>

<table  width="100%" border="0" align="center" cellpadding="1" cellspacing="1">
  <tr>
  	<td align="center" bgcolor="#E8F8FF" style="height:40px; line-height:40px; color:blue; font-weight: bold">以下账号信息是你花了大洋购买所得，请复制保存好！</td>
  </tr>
</table>
<br />
<table  width="100%" border="0" align="center" cellpadding="1" cellspacing="1" class="center_tbl">
  <tr class="tdbg">
    <td align="center" class="clefttitle"><textarea name="Content" id="Content" cols="50" rows="13"><%			
	KS.Echo "淘宝账号：" & RS("Account") & vbCrlf
	KS.Echo "账号密码：" & RS("Password") & vbCrlf
	KS.Echo "账号类型：" & RS("AccountType") & vbCrlf
	KS.Echo "邮箱账号：" & RS("Email") & vbCrlf
	KS.Echo "邮箱密码：" & RS("EmailPassword") & vbCrlf
	KS.Echo "支付宝账号：" & RS("Alipay") & vbCrlf
	KS.Echo "支付密码：" & RS("AlipayPassword") & vbCrlf
	KS.Echo "身份证号码：" & RS("IDCard") & vbCrlf
	KS.Echo "身份证姓名：" & RS("IDCardName") & vbCrlf
	KS.Echo "账号信誉值：" & RS("Credit") & vbCrlf
	KS.Echo "账号注册日期：" & RS("RegDate") & vbCrlf
	KS.Echo "购买时间：" & Now
	IF Not KS.IsNul(RS("Remark")) Then
		KS.Echo vbCrlf & "-------------------------------------------"
		KS.Echo vbCrlf & RS("Remark")
	End If
	%></textarea> &nbsp;<input type="submit" name="bt" id="bt" class="button" value=" 复制内容 " onClick="copyToClipboard($('#Content').val(),'账号信息复制成功！')" />
    </td>
  </tr>
  <tr>
  	<td align="center" style="height:50px; line-height:50px;"><input type="image" name="Save" src="/style/images/CloseButton.gif" onClick="parent.closeWindow();" /></td>
  </tr>
</table>
</body>
</html>
<%
		RS.Close
		Set RS = Nothing
	Else
		KS.AlertHistory "抱歉！该账号不存在或已被删除了！","-1"
	End If
End Sub

End Class
%>