<!--#include file=conn.asp-->
<!--#include file=config.asp-->
<!--#include file=const.asp-->
<!--#include file=char.asp-->
<%
 '=========================================================
' File: uservip.asp
' Version:3.0
' Date: 2005-11-6
' Script Written by xmrxw
'=========================================================
' Copyright (C) 2004,2005 Xmrxw.Com All rights reserved.
' Web: http://www.xmrxw.com,http://www.xmzxw.com
' Email: info@mssky.com,super@mssky.com
' QQ：10689579　Msn：zdlmicr@hotmail.com
'=========================================================
response.buffer=true
stats="升级VIP"
call nav()
if not founduser then
	Errmsg=Errmsg+"<br>"+"<li>您还没有登陆，请登陆后进行修改。"
	founderr=true
end if

if founderr then
	call head_var("","")
	call Mslove_error()
else
	call head_var("升级VIP","uservip.asp")
Select Case Trim(Request("action"))
	Case "upvip"
		Stats="提交升级"
		Call upvip()
	Case "CenVip"
		Stats="撤消VIP"
		Call CenVip()
	Case "付款"
		Stats="付款通知"
		Call BuyVip()
	Case "删除"
		Stats="删除VIp记录"
		Call DelVip()
	Case "pay"
		Stats="支付方式"
		Call pay()
	Case "list"
		Stats="我的帐户"
		Call list()	
	case else
		call main()
End Select
if founderr then call Mslove_error()
end if
call activeonline()
call footer()

sub main()
dim Usertj,Vipset
sql="select Vipset from [Ms_User] where Username='"&membername&"'"
set rs=conn.execute(sql)
if not (rs.eof and rs.bof) then
Vipset=rs(0)
else
Vipset="0|0"
end if
rs.close
Usertj=Cint(split(Vipset,"|")(1))
if Usertj=0 then
Usertj=UserID
else
Usertj=Usertj
end if
dim regvip,Vclass,Vipm,Vid,Postclass,Checked
regvip=0
sql="select Vid,Vipclass,Vipmoney,Postclass,Checked from [Ms_UserVip] where Payok=0 and Username='"&trim(membername)&"'"
set rs=conn.execute(sql)
if rs.eof or rs.bof then
regvip=0
Postclass=0
Checked=0
else
Vid=rs(0)
regvip=1
Vclass=rs(1)
Vipm=rs(2)
Postclass=rs(3)
Checked=rs(4)
end if
rs.close
%>
<table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td align="left"><IMG src="images/upvip/pay_login_pic1.jpg" width=268 height="59"><IMG 
      src="images/upvip/pay_login_pic2.jpg" width=250 height="59"><IMG 
      src="images/upvip/pay_login_pic3.jpg" width=233 height="59"></td>
  </tr>
  <tr>
    <td align="left"><a href="?pay_v=1&Viptj=<%=Usertj%>"><IMG height=90 
      src="images/upvip/pay_login_pic4.gif" width=139 border=0></a><a href="?pay_v=2&Viptj=<%=Usertj%>"><IMG height=90 
      src="images/upvip/pay_login_pic5.gif" width=129 border=0></a><a href="?pay_v=3&Viptj=<%=Usertj%>"><IMG height=90 
      src="images/upvip/pay_login_pic6.gif" width=136 border=0></a><a href="?pay_v=4&Viptj=<%=Usertj%>"><IMG height=90 
      src="images/upvip/pay_login_pic7.gif" width=114 border=0></a><a href="?pay_v=5&Viptj=<%=Usertj%>"><IMG height=90 
      src="images/upvip/pay_login_pic8.gif" width=107 border=0></a><a href="?pay_v=6&Viptj=<%=Usertj%>"><IMG height=90 
      src="images/upvip/pay_login_pic9.gif" width=125 
  border=0></a></td>
  </tr>
</table>
<table width="749" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
  <%dim pay_v
  if request("pay_v")="" then
  pay_v=1
  else
  pay_v=request("pay_v")
  end if
  if regvip=1 then
  pay_v=Postclass
  end if%>
    <td width="394" rowspan="2" valign="top"><IMG height=137 
      src="images/upvip/pay_pic<%=pay_v%>.gif" width=404></td>
    <td width="355" height="47" valign="top"><IMG height=47 src="images/upvip/pay_login_pic16.gif" 
      width=346></td>
  </tr>
  <tr>
    <td height="90" background="images/upvip/pay_login_pic17.gif">
