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

<%
'all iszizhu()

if SafeRequestform("act")="duihuan" then
set rsu=server.CreateObject("adodb.recordset")

aydhhao=trim(SafeRequestform("aydhhao"))
if aydhhao="" then call PopErr("请填写有效兑换码")


	sql="select * from ayduihuan where aydhhao='"&aydhhao&"' and aydhisok=0" 
	rs.open sql,conn,1,3
	if not(rs.bof and rs.eof) then
	rs("aydhisok")=1
	rs("aydhkdate")=now()
	rs("aydhuid")=clng(request.Cookies("aynameid"))
	rs.update
	
	
		if cint(rs("aydhlei"))=1 then  '加急免佣金流量
		sqlu="select * from ayname where aynameid="&clng(request.Cookies("aynameid"))&"" 
		rsu.open sqlu,conn,1,3
		rsu("jjmoney")=ccur(rsu("jjmoney"))+ccur(rs("aydhmj"))
		rsu.update
		call logadd(request.Cookies("aynameid"),"兑换码兑换成功"&aydhhao&"",7,0)
		call PopErr2("兑换成功","myname")
		response.End()
		end if

		
		if cint(rs("aydhlei"))=2 then '尊贵VIP
		'call logadd(request.Cookies("aynameid"),"兑换码兑换成功"&aydhhao&"",7,0)
		end if
		
		if cint(rs("aydhlei"))=4 then '内嵌代码
		'call logadd(request.Cookies("aynameid"),"兑换码兑换成功"&aydhhao&"",7,0)
		end if
		
		
	else
	call logadd(request.Cookies("aynameid"),"兑换码无效"&aydhhao&"",7,1)
	call PopErr("兑换码无效")
	end if
	rs.close

end if
%>





<script type="text/javascript">
function check_form()
{
   if(document.form1.aydhhao.value == "") 
   {alert("请填写有效兑换码");return false;}
}


function check(str)
{

	if (str==""){alert("请填写有效兑换码");return false;}

	var xmlhttp;try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}catch (e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}catch (e){try{xmlhttp=new XMLHttpRequest();}catch (e){}}}
	xmlhttp.open("get","/show/cha/?id="+str+ "&act=chadh&t=" +  new Date().getTime());
	xmlhttp.onreadystatechange=function()
	{
		if(200==xmlhttp.status)
		{
			
			darrStr=xmlhttp.responseText.split("|");
			if (parseInt(darrStr[0])==1){tishi.innerHTML = "<span style='color:#F00'>兑换码无效！请填写有效兑换码！</span>";}
			
			if (parseInt(darrStr[0])==0&&parseInt(darrStr[1])==1){	tishi.innerHTML = "<span style='color:#3C0'>兑换码有效！加急免佣金流量"+ darrStr[2] +"元</span>";}
			if (parseInt(darrStr[0])==0&&parseInt(darrStr[1])==2){	tishi.innerHTML = "<span style='color:#3C0'>兑换码有效！VIP尊贵会员1年！</span>";}
			if (parseInt(darrStr[0])==0&&parseInt(darrStr[1])==3){	tishi.innerHTML = "<span style='color:#3C0'>兑换码有效！短信流量"+ darrStr[2] +"条！</span>";}
			if (parseInt(darrStr[0])==0&&parseInt(darrStr[1])==4){	tishi.innerHTML = "<span style='color:#3C0'>兑换码有效！内嵌代码1年！</span>";}
			
		}
	}
	xmlhttp.send(null); 
}

</SCRIPT>


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


            <!-------------------------------------- 开始 -------------------------------------->
            <div class="neibiaoti"></div>
            <div class="neibiaoti2">兑换-兑换码</div>
                	<div class="gexian"></div>

                    	<form name="form1" method="post" action="" onSubmit="return check_form()">
                        <table class="neitableanquan" width="100%">

           		  		<tr>
                            <td align="center" width="100">兑换码：</td>
                            <td><input name="aydhhao" type="text" id="aydhhao" class="reginputpass" onBlur="return check(this.value);" maxlength="20">&nbsp;&nbsp;<span id="tishi"></span></td>
                       	  </tr>


           		  		<tr>
                            <td height="70" colspan="3" align="left"><input type="submit" name="Submit" class="logindlreg" value=" 确 定 兑 换 " id="tixiansub">
                            <input name="act" type="hidden" id="act" value="duihuan"></td>
                          </tr>

                    </table>
</form>
                   
            <!-------------------------------------- 结束 -------------------------------------->
                   


                                                                 
                   
            <div class="gexian20"></div>
            <div class="mzsmbox2" style="padding-top:20px;">
                填写有效兑换码进行操作！<br>
                有效兑换码可以兑换加急免佣金流量,短信流量,尊贵VIP会员,内嵌代码。<br>
                兑换码获得途径:<a href="<%=weburl%>buy/duihuanma.html" target="_blank"><%=weburl%>buy/duihuanma.html</a></div>

            </div>
            
           




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



</div>








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


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

</body>
</html>