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

<%
'已停用
response.End()


act=SafeRequestform("act")


if act="add" then
xuliehao=SafeRequestform("xuliehao")
con1=SafeRequestform("con1")
con2=SafeRequestform("con2")
con3=SafeRequestform("con3")
id1=SafeRequestform("id1")
id2=SafeRequestform("id2")
id3=SafeRequestform("id3")

if xuliehao="" or con1="" or con2="" or con3="" or id1="" or id2="" or id3="" then call PopErr("请填写完整")  

sql="select * from aymibao where aymibaoka='"&trim(xuliehao)&"'" 
rs.open sql,conn,1,3
if rs.bof and rs.eof then
rs.close
call PopErr("未找到该序列号信息")  
else
	if cint(rs("aymibaoyiyong"))=1 then call PopErr("该密保卡已经使用过了")  
	if md5(trim(con1))<>trim(rs(id1)) then call PopErr("密保卡填写有误")  
	if md5(trim(con2))<>trim(rs(id2)) then call PopErr("密保卡填写有误") 
	if md5(trim(con3))<>trim(rs(id3)) then call PopErr("密保卡填写有误") 
	rs("aymibaoyiyong")=1
	rs.update
	rs.close
		sql="select aynameid,aymibaoka from ayname where aynameid="&clng(request.Cookies("aynameid"))&"" 
		rs.open sql,conn,1,3
		rs("aymibaoka")=xuliehao
		rs.update
		rs.close
		Set fso=CreateObject("Scripting.FileSystemObject") 

		if fso.FileExists(server.mappath("\updata\mibao\"&trim(xuliehao)&".jpg")) then 
		fso.DeleteFile(server.mappath("\updata\mibao\"&trim(xuliehao)&".jpg"))
		end if
		call logadd(request.Cookies("aynameid"),"密保卡绑定成功"&xuliehao,0,0)
		call PopErr2("密保卡绑定成功","anquan")  
end if




end if



%>


<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 action="" method="post" name="form" id="form"> 
                        <table class="neitableanquan">
           		  		<tr>
                            <td align="center" width="110">密保卡序列号：</td>
                            <td width="300"><input name="xuliehao" class="reginput" type="text" id="xuliehao" size="30" maxlength="20"></td>
                          <td><div class="regtd" > 请输入密保卡序列号</div></td>
                        </tr>
						<%
                        sql="select aynameid,aymibaoka from ayname where aynameid="&clng(request.Cookies("aynameid"))&"" 
                        rs.open sql,conn,1,1
                        if trim(rs("aymibaoka"))<>"0" then call PopErr2("该用户已经绑定了密保卡","anquan") 
                        rs.close
                        
                        Function RndNumber(Min,Max) 
                        Randomize 
                        RndNumber=Int((Max - Min + 1) * Rnd() + Min) 
                        End Function 
                        
                        Const stringmodarr1 = "ABCDEFG"
                        dim randarr1,strlength1
                        strlength1 = Len(stringmodarr1)
                        Randomize
                        For i = 1 To 1 
                        randarr1 = randarr1&Mid(stringmodarr1,Int(Rnd * strlength1 + 1),1) 
                        randarr2 = randarr2&Mid(stringmodarr1,Int(Rnd * strlength1 + 1),1) 
                        randarr3 = randarr3&Mid(stringmodarr1,Int(Rnd * strlength1 + 1),1) 
                        Next 
                         
                        id1=randarr1&RndNumber(1,7)
                        id2=randarr2&RndNumber(1,7)
                        id3=randarr3&RndNumber(1,7)
                        %>
                 		<tr>
                            <td align="center">密保卡数字：</td>
                            <td>
                   			  <span style="font-weight: bold"><%=id1%></span>&nbsp;
                              <input name="con1" type="text" class="reginputmb" id="con1" size="5" maxlength="2">
                              &nbsp;
                              <span style="font-weight: bold"><%=id2%></span>&nbsp;<input name="con2" type="text" class="reginputmb" id="con2" size="5" maxlength="2">
                              &nbsp;&nbsp;
                              <span style="font-weight: bold"><%=id3%></span>&nbsp;<input name="con3" type="text" class="reginputmb" id="con3" size="5" maxlength="2">
                            </td>
                            <td><div class="regtd" > 请输入密保卡相对应的数字</div></td>
                        </tr>
                 		<tr>
                            <td>
                            <input name="act" type="hidden" id="act" value="add">
                            <input name="id1" type="hidden" value="<%=id1%>">
                            <input name="id2" type="hidden" value="<%=id2%>">
                            <input name="id3" type="hidden" value="<%=id3%>">
                            </td>
                            <td height="60"><input style="cursor:pointer"  class="logindlreg" type="submit" name="Submit" value=" 绑 定 密 保 卡 "></td>
                        </tr>
                    </table>
                    </form>
            <!-------------------------------------- 结束 -------------------------------------->






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


</div>








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


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

</body>
</html>