<!--#include file="../include/hf_conn.asp"-->
<!--#include file="checkadmin.asp"-->
<script language=javascript src=../include/mouse_on_title.js></script>
<%call checkmanage("05")%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="manage.css" type="text/css">
</head>
<BODY background="../images/admin/back.gif">
<%
action=request("ok")
if action="" then 
    Set rs = conn.Execute("select * from hfvipsetup") 
	%>
	<table width="98%" border="1"  style="border-collapse: collapse; border-style: dotted; border-width: 0px"  bordercolor="#333333" cellspacing="0" cellpadding="2">
	<form action=user_jibie.asp method=post name=setup>
	<tr class=backs><td colspan=2 class=td height=18>会员级别与折扣设置 &nbsp;</td></tr>
	<tr><td width=20% align=right>会员级别一  &nbsp; </td><td> <input type=text value="<%=rs("usertype1")%>" name=usertype1  size="20" maxlength=10>  &nbsp;&nbsp; <img src=../images/admin/memo.gif alt="填写会员级别的名称，如“普通会员”<br>至少应该填写一个会员级别"> </td></TR>
	<tr><td width=20% align=right>折扣   &nbsp; </td><td> <input type=text value="<%=rs("kou1")%>" name=kou1 size="20" maxlength=4>  &nbsp;&nbsp; <img src=../images/admin/memo.gif alt="取值1-10，10表示无折扣，即售价的100%"> </td></TR>
	<tr><td width=20% align=right>会员级别二  &nbsp; </td><td> <input type=text value="<%=rs("usertype2")%>" name=usertype2 size="20" maxlength=10>   &nbsp;&nbsp; <img src=../images/admin/memo.gif alt="若无，可空出"> </td></TR>
	<tr><td width=20% align=right>折扣   &nbsp; </td><td> <input type=text value="<%=rs("kou2")%>" name=kou2 size="20" maxlength=4>  </td></tr>
	<tr><td width=20% align=right>会员级别三  &nbsp; </td><td> <input type=text value="<%=rs("usertype3")%>" name=usertype3 size="20" maxlength=10>  </td></tr>
	<tr><td width=20% align=right>折扣  &nbsp;  </td><td> <input type=text value="<%=rs("kou3")%>" name=kou3 size="20" maxlength=4>  </td></tr>
	<tr><td width=20% align=right>会员级别四  &nbsp; </td><td> <input type=text value="<%=rs("usertype4")%>" name=usertype4 size="20" maxlength=10>  </td></tr>
	<tr><td width=20% align=right>折扣   &nbsp; </td><td> <input type=text value="<%=rs("kou4")%>" name=kou4 size="20" maxlength=4>  </td></tr>
	<tr><td width=20% align=right>会员级别五  &nbsp; </td><td> <input type=text value="<%=rs("usertype5")%>" name=usertype5 size="20" maxlength=10>  </td></tr>
	<tr><td width=20% align=right>折扣   &nbsp; </td><td> <input type=text value="<%=rs("kou5")%>" name=kou5 size="20" maxlength=4>  </td></tr>
	<tr><td width=20% align=right>会员级别六  &nbsp; </td><td> <input type=text value="<%=rs("usertype6")%>" name=usertype6 size="20" maxlength=10>  </td></tr>
	<tr><td width=20% align=right>折扣   &nbsp; </td><td> <input type=text value="<%=rs("kou6")%>" name=kou6 size="20" maxlength=4>  </td></tr>

	<tr><td colspan=2><INPUT name="ok" TYPE="hidden" value="ok"><INPUT name=action TYPE="submit" value="保存设置"> &nbsp;</td></tr>
</form>
</table>
	<%
	rs.close
	set rs=nothing
	conn.close
	set conn=nothing
end if

if action="ok" then

	if request.form("usertype1")="" or request.form("kou1")="" then
	response.write "<script language='javascript'>"
	response.write "alert('出错了，第一个会员级别与折扣为必填项！');"
	response.write "location.href='javascript:history.go(-1)';"
	response.write "</script>"
	response.end
	end if

	on error resume next	'忽略中间错误

	'如果不是数字
	if not isNumeric(request.form("kou1")) then er=1
	'如果是数字，并且小于1或者大于10
	if isNumeric(request.form("kou1")) and (request.form("kou1")<1 or request.form("kou1")>10) then er=1

	if request.form("kou2")<>"" then	'第2个非空时
	'如果不是数字
	if not isNumeric(request.form("kou2")) then er=1
	'如果是数字，并且小于1或者大于10
	if isNumeric(request.form("kou2")) and (request.form("kou2")<1 or request.form("kou2")>10) then er=1
	end if

	if request.form("kou3")<>"" then	'第3个非空时
	'如果不是数字
	if not isNumeric(request.form("kou3")) then er=1
	'如果是数字，并且小于1或者大于10
	if isNumeric(request.form("kou3")) and (request.form("kou3")<1 or request.form("kou3")>10) then er=1
	end if

	if request.form("kou4")<>"" then	'第4个非空时
	'如果不是数字
	if not isNumeric(request.form("kou4")) then er=1
	'如果是数字，并且小于1或者大于10
	if isNumeric(request.form("kou4")) and (request.form("kou4")<1 or request.form("kou4")>10) then er=1
	end if

	if request.form("kou5")<>"" then	'第5个非空时
	'如果不是数字
	if not isNumeric(request.form("kou5")) then er=1
	'如果是数字，并且小于1或者大于10
	if isNumeric(request.form("kou5")) and (request.form("kou5")<1 or request.form("kou5")>10) then er=1
	end if

	if request.form("kou6")<>"" then	'第5个非空时
	'如果不是数字
	if not isNumeric(request.form("kou6")) then er=1
	'如果是数字，并且小于1或者大于10
	if isNumeric(request.form("kou6")) and (request.form("kou6")<1 or request.form("kou6")>10) then er=1
	end if

	if er=1 then		'上述情况有任一种出现时，提示出错
	response.write "<script language='javascript'>"
	response.write "alert('出错了，折扣必须为1-10之间的数值！');"
	response.write "location.href='javascript:history.go(-1)';"
	response.write "</script>"
	response.end
	end if

     Set rs=Server.CreateObject("ADODB.Recordset")
	 sql="select * from hfvipsetup"
	 rs.open sql,conn,1,3

 	 rs("usertype1")=trim(request.form("usertype1"))
 	 rs("usertype2")=trim(request.form("usertype2"))
 	 rs("usertype3")=trim(request.form("usertype3"))
 	 rs("usertype4")=trim(request.form("usertype4"))
 	 rs("usertype5")=trim(request.form("usertype5"))
 	 rs("usertype6")=trim(request.form("usertype6"))
	 
 	 rs("kou1")=request.form("kou1")
 	 if request.form("kou2")<>"" then rs("kou2")=request.form("kou2")
 	 if request.form("kou3")<>"" then rs("kou3")=request.form("kou3")
 	 if request.form("kou4")<>"" then rs("kou4")=request.form("kou4")
 	 if request.form("kou5")<>"" then rs("kou5")=request.form("kou5")
 	 if request.form("kou6")<>"" then rs("kou6")=request.form("kou6")

	rs.update
	url="user_jibie.asp"
	rs.close	
	set rs=nothing
	conn.close
	set conn=nothing

	response.write "<script language='javascript'>"
	response.write "alert('操作成功，您设置的信息已保存！');"
	response.write "location.href='"&url&"';"			
	response.write "</script>"
end if%>