<%qx="11"%>
<!--#include file="../login/0.asp"-->
<!--#include file="../../mycartconn/conn.asp"-->
<!--#include file="../../mycartconn/function.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../../mycartconn/admin.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
*{font-size:12px}body{margin:0px;TEXT-ALIGN:center;background-color:#FFFFFF;}body div{margin-right:auto;margin-left:auto;text-align:center}form,h2,ul,table,p{margin:0;padding:0}li{list-style:none}img{border:0px}a{color:#0000CC; text-decoration:underline}a:hover{text-decoration:underline;color:#CC0000}
.k {
	width: 503px;
}
.a4{font-size:14px;width:24%;color:#000000;font-weight:bold;}
.a4 a{font-size:14px;color:#0000cc; font-family:"宋体";font-weight:bold;text-decoration:underline}
.aq{font-size:20px;line-height:26px;font-family:黑体;font-weight:normal}
.dow{margin:10px 0}
.dow select{width:100px}
.dow b{font-size:14px}
.logo{
	width:256px;
	height:78px;
	background-image: url(../i/uc/logoh.gif);
	background-repeat: no-repeat;
	background-position: 3px center;
	float:left
}
.man{
	width:150px;
	height:78px;
	float:right;
	line-height:78px;
	text-align:right;
	background-image: url(../i/uc/name.gif);
	background-position: center;
	background-repeat: no-repeat;
}
.ta{background:#c7d6eb;}
.ta td{background:#f1f8ff; font-size:14px}
.llin{border-bottom:1px dashed #c7d6eb}

-->
</style>
<title>级别设置</title>
</head>
<base target="_self">
<body bgcolor="#F3F3F3">
<TABLE width="650" align="center" cellpadding="0" cellspacing="0">
<TR>
	<TD height=5></TD>
</TR>
</TABLE>
<%
'禁止网页缓存及涮新
Response.Buffer = True 
Response.ExpiresAbsolute = Now() - 1 
Response.Expires = -1440 
Response.CacheControl = "no-cache"

huiyuan=request("huiyuan")
If huiyuan="" Then
	response.write "<script>self.close();</script>"
	response.end
End If

'================================================
sub hy_close(canshu)
Response.Write "<script>alert('"&canshu&"');window.close();</script>" 
end sub

if request("action")="save" Then    '修改保存****************************
	yxq=request("yxq")
	If yxq="" Then yxq=30
	set rs=server.createobject("adodb.recordset")
	sql="select * from huiyuan where huiyuan='"&replace(huiyuan,"'","")&"'"
	rs.open sql,conn,3,3
	If Not(rs.bof And rs.eof) Then
		oldvip=rs("vip")
		rs("vip")=request("vip")
		rs.update

		If CInt(request("vip"))>CInt(oldvip) Then
			vipbz="升级为"&getvipinfo(request("vip"))
		ElseIf CInt(request("vip"))<CInt(oldvip) then
			vipbz="降为"&getvipinfo(request("vip"))
		Else
			vipbz=getvipinfo(request("vip"))&"续约"
		End if
		'加入VIP设置记录
		Set rs_vip=Server.CreateObject("ADODB.Recordset")
		sql_vip="select * from VIP"
		rs_vip.open sql_vip,conn,1,3 
		rs_vip.addnew
		rs_vip("vip")=request("vip")
		rs_vip("huiyuan")=rs("huiyuan")
		rs_vip("yxq")=yxq
		rs_vip("bz")=vipbz
		rs_vip("sj")=Now()
		rs_vip("DailiID")=rs("DailiID")
		rs_vip.update
		rs_vip.close
		Set rs_vip=Nothing
	Else
		hy_close "设置失败，你的信息不存在或已被管理员删除！"
		response.end
	End if
	rs.close
	set rs=Nothing

	Response.Write "<center><br><br><br>·<font color=red>恭喜您，设置成功！！</font><br><br>·窗口正在1秒钟内自动关闭中......</center>"
	Response.Write "<script>setTimeout('window.close()',1000);window.returnValue=1;</script>" 
	response.end
end if


set rs = conn.execute("select * from huiyuan where huiyuan='"&huiyuan&"'")
set rst = conn.execute("select top 1 * from vip where huiyuan='"&huiyuan&"' order by id desc")
If Not (rst.bof And rst.eof) Then
	dateEnd=rst("sj")+rst("yxq")
End If
rst.close
Set rst=nothing
%>
<table width="98%" border="0" cellpadding="0" cellspacing="1" class="ta">
	<form action="?action=save" method="post" name="form1" id="form1">
    <tr>
      <td height="30"><div style="width:90%;text-align:left;padding-left:20px;font-size:14px"><B>设置会员<%=huiyuan%>的级别</b>　　　有效期<input type="text" style="height:20px" name="yxq" value="30" size=5 onfocus="this.select();">天</div></td>
    </tr>
    <tr>
      <td align="center">
        <table width="90%" border="0" cellpadding="0" cellspacing="0" class="dow">
          <tr>
            <td height="30" colspan="2" align="left" class="llin"><input type="radio" name="vip" id="vip0" value="0" <%If CInt(rs("vip"))=0 then response.write "checked='checked'"%>  />
              <img src=http://www.hongdou999.com/images/grade/11.gif border=0 align=absmiddle>&nbsp;<label for="vip0" id="leavetext0" style="font-size:14px">普通会员</label></td>
			<td class="llin">&nbsp;</td>
          </tr>
          <tr>
            <td height="30" colspan="2" align="left" class="llin"><input name="vip" id="vip1" type="radio" value="1" <%If CInt(rs("vip"))=1 then response.write "checked='checked'"%> />
              <img src=http://www.hongdou999.com/images/grade/12.gif border=0 align=absmiddle>&nbsp;<label for="vip1" id="leavetext1" style="font-size:14px">银牌VIP会员</label></td>
			<td class="llin"><%If CInt(rs("vip"))=1 And dateEnd<>"" Then response.write FormatDateTime(dateEnd,1)&"到期"%>&nbsp;</td>
          </tr>
          <tr>
            <td height="30" colspan="2" align="left" class="llin"><input type="radio" name="vip" id="vip2" value="2" <%If CInt(rs("vip"))=2 then response.write "checked='checked'"%> />
              <img src=http://www.hongdou999.com/images/grade/13.gif border=0 align=absmiddle>&nbsp;<label for="vip2" id="leavetext2" style="font-size:14px">金牌VIP会员</label></td>
			<td class="llin"><%If CInt(rs("vip"))=2 And dateEnd<>"" Then response.write FormatDateTime(dateEnd,1)&"到期"%>&nbsp;</td>
          </tr>
          <tr>
            <td height="30" colspan="2" align="left" class="llin"><input type="radio" name="vip" id="vip3" value="3" <%If CInt(rs("vip"))=3 then response.write "checked='checked'"%> />
              <img src=http://www.hongdou999.com/images/grade/14.gif border=0 align=absmiddle>&nbsp;<label for="vip3" id="leavetext3" style="font-size:14px">蓝钻VIP会员</label></td>
			<td class="llin"><%If CInt(rs("vip"))=3 And dateEnd<>"" Then response.write FormatDateTime(dateEnd,1)&"到期"%>&nbsp;</td>
          </tr>
          <tr>
            <td height="30" colspan="2" align="left" class="llin"><input type="radio" name="vip" id="vip4" value="4" <%If CInt(rs("vip"))=4 then response.write "checked='checked'"%> />
              <img src=http://www.hongdou999.com/images/grade/15.gif border=0 align=absmiddle>&nbsp;<label for="vip4" id="leavetext4" style="font-size:14px">皇冠贵族</label></td>
			<td class="llin"><%If CInt(rs("vip"))=4 And dateEnd<>"" Then response.write FormatDateTime(dateEnd,1)&"到期"%>&nbsp;</td>
          </tr>
        </table>
        <div style="margin-bottom:10px">
          <input type="hidden" name="huiyuan" value="<%=huiyuan%>" />
          <input type="submit" name="Save" value="保存设置" style="width:100px;height:22px;font-size:14px"/>
        </div>
      </td>
    </tr>
	</form>
  </table>
</body>
</html>
<%
conn.close
Set conn=nothing%>