<!-- #include file="include/onlogin.asp" -->
<!-- #include file="include/csk3000_pagecute.asp" -->
<!-- #include file="include/conn.asp" -->

<%dim zj,web_up,MaxPerPage,yzcv,sqladd,sql3,rs3,dayer,usercper,power,paymoney,no,carlasttime,dlr,carno,carpws,carer,caruuser
tit="<center><a href='admin_car.asp?action=3'>查看未充值卡</a><a href='admin_car.asp?action=4'>查看已充值卡</a> <a href='admin_car.asp?action=1'>发行固定充值卡</a><a href='admin_car.asp?action=2'>发行自定义充值卡</a><a href='user_emoney.asp?action=card'>进行在线充值</a>"
response.write header(14,tit)
  titt="查看会员卡代理"
response.write admin_bar(titt,1,"99%")
if request("action")="delcar" then
conn.execute"delete from car where c_id="&request("id")
conn.close
set conn=nothing
response.redirect Request.ServerVariables("HTTP_REFERER")
end if  
if request("action")="delc_hidden" then
conn.execute"delete from car where c_hidden=1"
conn.close
set conn=nothing
response.redirect Request.ServerVariables("HTTP_REFERER")
end if
if request("action")="delcarlasttime" then
conn.execute"delete from car where carlasttime+tim<=now()"
conn.close
set conn=nothing
response.redirect Request.ServerVariables("HTTP_REFERER")
end if
   MaxPerPage=20
   dim totalPut  
   dim CurrentPage
   dim TotalPages

   dim typename
   
   typename=""
   if not isempty(request("page")) then
      currentPage=cint(request("page"))
   else
      currentPage=1
   end if
   dim rstype

   dim typesql
   dim typeid,typename1
   if not isEmpty(request("typeid")) then
	typeid=request("typeid")
   else
	typeid=0
   end if%><table border="0" width="100%" cellspacing="0" cellpadding="0"><tr><td width="100%"></td></tr></table><%if request("action2")="user" then
carer=request("user2")
c_hidd=request("car")
sql="select * from car where dlr='"&carer&"' and c_hidden="&c_hidd
elseif request("action1")="user" then
carer=request("user2")
c_hidd=request("car")
sql="select * from car where dlr='"&carer&"' and c_hidden="&c_hidd
else
carer=request("user2")
sql="select * from car where dlr='"&carer&"'"
end if
 Set rs= Server.CreateObject("ADODB.Recordset")
 rs.open sql,conn,1,1
   if rs.eof and rs.bof then
       response.write "<p align='center'> 还 没 有 任 何 充 值 卡</p>"
   else
	  totalPut=rs.recordcount
      totalPut=rs.recordcount
      if currentpage<1 then
          currentpage=1
      end if
      if (currentpage-1)*MaxPerPage>totalput then
	   if (totalPut mod MaxPerPage)=0 then
	     currentpage= totalPut \ MaxPerPage
	   else
	      currentpage= totalPut \ MaxPerPage + 1
	   end if
      end if
       if currentPage=1 then
           showpage totalput,MaxPerPage,"carer.asp"
            showContent
            showpage totalput,MaxPerPage,"carer.asp"
       else
          if (currentPage-1)*MaxPerPage<totalPut then
            rs.move  (currentPage-1)*MaxPerPage
            dim bookmark
            bookmark=rs.bookmark
           showpage totalput,MaxPerPage,"carer.asp"
            showContent
             showpage totalput,MaxPerPage,"carer.asp"
        else
	        currentPage=1
           showpage totalput,MaxPerPage,"carer.asp"
           showContent
           showpage totalput,MaxPerPage,"carer.asp"
	      end if
	   end if
   end if
   sub showContent
