<!--#include file="conn.asp"-->
<%
if request.cookies("bjx")("shjianame")="" then
response.Redirect "shjia.asp"
response.End
end if
bookid=request("bookid")
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from shop_books where bookid="&bookid,conn,1,3
bookname=rs("bookname")
rs.Close
set rs=nothing
%>
<html><head><title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../images/css.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {color: #FF0000}
-->
</style>
</head>
<body>
<table class="tableBorder" width="90%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
<tr bgcolor="#E8F1FF"> 
<td align="center" background="../images/admin_bg_1.gif" height="25"><b><font color="#ffffff">添加卡</font></b> </td>
</tr>
<tr bgcolor="#E8F1FF"> 
<form name="myform" method="post" action="saveaddcard.asp?action=add" OnSubmit="return checkkk()">
<td> 
<table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#ffffff">
<tr bgcolor="#E8F1FF">
<td width="23%"><div align="right">产品名称：</div></td>
<td height="30" colspan="3"><%=bookname%>
  <input name="bookid" type="hidden" id="bookid" value="<%=bookid%>"></td>
</tr>
<tr bgcolor="#E8F1FF">
  <td width="25%"><div align="right">卡号：</div></td>
  <td width="25%"><div align="left">
    <input name="cardhao" type="text" id="cardhao">
  </div></td>
  <td width="10%"><div align="right">密码：</div></td>
  <td><div align="left">
    <input name="cardmima" type="text" id="cardmima">
  </div></td>
</tr>
<tr bgcolor="#E8F1FF">
<td></td>
<td height="30" colspan="3">
<input type="submit" name="Submit" value=" 添加保存 ">
<input onclick="ClearReset()" type=reset name="Clear" value=" 重新填写 ">
</td>
</tr>
</table>
</td>
</form>
</tr>
</table>
<br>
<table class="tableBorder" width="90%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
  <tr bgcolor="#E8F1FF">
    <td align="center" background="../images/admin_bg_1.gif" height="25"><b><font color="#ffffff">已经添加的卡</font></b> </td>
  </tr>
  <tr bgcolor="#E8F1FF">
    
      <td>
        <table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#ffffff">
<%
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from card where bookid="&bookid&"and used=0",conn,1,1
if rs.eof And rs.bof then
%>
		  <tr bgcolor="#E8F1FF">
            <td height="30" colspan="5"><div align="center">数据库中无数据！</div></td>
          </tr>
<%else
%>
          <tr bgcolor="#E8F1FF">
            <td width="22%"><div align="right">产品名称：</div></td>
            <td height="30" colspan="4"><%=bookname%>                </td>
          </tr>
		  <%
do while not rs.eof
 %>
		  <form name="myform" method="post" action="saveaddcard.asp?action=edit" OnSubmit="return checkkk()">
          <tr bgcolor="#E8F1FF">
            <td width="22%"><div align="right">卡号：</div></td>
            <td width="24%"><div align="left">
                <input name="cardhao" type="text" id="cardhao" value="<%=rs("cardhao")%>">
            </div></td>
            <td width="7%"><div align="right">密码：</div></td>
            <td width="31%"><div align="left">
                <input name="cardmima" type="text" id="cardmima" value="<%=rs("cardmima")%>">
                <input name="bookid" type="hidden" id="bookid22" value="<%=bookid%>">
                <input name="cardid" type="hidden" id="bookid23" value="<%=rs("cardid")%>">
            </div></td>
            <td width="16%"><input type="submit" name="Submit2" value="修改"> 
              <a href="saveaddcard.asp?action=del&cardid=<%=rs("cardid")%>&bookid=<%=bookid%>">删除</a></td>
          </tr>
	      </form>
          <%
		rs.movenext
		loop
		end if
		rs.close
		set rs=nothing
		%>
          <tr bgcolor="#E8F1FF">
            <td></td>
            <td height="30" colspan="4">&nbsp;
            </td>
          </tr>
      </table></td>

  </tr>
</table>
<br>
<table class="tableBorder" width="90%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
  <tr bgcolor="#E8F1FF">
    <td align="center" background="../images/admin_bg_1.gif" height="25"><b><font color="#ffffff">已经出售的卡</font></b> </td>
  </tr>
  <tr bgcolor="#E8F1FF">
    <td>
      <table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#ffffff">
        <%
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from card where bookid="&bookid&"and used=1",conn,1,1
if rs.eof And rs.bof then
%>
        <tr bgcolor="#E8F1FF">
          <td height="30" colspan="5"><div align="center">数据库中无数据！</div></td>
        </tr>
        <%else
%>
        <tr bgcolor="#E8F1FF">
          <td width="22%"><div align="right">产品名称：</div></td>
          <td height="30" colspan="4"><%=bookname%> </td>
        </tr>
        <%
do while not rs.eof
 %>
          <tr bgcolor="#E8F1FF">
            <td width="22%"><div align="right">卡号：</div></td>
            <td width="24%"><div align="left">
                <%=rs("cardhao")%>
            </div></td>
            <td width="7%"><div align="right">密码：</div></td>
            <td width="31%"><div align="left">
                <%=rs("cardmima")%>
                
            </div></td>
            <td width="16%">
                <a href="saveaddcard.asp?action=del&cardid=<%=rs("cardid")%>&bookid=<%=bookid%>">删除</a></td>
          </tr>
        <%
		rs.movenext
		loop
		end if
		rs.close
		set rs=nothing
		%>
        <tr bgcolor="#E8F1FF">
          <td></td>
          <td height="30" colspan="4">&nbsp; </td>
        </tr>
    </table></td>
  </tr>
</table>
</body>
</html>

<SCRIPT LANGUAGE="JavaScript">
<!--
function checkkk()
{
     if(checkspace(document.myform.cardhao.value)) {
	document.myform.cardhao.focus();
    alert("请输入卡号！");
	return false;
  }
     if(checkspace(document.myform.cardmima.value)) {
	document.myform.cardmima.focus();
    alert("请输入卡密码！");
	return false;
  }
 
}
function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}
//-->
</script>
<script>
	function regInput(obj, reg, inputStr)
	{
		var docSel	= document.selection.createRange()
		if (docSel.parentElement().tagName != "INPUT")	return false
		oSel = docSel.duplicate()
		oSel.text = ""
		var srcRange	= obj.createTextRange()
		oSel.setEndPoint("StartToStart", srcRange)
		var str = oSel.text + inputStr + srcRange.text.substr(oSel.text.length)
		return reg.test(str)
	}
</script>