按照会员级别来判断执行的语句如何写
原有的asp语言中一个刷礼物的代码:想增加按照会员级别判断小于等于某级别不可以使用并提示!里面已有如果几分不够则提示的语句:如何增加小于某会员级别提示无法使用的语句,请求...
原有的asp语言中一个刷礼物的代码:想增加按照会员级别判断小于等于某级别不可以使用并提示!里面已有如果几分不够则提示的语句:如何增加小于某会员级别提示无法使用的语句,请求帮助。满意再逐加400分。
<%
If session("user")&""="" And session("password")&""="" Then response.End
username=Left(HTMEncode(Trim(request("username"))&""),21)
ID=Left(Trim(request("ID"))&"",10)
If ID="" Or Not IsNumeric(ID) Then AlertMsg "参数错误!","",false:response.End
If username="" Or username="所有人" Or username=session("username") Then AlertMsg "参数错误!","",false:response.End
Set rs=server.CreateObject("adodb.recordset")
rs.open "select * from d007dnet_liwu where id="&ID&"",conn,1,1
If rs.eof Then AlertMsg "礼物不存在!","",false:response.End
LiWuScore=Rs("Score")
LiWuaa=Rs("aa")
LiWuTitle=Rs("Title")
LiWuPic=Rs("SmallPic")
LiWuBigPic=Rs("BigPic")
LiWuCredit=Rs("LiWuCredit")
rs.close
If Trim(BigPic)="" Then BigPic=LiWuPic
If conn.execute("select username from ["&UserTable&"] where username='"&username&"'").eof Then AlertMsg username&" 不存在或没有注册!","",false:response.End
Set rs=server.CreateObject("adodb.recordset")
rs.open "select * from ["&UserTable&"] where Username='"&session("user")&"' and userpassword='"&session("password")&"'",conn,1,3
If rs.eof Then rs.close:AlertMsg "您没有登陆或注册!","",false:response.End
Set rs=server.CreateObject("adodb.recordset")
rs.open "select * from ["&UserTable&"] where Username='"&session("user")&"' and userpassword='"&session("password")&"'",conn,1,3
If rs.eof Then rs.close:AlertMsg "您没有登陆或注册!","",false:response.End
'rem 刷金币
'UserScore=Rs("Score")
'If IsNull(UserScore) Or Trim(UserScore)&""="" Then UserScore=0
'If LiWuScore>UserScore Then AlertMsg "您的金币不足,请充值!","",false:response.End
'Rs("Score")=Rs("Score")-LiWuScore
'刷积分
UserCredit=Rs("UserCredit")
If IsNull(UserCredit) Or Trim(UserCredit)&""="" Then UserCredit=0
If LiWuScore>UserCredit Then AlertMsg "您的积分不足!","",false:response.End
Rs("UserCredit")=Rs("UserCredit")-LiWuScore
rs.update
rs.close
conn.execute("update ["&UserTable&"] set UserCredit=UserCredit+"&LiWuCredit&" where username='"&username&"'")
Set rs=server.CreateObject("adodb.recordset")
rs.open "select * from d007dnet_Logs",conn,1,3
Rs.addnew
Rs("username")=session("user")
Rs("username2")=username
Rs("LiWuPic")=LiWuPic
Rs("LiWuTitle")=LiWuTitle
Rs("Score")=LiWuScore
Rs("Score2")=LiWuScore
Rs("Credit")=LiWuCredit
Rs("AddTime")=Now()
rs.update
rs.close
str="//fuba_"&id
%>
<script>
parent.alertmsg("<%=str%>");
</script>
其中 UserScore 为另一个数据表的积分列名
MemberLevel 为新增加的会员级别列名
如果图 ←2 小于 ←1 则不能刷礼物并提示。
或者如何指定某级别以上才可以使用! 展开
<%
If session("user")&""="" And session("password")&""="" Then response.End
username=Left(HTMEncode(Trim(request("username"))&""),21)
ID=Left(Trim(request("ID"))&"",10)
If ID="" Or Not IsNumeric(ID) Then AlertMsg "参数错误!","",false:response.End
If username="" Or username="所有人" Or username=session("username") Then AlertMsg "参数错误!","",false:response.End
Set rs=server.CreateObject("adodb.recordset")
rs.open "select * from d007dnet_liwu where id="&ID&"",conn,1,1
If rs.eof Then AlertMsg "礼物不存在!","",false:response.End
LiWuScore=Rs("Score")
LiWuaa=Rs("aa")
LiWuTitle=Rs("Title")
LiWuPic=Rs("SmallPic")
LiWuBigPic=Rs("BigPic")
LiWuCredit=Rs("LiWuCredit")
rs.close
If Trim(BigPic)="" Then BigPic=LiWuPic
If conn.execute("select username from ["&UserTable&"] where username='"&username&"'").eof Then AlertMsg username&" 不存在或没有注册!","",false:response.End
Set rs=server.CreateObject("adodb.recordset")
rs.open "select * from ["&UserTable&"] where Username='"&session("user")&"' and userpassword='"&session("password")&"'",conn,1,3
If rs.eof Then rs.close:AlertMsg "您没有登陆或注册!","",false:response.End
Set rs=server.CreateObject("adodb.recordset")
rs.open "select * from ["&UserTable&"] where Username='"&session("user")&"' and userpassword='"&session("password")&"'",conn,1,3
If rs.eof Then rs.close:AlertMsg "您没有登陆或注册!","",false:response.End
'rem 刷金币
'UserScore=Rs("Score")
'If IsNull(UserScore) Or Trim(UserScore)&""="" Then UserScore=0
'If LiWuScore>UserScore Then AlertMsg "您的金币不足,请充值!","",false:response.End
'Rs("Score")=Rs("Score")-LiWuScore
'刷积分
UserCredit=Rs("UserCredit")
If IsNull(UserCredit) Or Trim(UserCredit)&""="" Then UserCredit=0
If LiWuScore>UserCredit Then AlertMsg "您的积分不足!","",false:response.End
Rs("UserCredit")=Rs("UserCredit")-LiWuScore
rs.update
rs.close
conn.execute("update ["&UserTable&"] set UserCredit=UserCredit+"&LiWuCredit&" where username='"&username&"'")
Set rs=server.CreateObject("adodb.recordset")
rs.open "select * from d007dnet_Logs",conn,1,3
Rs.addnew
Rs("username")=session("user")
Rs("username2")=username
Rs("LiWuPic")=LiWuPic
Rs("LiWuTitle")=LiWuTitle
Rs("Score")=LiWuScore
Rs("Score2")=LiWuScore
Rs("Credit")=LiWuCredit
Rs("AddTime")=Now()
rs.update
rs.close
str="//fuba_"&id
%>
<script>
parent.alertmsg("<%=str%>");
</script>
其中 UserScore 为另一个数据表的积分列名
MemberLevel 为新增加的会员级别列名
如果图 ←2 小于 ←1 则不能刷礼物并提示。
或者如何指定某级别以上才可以使用! 展开
2个回答
展开全部
'刷积分
UserCredit=Rs("UserCredit")
If IsNull(UserCredit) Or Trim(UserCredit)&""="" Then UserCredit=0
If LiWuScore>UserCredit Then AlertMsg "您的积分不足!","",false:response.End
Rs("UserCredit")=Rs("UserCredit")-LiWuScore
rs.update
rs.close
你在这后面加上几句,判断级别就行了,只要这个字段在这个数据表里
'判断级别
UserMemberLevel=Rs("MemberLevel")
If IsNull(UserMemberLevel) Or Trim(UserMemberLevel)&""="" Then UserMemberLevel=0
If UserMemberLevel<2 Then AlertMsg "您的级别不足!","",false:response.End
rs.close
UserCredit=Rs("UserCredit")
If IsNull(UserCredit) Or Trim(UserCredit)&""="" Then UserCredit=0
If LiWuScore>UserCredit Then AlertMsg "您的积分不足!","",false:response.End
Rs("UserCredit")=Rs("UserCredit")-LiWuScore
rs.update
rs.close
你在这后面加上几句,判断级别就行了,只要这个字段在这个数据表里
'判断级别
UserMemberLevel=Rs("MemberLevel")
If IsNull(UserMemberLevel) Or Trim(UserMemberLevel)&""="" Then UserMemberLevel=0
If UserMemberLevel<2 Then AlertMsg "您的级别不足!","",false:response.End
rs.close
追问
我就是这样加的 无反应
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询