<!--#include virtual="/show/adminhead.asp"-->
<!--#include file="adminleft.asp"-->


<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

<title><%=webname%>-添加兑换码</title>
<%
call logquanxian("i1",1)
%>



<DIV>

<script language=javascript>
function CheckIfEnglish( String )<!--检验表单必须是字母或数字-->
{ 
    var Letters = "abcdefghijklmnopqrstuvwxyz0123456789-";
     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;
}
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;
}
function Checkjinid( 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 language=javascript>
function check_add()
{
   if(form.shuliang.value=="" || !CheckIfid(form.shuliang.value)){alert("数量填写错误");return false}
   if(form.jiazhi.value=="" || !Checkjinid(form.jiazhi.value)){alert("价格填写错误");return false}
   if(form.jiazhi.value < 1){alert("价格填写错误 应大于0");return false;}
}
</script>
<%
Function RndNumber(Min,Max) 
Randomize 
RndNumber=Int((Max - Min + 1) * Rnd() + Min) 
End Function 



act=request.QueryString("act")

if act="add" then


aydhlei=request.form("aydhlei")
jaizhi=request.form("jaizhi")
shuliang=request.form("shuliang")

if jaizhi="" or shuliang="" then call PopErr("请填写完整")

Const stringmodarr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
strlength = Len(stringmodarr)

sql="select * from ayduihuan" 
rs.open sql,conn,1,3

for sum=1 to cint(shuliang)
	
	randarr1=""
	randarr2=""
	randarr3=""
	randarr4=""
	Randomize timer
	For i = 1 To 4 
	randarr1 = randarr1&Mid(stringmodarr,Int(Rnd * strlength + 1),1)  
	Next 
	For i = 1 To 4 
	randarr2 = randarr2&Mid(stringmodarr,Int(Rnd * strlength + 1),1)  
	Next
	For i = 1 To 4 
	randarr3 = randarr3&Mid(stringmodarr,Int(Rnd * strlength + 1),1)  
	Next
	For i = 1 To 4 
	randarr4 = randarr4&Mid(stringmodarr,Int(Rnd * strlength + 1),1)  
	Next


	rs.addnew
	rs("aydhhao")=randarr1&"-"&randarr2&"-"&randarr3&"-"&randarr4
	rs("aydhlei")=aydhlei
	
	if cint(aydhlei)=1 then 
	rs("aydhmj")=jaizhi
	elseif cint(aydhlei)=3 then 
	rs("aydhsms")=jaizhi
	end if

	rs.update
	
next


	rs.close
	call logadd(request.Cookies("aynameid"),"管理-兑换码添加成功",0,0)
	call PopErr2("兑换码添加成功","adminduihuanlist.asp")
	
end if

%>
<DIV id=main1200> 
<%call webleft()%>
<DIV id=main_right>
<DIV id=main_right_content>
<STYLE>.apply_style {
	POSITION: absolute
}
.right_title A {
	LINE-HEIGHT: 27px; WIDTH: 126px; DISPLAY: inline-block; BACKGROUND: url(<%=ossurl%>images/bg22.gif) no-repeat; HEIGHT: 27px
}
.right_title A.current {
	BACKGROUND: url(<%=ossurl%>images/main_right_title_bg.gif) no-repeat; COLOR: #fff; FONT-WEIGHT: bold
}
.table_style_1 TD {
	HEIGHT: 38px
}
.table_style_home_info TD {
	PADDING-BOTTOM: 0px; PADDING-LEFT: 10px; PADDING-RIGHT: 0px; HEIGHT: 30px; PADDING-TOP: 0px
}
</STYLE>

<DIV class=right_titleadmin>&nbsp;&nbsp;添加兑换码</DIV>
<DIV class=main>

<form action="?act=add" method="post" name="form" id="form" onSubmit="return check_add()">
  <table width="99%" border="0" cellspacing="5" cellpadding="0" class="table_style_a1">
    <tr>
      <td width="140" align="center">兑换码类别：</td>
      <td>
          <select name="aydhlei" id="aydhlei">
            <option value="1">加急免佣金流量</option>
			<!--<option value="2">VIP尊贵会员</option>-->
			<option value="3">短信流量</option>
			<!--<option value="4">内嵌代码</option>-->
          </select>
        </td>
    </tr>
    <tr>
      <td align="center">兑换码价值：</td>
      <td><input name="jaizhi" type="text" id="jaizhi" value="100" size="9" maxlength="4">
       （类别为加急免佣金流量 该项为抵免佣金金额 类别为短信流量 该项为短信流量条数 其他类别该项无效）</td>
    </tr>
    <tr>
      <td align="center">添加数量：</td>
      <td><input name="shuliang" type="text" id="shuliang" value="5" size="9" maxlength="3">
        个</td>
    </tr>
    <tr>
      <td colspan="2" align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" name="Submit" value=" 生 成 兑 换 码 ">
       </td>
    </tr>
  </table>
</form>
</DIV>
 

</DIV></DIV>
<DIV class=clear></DIV></DIV>
</DIV>


<!--#include virtual="/show/footadmin.asp"-->