dim i
i=0%><div align="center"><center>
  <table border="1" cellspacing="1" width="700" bordercolorlight="#CCCCCC" bordercolordark="#FFFFFF"><form method="POST" action="carer.asp?action1=user">查找代理<input onmouseover=this.style.borderColor='#486841';this.style.backgroundColor='#E2F1A6' onmouseout=this.style.borderColor='#006D91';this.style.backgroundColor='#EFEFEF' type="text" name="user2" size="11"><select onmouseover=this.style.borderColor='#486841';this.style.backgroundColor='#E2F1A6' onmouseout=this.style.borderColor='#006D91';this.style.backgroundColor='#EFEFEF' size="1" name="car"><option value="1">已使用</option><option value="0">未使用</option></select><input onmouseover=this.style.borderColor='#486841';this.style.backgroundColor='#E2F1A6' onmouseout=this.style.borderColor='#006D91';this.style.backgroundColor='#EFEFEF' type="submit" value="提交" name="B1"><input onmouseover=this.style.borderColor='#486841';this.style.backgroundColor='#E2F1A6' onmouseout=this.style.borderColor='#006D91';this.style.backgroundColor='#EFEFEF' type="reset" value="重置" name="B2"></form>   <tr bgcolor="#CCCCCC"><p align="center"><a href="carer.asp?action1=user&user2=<%=rs("dlr")%>&car=0">查看<b><%=rs("dlr")%></b>未充值卡</a><a href="carer.asp?action2=user&user2=<%=rs("dlr")%>&car=1">查看<b><%=rs("dlr")%></b>的已充值卡</a>   <a href="carer.asp?action=user&user2=<%=rs("dlr")%>">查看<b><%=rs("dlr")%></b>所有充值卡</a><td width="77" align="center" nowrap><b>卡号</b></td>
    <td width="78" align="center" nowrap><b>密码</b></td>
    <td width="49" align="center" nowrap><b>魅力值</b></td>
    <td width="50" align="center" nowrap><b>面&nbsp;&nbsp;值</b></td>
    <td width="73" align="center" nowrap>卡类型</td>
    <td width="68" align="center" nowrap><b>会员</b></td>
    <td width="147" align="center" nowrap><b>过期时间</b></td>
    <td width="54" align="center" nowrap>使用</td>
    <td width="103" align="center" nowrap>代理商/使用者</td>
    <td width="66" align="center" nowrap><b>使用时间</td></tr></tr><%do while not rs.eof%><tr onmouseover="javascript:this.bgColor='#EDEDED';" onmouseout="javascript:this.bgColor='#FFFFFF';">
      <td width="77" nowrap><p align="center"><b><%=rs("carid")%></b></td>
      <td width="78" align="center" nowrap><b><%=rs("carpws")%></b>　</td>
      <td width="49" align="center" nowrap><font color="#008000"><%=rs("usercp")%></font> 點</td>
      <td width="50" align="center" nowrap><%=rs("paymoney")%><%response.write m_unit%>　</td>
      <td width="73" align="center" nowrap><span style="font-size: 9pt"><%if rs("day")="30" then%></span><font color="#0000FF">包月卡</font><%elseif rs("day")="90" then%><font color="#008000">包季卡</font><%elseif rs("day")="365" then%><font color="#000080">包年卡</font><%else%><font color="#FF0000">特别會員卡</font><%end if%></td>
      <td width="68" align="center" nowrap></font><%if rs("power")="admin" then%>管理员<%elseif rs("power")="vip" then%>vip会员<%elseif rs("power")="gold" then%>黄金会员<%else%>普通會員<%end if%></td>
      <td width="147" align="center" nowrap><%if now()>=rs("tim") + rs("carlasttime") then%><%  response.write "<a onclick=""return confirm('是否为该卡增加半年有效使用时间!');"" href='?action=2&id="&rs("id")&"'><font color=#808080>过期卡</font></A>"%><%elseif rs("tim") + 3650<=rs("tim") + rs("carlasttime") then%>无限制<%else%><%=rs("carlasttime") + rs("tim")%><%end if%></td>
      <td width="54" align="center" nowrap><%if rs("c_hidden")=0 then
  response.write "<a href='admin_car.asp?action="&rs("c_hidden")&"&id="&rs("c_id")&"'>未使用</a>"
else
  response.write "<a onclick=""return confirm('把该卡设为未使用并删除使用者  "&rs("caruuser")&"  的在  "&rs("usertime")&"  充值时的使用信息，为了使用者知道密码建议删除!');"" href='?action1="&rs("c_hidden")&"&id="&rs("c_id")&"'><font class=red>已使用</font></a>"
end if
%>　</td><td width="103" align="center" nowrap><%if rs("dlr")=""&objv7.web_var(web_config,3)&"" then%>本站留用<%else%><%=rs("dlr")%><%end if%>/<%if rs("caruuser")<>"" then%><a href='user_view.asp?username=<%=server.urlencode(caruuser)%>' target=_blank><%=rs("caruuser")%></a><%else%>未使用<%end if%></td>
      <td width="66" align="center" nowrap><a href="?action=delcar&id=<%=rs("c_id")%>"><font color="#000000">删除</font></a></td></tr><% i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop%></table></center></div><%end sub 
function showpage(totalnumber,maxperpage,filename)
  dim n
  if totalnumber mod maxperpage=0 then
     n= totalnumber \ maxperpage
  else
     n= totalnumber \ maxperpage+1
  end if
  response.write "<p align=""center""><form method=Post action="&filename&"?action=user&user2="&carer&"&typeid="&typeid&">"
    if CurrentPage<2 then
    response.write "<font color='#000080'>首页 上一页</font>&nbsp;"
  else
    response.write "<a href="&filename&"?action=user&user2="&carer&"&page=1&typeid="&typeid&">首页</a>&nbsp;"
    response.write "<a href="&filename&"?action=user&user2="&carer&"&page="&CurrentPage-1&"&typeid="&typeid&">上一页</a>&nbsp;"
  end if
  if n-currentpage<1 then
    response.write "<font color='#000080'>下一页 尾页</font>"
  else
    response.write "<a href="&filename&"?action=user&user2="&carer&"&page="&(CurrentPage+1)&"&typeid="&typeid&">"
    response.write "下一页</a> <a href="&filename&"?action=user&user2="&carer&"&page="&n&"&typeid="&typeid&">尾页</a>"
  end if
   response.write "<font color='#000080'>&nbsp;页次：</font><strong><font color=red>"&CurrentPage&"</font><font color='#000080'>/"&n&"</strong>页</font> "
    response.write "<font color='#000080'>&nbsp;共有<b>"&totalnumber&"</b>张卡 <b>"&maxperpage&"</b>张卡/页</font> "
   response.write " <font color='#000080'>转到：</font><input onmouseover=this.style.borderColor='#486841';this.style.backgroundColor='#E2F1A6' onmouseout=this.style.borderColor='#006D91';this.style.backgroundColor='#EFEFEF' type='text' name='page' size=4 maxlength=10 class=smallInput value="&currentpage&">"
   response.write " <input onmouseover=this.style.borderColor='#486841';this.style.backgroundColor='#E2F1A6' onmouseout=this.style.borderColor='#006D91';this.style.backgroundColor='#EFEFEF' class=buttonface type='submit'  value='Goto'  name='cndok'></span></p></form></p>"     
end function
   rs.close
   set rs=nothing  
   conn.close
   set conn=nothing
   response.write admin_bar(titt,2,"99%")
response.write ender()%>