<!--#include file="Inc.asp"-->
<!--#include file="ydzq.asp"-->

<%call head()
Call saycardd("添加VIP会员")

dim userid,ids,TP
ids=request("ids")
userid=request("userid")
TP=request("TP")
ac=request("ac")
times=request("times")
if TP<>"" then
TP=clng(TP)
if TP=1 then

if ids="" or IsNumeric(ids)=False then
  Call Error("选择等级无效！")
  end if
end if

if userid="" or IsNumeric(userid)=False then
  Call Error("会员ID无效！")
  end if
if times="" or IsDate(times)=False then
  Call Error("日期无效！")
  end if
  
'检查ID是否存在
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "SELECT name,vipface FROM users where id="&userid,conn,1,1
if rs.eof then
  rs.close
  set rs=Nothing
  Call Error("会员ID不存在！")
end if
vipface=rs("vipface")
  rs.close
  set rs=Nothing
  
if vipface<>0 and ac<>"ok" then
 Response.Write "该会员已是VIP会员.还要进行操作吗？<br/>"
if saytk>1 then
Response.write "<form name=""form"" method=""post"" action=""vipadd.asp?sid="&sid&"&amp;saytk="&saytk&""">"
response.write "<input type=""hidden"" name=""ids"" value="""&ids&"""/>"
response.write "<input type=""hidden"" name=""userid"" value="""&userid&"""/>"
response.write "<input type=""hidden"" name=""times"" value="""&times&"""/>"
response.write "<input type=""hidden"" name=""ac"" value=""ok""/>"
response.write "<input type=""hidden"" name=""tp"" value=""1""/>"
response.write "<input type=""submit"" name=""Submit"" value=""是的,更新TA的VIP""></form><br/>"
else
 Response.write "<anchor>是的,更新TA的VIP<go href='vipadd.asp?sid="&sid&"&amp;saytk="&saytk&"' method='post' accept-charset='utf-8'>"
Response.write "<postfield name='ids' value='"&ids&"'/>"
Response.write "<postfield name='userid' value='"&userid&"'/>"
Response.write "<postfield name='times' value='"&times&"'/>"
Response.write "<postfield name='ac' value='ok'/>"
Response.write "<postfield name='TP' value='1'/>"
Response.write "</go></anchor><br/>"
 Response.Write "<anchor>取消,我要返回<prev/></anchor>"
end if
response.write"<br/><a href='http://8ggg.net/bbs/cjj.asp?cjj="&Request.ServerVariables("SERVER_NAME")&"&amp;ztt="&ppo&"'>进入WAP龙门网查看最新升级功能免费升级</a><br/>"
call headsay()
Response.end
end if

 conn.Execute"update users set vipface=1,vipdj="&clng(ids)&",vipdate='"&times&"' Where ID="&userid

response.write "操作成功！<br/>"
ELSE
if saytk>1 then
Response.write "<form name=""form"" method=""post"" action=""vipadd.asp?sid="&sid&"&amp;saytk="&saytk&""">"
end if
response.write "用户ID：<input name='userid' format='*N' value=''/><br/>"
response.write "VIP等级<br/>"
response.write "<select name='ids'><option>选择等级</option>"
Response.write "<option value='1'>VIP一级</option>"
Response.write "<option value='2'>VIP二级</option>"
Response.write "<option value='3'>VIP三级</option>"
Response.write "<option value='4'>VIP四级</option>"
Response.write "<option value='5'>VIP五级</option>"
Response.write "</select><br/>"
response.write "VIP享受日期截止：(格式:2012-1-1)<br/>"
response.write "<input name='times' type='text' value='2012-1-1'/><br/>"
if saytk>1 then
response.write "<input type=""hidden"" name=""tp"" value=""1""/>"
response.write "<input type=""submit"" name=""Submit"" value=""设为VIP会员""></form><br/>"
else
Response.write "<anchor>设为VIP会员<go href='vipadd.asp?sid="&sid&"&amp;saytk="&saytk&"' method='post' accept-charset='utf-8'>"
Response.write "<postfield name='ids' value='$(ids)'/>"
Response.write "<postfield name='userid' value='$(userid)'/>"
Response.write "<postfield name='times' value='$(times)'/>"
Response.write "<postfield name='TP' value='1'/>"
Response.write "</go></anchor><br/>"end if
END IF
Response.write "------------<br/>"
conn.close
set conn=Nothing
response.write"<a href=""vippst.asp?sid="&sid&"&amp;saytk="&saytk&""">[VIP会员管理]</a>"
%>
<!--#include file="fanhui.asp"-->
<%
call headsay()%>