<TABLE width="80%" height="90" align=center cellPadding=0 cellSpacing=0>
        <TBODY>
          <TR> 
            <TD height="88"> 
              <DIV align=center><SPAN 
            class=style18>我们提供多种支付方式供您选择，您可以挑选一种自己认为最好的方式进行付费，同时升级成为VIP会员。相信必有一款适合您。</SPAN></DIV></TD>
          </TR>
        </TBODY>
      </TABLE>
    </td>
  </tr>
</table>
<TABLE cellSpacing=0 cellPadding=0 width=750 align=center>
  <TR>
    <TD width=30><IMG height=338 src="images/upvip/pay_login_pic18.gif" 
      width=30></TD>
    <TD vAlign=top width=697 background=images/upvip/pay_login_pic20.gif>
      <table cellspacing=1 cellpadding=5 width="95%" align=center 
      bgcolor=#cccccc border=0>
        <form action=?action=upvip method=post>
          <input type=hidden value=<%=Usertj%> name=viptj>
          <tbody>
            <tr bgcolor=#f3f3f3> 
              <td width="38%"><strong>费用</strong></td>
              <td width="62%"><strong>支付方式</strong></td>
            </tr>
            <tr valign=top bgcolor=#fffff> 
              <td bgcolor=#ffffff><input name="Vipc" type="radio" value="1" checked>
                1个月 <%=split(Vipvalue,"|")(0)%>元（<%=split(Vipcls,"|")(0)%>）</td>
              <td rowspan="4" bgcolor=#ffffff><%if pay_v=1 then
			  response.Write("盛大游戏卡")
			  elseif pay_v=2 then
			  response.Write("固话声讯台")
			  elseif pay_v=3 then
			  response.Write("短信交友套餐")
			  elseif pay_v=4 then
			  response.Write("小灵通支付")
			  elseif pay_v=5 then
			  response.Write("网退支付")
			  elseif pay_v=6 then
			  response.Write("国外用户")
			  end if%> <input type=radio checked value=<%=pay_v%> 
            name=zftype> <br> <%if regvip=1 then
				response.Write("<li><font color=red>你已经申请VIP会员，请及时付款！</font></li>")
				if Vclass=1 then
				response.Write("<li><font color=red>您申请的（铜级VIP）需要付款："&split(Vipvalue,"|")(0)&"元</font></li>")
				elseif Vclass=2 then
				response.Write("<li><font color=red>您申请的（白银VIP）需要付款："&split(Vipvalue,"|")(1)&"元</font></li>")
				elseif Vclass=3 then
				response.Write("<li><font color=red>您申请的（黄金VIP）需要付款："&split(Vipvalue,"|")(2)&"元</font></li>")
				elseif Vclass=4 then
				response.Write("<li><font color=red>您申请的（水晶VIP）需要付款："&split(Vipvalue,"|")(3)&"元</font></li>")
				end if
				if Checked=0 then
				response.Write("&nbsp;状态：<font color=red>未审</font>")
				else
				response.Write("&nbsp;状态：<font color=blue>已审</font>")
				end if
				response.Write("<li><font color=red>点击这里进行支付</font></li>")
				response.Write("<li><a href=?action=CenVip&id="&Vid&"><font color=red>点击这里进行撤消删除</font></a></li>")
				response.Write("<br>您的VIP推荐地址：http://"&request.servervariables("server_name")&replace(lcase(request.servervariables("script_name")),"uservip.asp","")&"reg.asp?Viptj="&Userid&"，参与我们的赚钱计划！")
				end if%> </td>
            </tr>
            <tr valign=top bgcolor=#fffff> 
              <td bgcolor=#ffffff><input type="radio" name="Vipc" value="2">
                3个月 <%=split(Vipvalue,"|")(1)%>元（<%=split(Vipcls,"|")(1)%>）</td>
            </tr>
            <tr valign=top bgcolor=#fffff> 
              <td bgcolor=#ffffff><input type="radio" name="Vipc" value="3">
                6个月 <%=split(Vipvalue,"|")(2)%>元（<%=split(Vipcls,"|")(2)%>）</td>
            </tr>
            <tr valign=top bgcolor=#fffff> 
              <td bgcolor=#ffffff><input type="radio" name="Vipc" value="4">
                12个月<%=split(Vipvalue,"|")(3)%>元（<%=split(Vipcls,"|")(3)%>）</td>
            </tr>
            <tr valign=top align=left bgcolor=#fffff> 
              <td colspan=2 bgcolor=#f3f3f3>开始时间： 
                <input name="startime" type="text" id="startime" value="<%=date()+3%>" size="20">
                今天之后3天内（需要留给我们处理时间）</td>
            </tr>
            <tr valign=top align=middle bgcolor=#fffff> 
              <td bgcolor=#f3f3f3 colspan=2><input type=submit value=开始支付 name=Submit></td>
            </tr>
            <tr valign=top align=left bgcolor=#FFFFFF> 
			<%dim VIPsets
			sql="select Vipset from [Ms_User] where Username='"&membername&"'"
