<%@ LANGUAGE = VBScript.Encode %>
<!--#include file="conn.asp"-->
<%if session("admin")="" then
response.Write "<script language='javascript'>alert('网络超时或您还没有登陆！');window.location.href='login.asp';</script>"
response.End
else
if session("flag")>1 then
response.Write "<p align=center><font color=red>您没有此项目管理权限！</font></p>"
response.End
end if
end if
dim danweiid,danweiorder,danweiname,danweino,i
if request("action")="update" then
    for i=1 to request.form("id").count
	id=replace(request.form("id")(i),"'","")
	vipdate=replace(request.form("vipdate")(i),"'","")
	username=replace(request.form("username")(i),"'","")
	fanhui=replace(request.form("fanhui")(i),"'","")
	xiaofei=replace(request.form("xiaofei")(i),"'","")
	
	If vipdate="" Then
		response.write "时间不能为空！请<a href=javascript:history.go(-1)>返回重新填写</a>！"
		response.end
	end if
	If username="" Then
		response.write "用户名不能为空！请<a href=javascript:history.go(-1)>返回重新填写</a>！"
		response.end
	end if
	If xiaofei="" Then
		response.write "消费金额不能为空！请<a href=javascript:history.go(-1)>返回重新填写</a>！"
		response.end
	end if
	If fanhui="" Then
		response.write "返回金额不能为空！请<a href=javascript:history.go(-1)>返回重新填写</a>！"
		response.end
	end if
	conn.execute("update xyvip set vipdate='"&vipdate&"',username='"&username&"',xiaofei="&xiaofei&",fanhui="&fanhui&" where id="&id)

    next
conn.close
set conn=nothing
response.write "<script language=javascript>alert('修改VIP用户成功！');window.location.href='xyvip.asp';</script>"
end if

if request("action")="add" then
	vipdate=request("vipdate")
	username=request("username")
	xiaofei=request("xiaofei")
	fanhui=request("fanhui")
	If vipdate="" Then
		response.write "时间不能为空！请<a href=javascript:history.go(-1)>返回重新填写</a>！"
		response.end
	end if
	If username="" Then
		response.write "用户名不能为空！请<a href=javascript:history.go(-1)>返回重新填写</a>！"
		response.end
	end if
	If xiaofei="" Then
		response.write "消费金额不能为空！请<a href=javascript:history.go(-1)>返回重新填写</a>！"
		response.end
	end if
	If fanhui="" Then
		response.write "返回金额不能为空！请<a href=javascript:history.go(-1)>返回重新填写</a>！"
		response.end
	end if
Set rs = Server.CreateObject("ADODB.Recordset")
rs.open "select * from xyvip",conn,1,3
rs.addnew
rs("vipdate")=vipdate
rs("username")=username
rs("xiaofei")=xiaofei
rs("fanhui")=fanhui
rs.update
rs.close
set rs=nothing

conn.close
set conn=nothing
response.write "<script language=javascript>alert('幸运VIP用户添加成功！');window.location.href='xyvip.asp';</script>"
end if

if request("action")="del" then
id=request("id")
	conn.execute("delete from xyvip where id=" &id)
	conn.close
	set conn=nothing
	response.write "<script language=javascript>alert('成功删除幸运VIP用户！');window.location.href='xyvip.asp';</script>"
	response.end
end if
%>