<!--#include file="head.asp"-->
<style>body{background-color: #fff;}</style>

<%
c=trim(SafeRequest("c"))
tid=trim(SafeRequest("tid"))
cact=trim(SafeRequestform("cact"))

'随机号
Function randarr()
Const stringmodarr = "0123456789"
strlength = Len(stringmodarr)
Randomize timer
For i = 1 To 5 
randarr2 = randarr2&Mid(stringmodarr,Int(Rnd * strlength + 1),1)  
Next 
randarr=randarr2
End Function

'创建财务流水randarrcwku
select case	trim(request.Cookies("cwku"))
case "aycaiwu"
randarrcwku="A"
case "aycaiwu01"
randarrcwku="B"
case "aycaiwu02"
randarrcwku="C"
case "aycaiwu03"
randarrcwku="D"
case "aycaiwu04"
randarrcwku="E"
case "aycaiwu05"
randarrcwku="F"
case else
randarrcwku="A"
end select
crandarrlei="C" 	'标示 D订单 C财务
crandarrhost="A" 	'服务器数据库


'开通VIP
if cact="buyvip" then

'创建财务流水号
crandarrlast=Right(("00"&Month(Now())),2)&Right(("00"&Day(Now())),2)&Right(("00"&hour(Now())),2)&Right(("00"&minute(Now())),2)&Right(("00"&second(Now())),2)&randarr()
crandarr=crandarrlei&crandarrhost&randarrcwku&crandarrlast

sql="select * from ayname where aynameid="&clng(request.Cookies("aynameid"))&"" 
rs.open sql,conn,1,3
if cint(rs("isvipid"))=1 then call PopErr("您已经是尊贵VIP了，不需要重复开通")
if ccur(rs("ayyue"))<ccur(vipj) then call PopErr2("开通尊贵VIP需要金额"&vipj&"元，您的账号余额不足，请先充值","chong")

aycaiwuyue=ccur(rs("ayyue"))-ccur(vipj)
if ccur(aycaiwuyue)<0 then aycaiwuyue=0
rs("ayyue")=aycaiwuyue
rs("ayxiaofei")=ccur(rs("ayxiaofei"))+ccur(vipj)
rs("isvipid")=1

if isnull(trim(rs("vipdate")))=false and trim(rs("vipdate"))<>"" then
	if DateDiff("d",now(),rs("vipdate"))<1 then '原时间已过期
	rs("vipdate")=DateAdd("yyyy",1,now())
	else
	rs("vipdate")=DateAdd("yyyy",1,rs("vipdate"))
	end if
else
rs("vipdate")=DateAdd("yyyy",1,now())
end if
rs.update
rs.close

'财务
conn.Execute("Insert Into "&request.Cookies("cwku")&"(aycaiwuleibie,aycaiwuuser,aycaiwudingdan,aycaiwudate,aycailiushui,aycaiwujine,aycaiwuyue,aycwfsjin,aycwinjin,aycaiwubody,aycaiwuzt) values('5','"&request.Cookies("aynameid")&"','"&crandarr&"','"&now()&"','"&crandarr&"','"&Formatnumber(vipj,3,true,-1,0)&"','"&Formatnumber(aycaiwuyue,3,true,-1,0)&"','"&Formatnumber(vipj,3,true,-1,0)&"','"&Formatnumber(vipj,3,true,-1,0)&"','开通VIP','1')")
call logadd(request.Cookies("aynameid"),"开通VIP成功",0,0)
call PopErr2("开通VIP成功","vip")

end if






'购买短信 余额转入
if cact="msn" then
msntiaoshu=SafeRequestform("msntiaoshu")

if msntiaoshu="10" then
msnjin=10
msnt=110
elseif msntiaoshu="20" then
msnjin=20
msnt=220
elseif msntiaoshu="30" then
msnjin=30
msnt=330
elseif msntiaoshu="40" then
msnjin=40
msnt=440
elseif msntiaoshu="50" then
msnjin=50
msnt=550
end if

sql="select * from ayname where aynameid="&request.Cookies("aynameid")&""
rs.open sql,conn,1,3
if ccur(rs("ayyue"))<ccur(msnjin) then call PopErr2("账户余额不足，请先充值","chong")
aycaiwuyue=ccur(rs("ayyue"))-ccur(msnjin)
if ccur(aycaiwuyue)<0 then aycaiwuyue=0
rs("ayyue")=aycaiwuyue
rs("ayxiaofei")=ccur(rs("ayxiaofei"))+ccur(msnjin)
rs.update
rs.close

'创建财务流水号
crandarrlast=Right(("00"&Month(Now())),2)&Right(("00"&Day(Now())),2)&Right(("00"&hour(Now())),2)&Right(("00"&minute(Now())),2)&Right(("00"&second(Now())),2)&randarr()
crandarr=crandarrlei&crandarrhost&randarrcwku&crandarrlast

conn.Execute("Insert Into "&trim(request.Cookies("cwku"))&"(aycaiwuleibie,aycaiwuuser,aycaiwudate,aycailiushui,aycaiwujine,aycaiwuyue,aycaiwuzhifu,aycwfsjin,aycwinjin,aycaiwubody,aycaiwuzt) values('5','"&request.Cookies("aynameid")&"','"&now()&"','"&crandarr&"','"&Formatnumber(msnjin,3,true,-1,0)&"','"&Formatnumber(aycaiwuyue,3,true,-1,0)&"','99','"&Formatnumber(msnjin,3,true,-1,0)&"','"&Formatnumber(msnjin,3,true,-1,0)&"','购买短信流量','1')")

call logadd(request.Cookies("aynameid"),"购买短信流量"&left(msnjin,10),0,0)
call PopErr2("短信流量购买成功","/user/vip")
end if



'消保 账户余额金额转入
if cact="xb" then
zmoney=SafeRequestform("zmoney")
if zmoney="" then call PopErr("请填写VIP开通金额200元")

if ccur(zmoney)<=0 then call PopErr("请填写VIP开通金额err2")

sql="select * from ayname where aynameid="&request.Cookies("aynameid")&""
rs.open sql,conn,1,3

if ccur(rs("ayisxiaojin"))>0 then
	fastj=ccur(xiaobaojine)-ccur(rs("ayisxiaojin"))
	if ccur(zmoney)<ccur(fastj) then call PopErr("VIP开通金额不低于"&fastj&"元")
	if ccur(rs("ayyue"))<ccur(fastj) then call PopErr2("账户余额不足，请先充值","chong")
else
	if ccur(zmoney)<ccur(xiaobaojine) then call PopErr("VIP开通金额不低于"&xiaobaojine&"元")
	if ccur(rs("ayyue"))<ccur(xiaobaojine) then call PopErr2("账户余额不足，请先充值","chong")
end if

if ccur(rs("ayyue"))<ccur(zmoney) then call PopErr2("账户余额不足，请先充值","chong")
aycaiwuyue=ccur(rs("ayyue"))-ccur(zmoney)
if ccur(aycaiwuyue)<0 then aycaiwuyue=0
rs("ayyue")=aycaiwuyue
rs("ayxiaofei")=ccur(rs("ayxiaofei"))+ccur(zmoney)
rs("ayisxiaobao")=1
rs("ayisxiaojin")=ccur(rs("ayisxiaojin"))+ccur(zmoney)
rs("xbdate")=now()
rs.update
rs.close
			
'创建财务流水号
crandarrlast=Right(("00"&Month(Now())),2)&Right(("00"&Day(Now())),2)&Right(("00"&hour(Now())),2)&Right(("00"&minute(Now())),2)&Right(("00"&second(Now())),2)&randarr()
crandarr=crandarrlei&crandarrhost&randarrcwku&crandarrlast

conn.Execute("Insert Into "&trim(request.Cookies("cwku"))&"(aycaiwuleibie,aycaiwuuser,aycaiwudate,aycailiushui,aycaiwujine,aycaiwuyue,aycaiwuzhifu,aycwfsjin,aycwinjin,aycaiwubody,aycaiwuzt) values('6','"&request.Cookies("aynameid")&"','"&now()&"','"&crandarr&"','"&Formatnumber(zmoney,3,true,-1,0)&"','"&Formatnumber(aycaiwuyue,3,true,-1,0)&"','99','"&Formatnumber(zmoney,3,true,-1,0)&"','"&Formatnumber(zmoney,3,true,-1,0)&"','转入VIP','1')")

call logadd(request.Cookies("aynameid"),"转入VIP"&left(zmoney,10),0,0)
call PopErr2("转入VIP操作成功","vip")
end if



%>

<script language="javascript">
function CheckIfid( String )
{ 
    var Letters = "1234567890.";
     var i;
     var c;
      if(String.charAt( 0 )=='-')
	return false;
      if( String.charAt( String.length - 1 ) == '-' )
          return false;
     for( i = 0; i < String.length; i ++ )
     {
          c = String.charAt( i );
	  if (Letters.indexOf( c ) < 0)
	     return false;
     }
     return true;
}
</script>


<script type="text/javascript">
function upperCase(zhi){

var myPattern = new RegExp("^[.]"); 
if(myPattern.exec(zhi)) 
	{
	document.getElementById("money").value="";
	alert('输入有误！');
	return jisuan();
	return false;
	}

if(zhi<=0 || zhi>=9999){
document.getElementById("money").value="";
alert('输入有误！');
return jisuan();
return false;
}
if(!CheckIfid(zhi))
   {
   document.getElementById("money").value="";
   alert("输入有误");
   return jisuan();
   return false;
   }
   
	arrStr=zhi.split(".");
	if(arrStr.length>2){
   document.getElementById("money").value="";
   alert("输入有误");
   return jisuan();
   return false;
	}

}  


function zupperCase(zhi){
if(zhi<=0 || zhi>=9999){
document.getElementById("zmoney").value="";
alert('输入有误！');
return false;
}
if(!CheckIfid(zhi))
   {
   document.getElementById("zmoney").value="";
   alert("输入有误");
   return false;
   }
   
	arrStr=zhi.split(".");
	if(arrStr.length>2){
   document.getElementById("zmoney").value="";
   alert("输入有误");
   return false;
	}
}  
</script>


<main>
<div  class="container">
<div class="ui-lrctnei">
<%call userleft()%>
<div class="r"> 
<div class="ui-content">
                        
					
                            
<div class="neiye">

                   
            
            <!-------------------------------------- 开始 -------------------------------------->	
		    <%if c="vip" then 'VIP%>						
            <div class="neibiaoti"></div>
            <div class="neibiaoti2">购买产品</div>
           	<div class="gexian20"></div>
                	<div class="neitableanquan">
                    <form action="" method="post" name="formy" id="formy">
			  <table width="450">
                        <tr>
                            <td>产品名称：<span style="color: #009900">尊贵VIP</span></td>
                        </tr>
                        <tr>
                            <td>产品金额：<%=Formatnumber(vipj,2,true,-1,0)%>元</td>
                        </tr>
                  		<tr>
                            <td>
                            <%
							call logadd(request.Cookies("aynameid"),"浏览vipbuy",9,0)
							sql="select ayyue,aynameid,ayisjssuo from ayname where aynameid="&request.Cookies("aynameid")&""
                            rs.open sql,conn,1,1
                            if not(rs.bof and rs.eof) then
							if cint(rs("ayisjssuo"))=1 then call PopErr2("账户状态不可用","/user/index")
                            else
                            response.Write("获取错误")
                            end if%>
                            账户余额：<%=Formatnumber(rs("ayyue"),2,true,-1,0)%>元 &nbsp;<a href="chong">[账号余额不足？立即充值]</a>
                            <%rs.close%>
                            </td>
                        </tr>
                  		<tr>
                            <td>
                            <input name="cact" type="hidden" id="cact" value="buyvip">
                            <input type="submit" name="Submit" value=" 确 认 开 通 VIP " class="logindlregedit">
                            </td>
                        </tr>
                        
                    </table>
                    </form>
            		</div>
                    <div class="gexian20"></div>	
             <%end if%>
            <!-------------------------------------- 结束 -------------------------------------->
            
            
            
            
            
            
            
            

            
            <!-------------------------------------- 开始 -------------------------------------->	
		    <%
            if c="msn" then '短信流量
            %>						
            <div class="neibiaoti"></div>
            <div class="neibiaoti2">购买产品</div>
           	<div class="gexian20"></div>
                	<div class="neitableanquan">
                    <form action="" method="post" name="formy" id="formy">
			  <table width="450">
                        <tr>
                            <td>产品名称：短信流量</td>
                        </tr>

                        <tr>
                          <td>购买数量：
                            <select name="msntiaoshu" class="reginputdd">
                              <option value="10" selected>110条10元</option>
                              <option value="20">220条20元</option>
                              <option value="30">330条30元</option>
                              <option value="40">440条40元</option>
                              <option value="50">550条50元</option>
                            </select>
                          </td>
                        </tr>
                        
                  		<tr>
                            <td>账户余额:
                            <%sql="select ayyue,aynameid from ayname where aynameid="&request.Cookies("aynameid")&""
                            rs.open sql,conn,1,1
                            if not(rs.bof and rs.eof) then
                            response.Write Formatnumber(ccur(rs("ayyue")),2,true,-1,0)&"元"%>
                             &nbsp;<a href="chong">[账号余额不足？立即充值]</a>
                            <%else
                            response.Write("获取错误")
                            end if
                            rs.close%>
                            </td>
                        </tr>

                  		<tr>
                            <td>
                            <input name="cact" type="hidden" id="cact" value="msn">
                            <input type="submit" name="Submit" value=" 确 认 购 买 " class="logindlregedit">
                            </td>
                        </tr>
                        
                    </table>
                    </form>
            		</div>
                    <div class="gexian20"></div>	
             <%end if%>
             
            <!-------------------------------------- 结束 -------------------------------------->
            
            
         

            <!-------------------------------------- 开始 -------------------------------------->	
		    <%if c="neiqian" then '内嵌%>						
            <div class="neibiaoti"></div>
            <div class="neibiaoti2">购买产品</div>
           	<div class="gexian20"></div>
                	<div class="neitableanquan">
                    <form action="" method="post" name="formy" id="formy">
			  <table width="450">
                        <tr>
                            <td>产品名称：<span style="color: #009900">内嵌权限</span></td>
                        </tr>
                        <tr>
                            <td>产品金额：<%=Formatnumber(vneiqian,2,true,-1,0)%>元</td>
                        </tr>
                  		<tr>
                            <td>
                            <%sql="select ayyue,aynameid,ayisjssuo from ayname where aynameid="&request.Cookies("aynameid")&""
                            rs.open sql,conn,1,1
                            if not(rs.bof and rs.eof) then
							if cint(rs("ayisjssuo"))=1 then call PopErr2("账户状态不可用","/user/index")
                            else
                            response.Write("获取错误")
                            end if%>
                            账户余额：<%=Formatnumber(rs("ayyue"),2,true,-1,0)%>元 &nbsp;<a href="chong">[账号余额不足？立即充值]</a>
                            <%rs.close%>
                            </td>
                        </tr>
                  		<tr>
                            <td>
                            <input name="cact" type="hidden" id="cact" value="neiqian">
                            <input type="submit" name="Submit" value=" 确 认 开 通 " class="logindlregedit">
                            </td>
                        </tr>
                        
                    </table>
                    </form>
            		</div>
                    <div class="gexian20"></div>	
             <%end if%>
            <!-------------------------------------- 结束 -------------------------------------->




            <!-------------------------------------- 开始 -------------------------------------->	
		    <%if c="xb" then '消保%>						
            <div class="neibiaoti"></div>
            <div class="neibiaoti2">购买产品</div>
           	<div class="gexian20"></div>
                	<div class="neitableanquan">
                    		<%
							sql="select ayisxiaojin,ayyue,aynameid,ayisjssuo from ayname where aynameid="&request.Cookies("aynameid")&""
                            rs.open sql,conn,1,1
							if rs.bof and rs.eof then call PopErr("获取错误")
							yjjin=ccur(xiaobaojine)-ccur(rs("ayisxiaojin"))
							if ccur(yjjin)<0 then yjjin=0
                            %>
                    <form action="" method="post" name="formy" id="formy">
			  <table width="450">
                        <tr>
                            <td>产品名称：<span style="color: #009900">VIP会员 </span></td>
                        </tr>
                        <tr>
                            <td>转入金额：<input name="zmoney" type="text"  class="reginputdd" id="zmoney" onKeyUp="zupperCase(this.value)" value="<%=yjjin%>" size="8" maxlength="5"/> 元</td>
                        </tr>
                  		<tr>
                            <td>
                            <%
							if cint(rs("ayisjssuo"))=1 then call PopErr2("账户状态不可用","/user/index")
							%>
                            账户余额：<%=Formatnumber(rs("ayyue"),2,true,-1,0)%>元 &nbsp;<a href="chong">[账号余额不足？立即充值]</a>
                            </td>
                        </tr>
                  		<tr>
                            <td>
                            <input name="cact" type="hidden" id="cact" value="xb">
                            <input type="submit" name="Submit" value=" 确 认 转 入 开 通 " class="logindlregedit">
                            <%rs.close%>
                            </td>
                        </tr>
                        
                    </table>
                    </form>
            		</div>
                    <div class="gexian20"></div>	
             <%end if%>
            <!-------------------------------------- 结束 -------------------------------------->



            <div class="gexian20"></div>
            <div class="mzsmbox2" style="padding-top:20px;">
			<%if c="xb" then%>
            VIP开通费用，不支持退款与提现！<br>
            VIP：商品购买页面会点VIP标示。并点亮可信商家标示，支持加急结算与秒结算。<br>
            VIP标准：<%=xiaobaojine%>元/永久。<br>
            <%else%>
            尊贵VIP年费<%=vipj%>元，开通尊贵VIP后会自动开通内嵌代码功能和不限手机短信通知，并拥有以下特权：<br>
			尊贵VIP特权：支持加急提现，1-5位个性短链接(个性链接不限修改次数)，手机短信流量不限，查看代理需求信息，优先为买家推荐，优先结算，投诉宽松处理，晋升可信商家。<br>
            内嵌代码：开通内嵌代码功能后，可以将购买页面集成到自己的网站进行购买支付。<a href="mylink">【查看我的内嵌代码】</a>
            <%end if%>
            </div> 
            
            
            

        <div class="clearfix"></div>
        


</div>








</div>
</div>
</div>
</div>
</main>


<footer>
<div class="container">
</div>
</footer>

</body>
</html>