set rs=conn.execute(sql)
if not (rs.eof and rs.bof) then
VIPsets=rs(0)
end if
rs.close
%>
              <td height="90" colspan=2>注意：<br>
                1、凡加入我们的VIP推荐，您只要叫对方用你的地址注册成为会员，对方申请为VIP您将获得交友中心VIP抽成，抽成为：<font color="#FF0000">VIP费用*<%=(Vipgive*100)%>%</font>。<br>
                2、您现在可用VIP推荐金币：<b><font color=red><%=split(VIPsets,"|")(0)%></font></b> 元，可以以该金币续费或者提起！<a href="Uservip.asp?action=list"><font color="#FF0000">查看帐户&gt;&gt;</font></a></td>
            </tr>
        </form>
      </table>
	  
	  
	  </TD>
    <TD width=21><IMG height=338 src="images/upvip/pay_login_pic19.gif" 
      width=21></TD>
  </TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=750 align=center>
  <TBODY>
  <TR>
      <TD><IMG height=18 src="images/upvip/pay_login_pic22.jpg" 
  width=750></TD>
    </TR></TBODY></TABLE>
<%
end sub

sub upvip()''升级vip
dim Vipc,viptj,zftype,usertj,startime,givemoney
Vipc=checkStr(Request("Vipc"))
viptj=checkStr(Request("viptj"))
zftype=checkStr(Request("zftype"))
startime=checkStr(Request("startime"))
if Vipc="" or not isnumeric(Vipc) then
	ErrMsg=ErrMsg+"<Br>"+"<li>参数错误。"
   	FoundErr=True
end if
if viptj<>"" and isnumeric(viptj) then
viptj=Clng(viptj)
sql="select Username from [Ms_User] where Userid="&viptj&""
set rs=conn.execute(sql)
if rs.eof or rs.bof then
usertj=""
else
usertj=rs(0)
end if
rs.close
end if
if startime="" or isdate(startime)=false then
	ErrMsg=ErrMsg+"<Br>"+"<li>请输入一个正确格式的开始时间。"
   	FoundErr=True
end if
if FoundErr=True then exit sub
set rs=server.createobject("adodb.recordset")
sql="select * from Ms_uservip where Username='"&trim(membername)&"'"
rs.Open sql,conn,1,3
if not (rs.eof and rs.bof) then
ErrMsg=ErrMsg+"<Br>"+"<li>对不起，您已经提交升级VIP申请，请等待管理员审核。"
   	FoundErr=True
	exit sub
	else
	rs.addnew
	rs("Username")=trim(membername)
	rs("Userid")=trim(Userid)
	rs("Postclass")=zftype
	if usertj<>"" then
	rs("Usertj")=usertj
	end if
	rs("Vipclass")=Vipc
	if Vipc=1 then
	rs("Vipmoney")=split(Vipvalue,"|")(0)
	rs("EndTime")=Dateadd("m",1,startime)
	givemoney=split(Vipvalue,"|")(0)
	elseif Vipc=2 then
	rs("Vipmoney")=split(Vipvalue,"|")(1)
	rs("EndTime")=Dateadd("m",3,startime)
	givemoney=split(Vipvalue,"|")(1)
	elseif Vipc=3 then
	rs("Vipmoney")=split(Vipvalue,"|")(2)
	rs("EndTime")=Dateadd("m",6,startime)
	givemoney=split(Vipvalue,"|")(2)
	elseif Vipc=4 then
	rs("Vipmoney")=split(Vipvalue,"|")(3)
	rs("EndTime")=Dateadd("m",12,startime)
	givemoney=split(Vipvalue,"|")(3)
	end if
	rs("StarTime")=startime
	rs("Checked")=0
	rs("Addtime")=Now()
	rs.update
	rs.close
	dim mtitle,messages
		mtitle="您成功申请的VIP会员"
		messages="您已经成功申请VIP会员，请等待管理员审核，查看：<a href=http://"&request.servervariables("server_name")&replace(lcase(request.servervariables("script_name")),"uservip.asp","")&"uservip.asp target=_blank>点击这里查看</a><br>"
		messages=messages & "VIP会员拥有更多的权限及服务，让我们来为你服务！"
		sql="insert into Ms_message (incept,sender,title,content,sendtime,flag,issend) values ('"&trim(membername)&"','系统管理员','"&mtitle&"','"&messages&"',Now(),0,1)"
		conn.execute(sql)
