www.gusucode.com > 星云DJ舞曲 4.5a源码程序 > admin/rndupvip.asp

    <!--#include file="const.asp"-->
<!--#include file="checkadmin.inc"-->
<html>
<head>
<title>迪吧后台管理系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="Admin_Style.css" rel="stylesheet" type="text/css">
</head>
<body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border" id="AutoNumber2">
  <tr class="topbg"> 
    <td height="22" colspan="2" align="center"><strong>赠 送 VIP 会 员</strong></td>
  </tr>
</table>
  <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border" id="AutoNumber3">
    <tr class="tdbg"> 
      <td width="100%"><%
set rs=server.createobject("adodb.recordset")
userid=request("userid")
if userid="" then
'第一步,获取数据库中总会员数
sql="Select count(id) from user"
rs.Open sql,conn,1,1
rCount=rs(0)
response.write "数据库中总共有"&rCount&"条记录<br><br><br>"
response.write "本次操作将随机产生一个幸运用户,并将他升级为VIP会员,使用期限为一个月,此操作只在普通会员中进行随机抽取!<br><br>此操作可能会很慢,请耐心等待,速度取决到您的服务器配置和网站注册用户数量,用户越多速度越慢。"
rs.close
'第二步获取一个不是VIP会员的随机用户
sql="Select * from user where isvip<>true and lockuser<>true"
rs.Open sql,conn,1,1
cnt = 1 
dim RRs 
redim RRs(rCount) 
do while not rs.eof
RRs(cnt) = rs("id") 
cnt = cnt + 1 
rs.movenext 
loop 
randomize 
currentRR = cLng(rnd*rCount+0.5) 
ID = RRs(currentRR)
rs.close
if id="" then
response.write "<script language=JavaScript>function reupVip(){if (confirm('本次操作失败,原因可能是:\n\n1.数据库中已没有可供抽取的普通会员。\n\n2.程序操作失败,点“确定”重新抽取。\n\n\n如果重复10次后仍无法产生随机用户ID\n请点取消,然后查看是否有可供抽取的普通会员。'))window.location = 'rndupvip.asp'}reupVip();</script>"
response.end
end if
response.write "<br><br><br><br>本次随机产生的ID为:"&id&""
response.write"<a href=rndupvip.asp>、点这里重新抽取</a>"
sql="Select id,username,sex,address,oicq,addDate,LoginIP,lastlogin,logins,points,Listens,lockuser,vipstartdate,vipenddate,isvip from user where id="&id
rs.Open sql,conn,1,3
sex=rs("sex")
if sex=1 then
bsex="男"
elseif sex=0 then
bsex="女"
elseif sex=2 then
bsex="保密"
end if
address=rs(3)
oicq=rs(4)
adddate=rs(5)
loginip=rs(6)
lastlogin=rs(7)
logins=rs(8)
points=rs(9)
listens=rs(10)
response.write "<script language=JavaScript>function DoUpVip(params){if (confirm('用户ID号:"&id&"\n\n用 户 名:"&rs(1)&"\n性    别:"&bsex&"\n所在省份:"&address&"\nOICQ号码:"&oicq&"\n注册日期:"&adddate&"\n最后登录:"&lastlogin&"\n登陆次数:"&logins&"\n试听次数:"&listens&"\n现有积分:"&points&"\n\n确定将此用户升级为VIP会员吗?'))window.location = 'rndupvip.asp?userid='+params}DoUpVip('"&id&"');</script>"&_
rs.close
elseif userid<>"" then
sql="Select id,username,vipstartdate,vipenddate,isvip from user where id="&userid
rs.Open sql,conn,1,3
idate=DateSerial(Year(date), month(date), day(date)+30)
itime=TimeValue(NOW())
enddate=idate+itime
username=rs("username")
rs("vipstartdate")=NOW()
rs("vipenddate")=enddate
rs("isvip")=true
rs.update
rs.close
response.write"***操作成功***<br>"
response.write"===本次操作的祥细信息如下====<br>"
response.write"用户ID:"&userid&"<br>"
response.write"用户名:<font color=ff0000>"&username&"</font><br>"
response.write"开通时间:"&NOW()&"<br>"
response.write"结束时间:"&enddate&"<br><br><br>"
response.write"<a href=rndupvip.asp title=再送一名幸运用户><font color=0000ff>点我,再送一名幸运用户!</font></a>"
'把中奖信息存入数据库
sql="Select * from myrnd"
rs.Open sql,conn,1,3
mydate=cStr(NOW())
Btext="恭喜普通会员“"+username+"”幸运中奖,获赠一个月的VIP会员权限,自"+mydate+"起开始投入使用!"
rs("Atext")=Btext
rs.update
rs.close
'给中奖会员发送恭贺信
sql="select * from message"
			rs.open sql,conn,1,3
			rs.addnew
			rs("incept")=username
			rs("sender")="短信精灵"
			rs("title")="恭喜恭喜,幸运中奖!"
			rs("content")=Btext+"到期后如果想继续使用,请通过汇款或积分续费,续费方法请看<a href=### onclick=window.open('viphelp.htm') title=VIP会员续费说明>“关于VIP会员续费”</a>!"
			rs("sendtime")=now()
			rs("flag")=0
			rs.update
			rs.close
end if
set rs = nothing 
conn.close
set conn = nothing 
%></td>
  </tr>
    <tr class="tdbg"> 
      <td height="22" colspan="2" align="center" class="title">
        </td>
    </tr>
  </table>
</body> 
</html>