sucmsg=sucmsg+"<br>"+"<li><b>恭喜您，您已成功申请VIP资格，请等待管理员审核。</b>"
call Mslove_suc()
end if
end sub

sub CenVip()''撤消删除Vip
dim id
id=checkStr(Request("id"))
if id="" or not isnumeric(id) then
ErrMsg=ErrMsg+"<Br>"+"<li>参数错误。"
   	FoundErr=True
exit sub
end if
conn.execute("delete from Ms_userVip where Username='"&trim(membername)&"' and VID="&id&"")
conn.execute("update Ms_user set UserVip=0 where Username='"&trim(membername)&"'")
sucmsg=sucmsg+"<br>"+"<li><b>恭喜您，您已成功撤消并删除VIP申请。</b>"
call Mslove_suc()
end sub

sub BuyVip()''付费Vip
dim id
id=checkStr(Request("id"))
if id="" or not isnumeric(id) then
ErrMsg=ErrMsg+"<Br>"+"<li>参数错误。"
   	FoundErr=True
exit sub
end if
conn.execute("update Ms_userVip set Checked=2 where Username='"&trim(membername)&"' and Vid="&id&"")
conn.execute("update Ms_user set UserVip=1 where Username='"&trim(membername)&"'")
sucmsg=sucmsg+"<br>"+"<li><b>恭喜您，您已成功付费VIP。</b>"
call Mslove_suc()
end sub

sub list()''帐户情况
strFileName="uservip.asp?action="&request("list")&""
call tumppages()%>
<table width="100%" align=center cellpadding=3 cellspacing=1 class=tableborder1>
  <tr align="left"> 
    <th height="28" colspan="7" align="center"  class=tablebody1>我的帐户</th>
  </tr>
  <tr align="center"> 
    <td width="19%"  class=tablebody2>推荐用户</td>
    <td width="15%"  class=tablebody2>VIP等级</td>
    <td width="11%"  class=tablebody2>费用</td>
    <td width="12%"  class=tablebody2>抽成数</td>
    <td width="16%"  class=tablebody2>结束时间</td>
    <td width="10%"  class=tablebody2>状态</td>
    <td width="17%"  class=tablebody2>注册时间</td>
  </tr>
  <%dim MyViptj
  set rs=server.createobject("adodb.recordset")
  sql="select * from Ms_uservip where Username<>usertj and Usertj='"&trim(membername)&"'"
  rs.open sql,conn,1,1
	if not (rs.eof and rs.bof) then
	MyViptj=0
	call rspages()
   do while not rs.eof and page_count<Cint(MaxPerPage)%>
  <tr align="center"> 
    <td  class=tablebody1><%response.Write("<a href=dispuser.asp?Username="&ihtmlencode(rs("Username"))&" target=_blank>"&ihtmlencode(rs("Username"))&"</a>")%></td>
    <td  class=tablebody1><%if rs("Vipclass")=1 then
	response.Write("铜级VIP")
	elseif rs("Vipclass")=2 then
	response.Write("白银VIP")
	elseif rs("Vipclass")=3 then
	response.Write("黄金VIP")
	elseif rs("Vipclass")=4 then
	response.Write("水晶VIP")
	end if%></td>
    <td  class=tablebody1><%=rs("Vipmoney")%></td>
    <td  class=tablebody1><%=(rs("Vipmoney")*Vipgive)%></td>
    <%MyViptj=MyViptj+(rs("Vipmoney")*Vipgive)%>
    <td  class=tablebody1><%=rs("EndTime")%></td>
    <td  class=tablebody1><%if rs("Checked")=1 then
	response.Write("<font color=red>已审</font>")
	else
	response.Write("<font color=blue>未审</font>")
	end if%></td>
    <td  class=tablebody1><%=rs("Addtime")%></td>
  </tr>
  <%page_count=page_count+1
	rs.movenext
	loop
	else
	response.Write("<tr><td>无推荐VIP用户</td></tr>")
	end if
%>
  <tr> 
    <td align=right valign=middle colspan=7 class=tablebody2>总金额：<%=MyViptj%> 元</td>
  </tr>
  <%if totalrec>0 then%>
  <tr> 
    <td align=right valign=middle colspan=7 class=tablebody2> <%
		  	call showpage(strFileName)
		  %> </td>
  </tr>
  <%end if%>
</table>
<%end sub%>