| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1691 人关注过本帖
标题:如何实现VIP到期停止权限
只看楼主 加入收藏
故事人生
Rank: 2
等 级:论坛游民
帖 子:58
专家分:36
注 册:2010-3-30
收藏
得分:0 
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<table width=200 height="208" border=0 align=center cellpadding=0 cellspacing=0 background="eshop_img/loginbg.gif">
<tr>
<td height="136">
<%if request.cookies("Cnhww")("username")="" then%>
<table width="200" height="208"
border="0" align="center" cellpadding="0" cellspacing="0" background="eshop_img/loginbg.gif">
  <tbody>
    <%if request.cookies("Cnhww")("username")=""  then%>
  </tbody>
  <form action="checkuserlogin.asp" method="post" name="userlogin" id="userlogin">
    <tr>
      <td height="37" colspan="2" class="text"><div align="center"></div></td>
    </tr>
    <tr align="center">
      <td height="24" colspan="2">顾客您好,购买商品请先登录</td>
    </tr>
    <tr>
      <td width="35%" height="26" class="text"><div align="right">账 号:</div></td>
      <td width="65%"><div align="left">
          <input name="username" class="form2" type="text" id="username2" maxlength="18" size="12" />
      </div></td>
    </tr>
    <tr>
      <td height="26" class="text"><div align="right">密 码:</div></td>
      <td><div align="left">
          <input name="userpassword" class="form2" type="password" id="userpassword2" maxlength="18" size="12" />
          <input class="wenbenkuang" type="hidden" name="linkaddress2" value="<%=request.servervariables("http_referer")%>" />
          <br />
      </div></td>
    </tr>
    <tr>
      <td height="36" class="text"><div align="right">验证码:</div></td>
      <td><div align="left">
          <input class="form2" name="verifycode" type="text" value="<%If GetCode=9999 Then Response.Write "9999"%>" maxlength="4" size="6" />
          <img src="GetCode.asp" /></div></td>
    </tr>
    <tr>
      <td height="17" colspan="2"><div align="center">
<%
  set cnhw=server.CreateObject("adodb.recordset")
  cnhw.open "select * from [user] where username='"&request.cookies("Cnhww")("username")&"' ",conn,1,1
  Dim UsName,rs
  UsName=Request.Form("UserName")'假设从表单提交过来
  Set rs=conn.Execute("select * from [User] Where UserName='"&UsName&"'")
  '判断VIP会员是否到期DateDiff函数时间长比较
  'DateDiff函数的相关解释
  'http://www.
  'http://wenku.baidu.com/view/69e2c022bcd126fff7050b68.html
  'http://topic.
  'http://baike.baidu.com/view/327446.htm?fr=ala0_1_1
  IF DateDiff("YYYY",Date(Now),rs("szshi"))>rs("vipdate") Then
     '将VIP降级为普通会员
     conn.Execute("Update [User] set reglx='1' Where UserName='"&UsName&"'")
  End IF
  rs.Close
  Set rs=Nothing
  conn.Close
  Set conn=Nothing
%>
          <INPUT onfocus=this.blur() type=image height=16 width=52
      src="eshop_img/login.gif" border=0 name=imageField>
          <A
      href="register.asp"><IMG height=16 hspace=5
      src="eshop_img/reg.gif" width=52 border=0></A></div></td>
    </tr>
    <tr>
      <td colspan="2"><div align="center"><IMG height=9 hspace=5 src="eshop_img/dot03.gif"
      width=9><A
      onclick="javascript:window.open('getpwd.asp','shouchang','width=450,height=300');"
      href="#">密码丢失/找回密码</A></div></td>
    </tr>
  </form>
  <%else%>
  <tr>
    <td colspan="2"class="text" ><div align="center">
    </div></td>
  </tr>
  <%end if%>
</table><%else%>
      <table width="90%" align="center" border="0" cellspacing="0" cellpadding="2">
        <tr>
          <td width="15%" align="center"><img src="images/dot03.gif" /></td>
          <td width="35%"><a href="user.asp?action=myinfo">我的信息</a></td>
          <td width="15%" align="center"><img src="images/dot03.gif" /></td>
          <td width="35%"><a href="user.asp?action=shoucang">我的收藏</a></td>
        </tr>
        <tr>
          <td width="15%" align="center"><img src="images/dot03.gif" /></td>
          <td width="35%"><a href="user.asp?action=userziliao">个人资料</a></td>
          <td width="15%" align="center"><img src="images/dot03.gif" /></td>
          <td width="35%"><a href="user.asp?action=savepass">修改密码</a></td>
        </tr>
        <tr>
          <td align="center"><img src="images/dot03.gif" /></td>
          <td><a href="user.asp?action=jifen">积分转换</a></td>
          <td align="center"><img src="images/dot03.gif" /></td>
          <td><a href=# onClick="window.open('getpwd.asp ','basket','menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=0,resizable=0,width=410,height=175,top=50,left=100,')">找回密码</a></td>
        </tr>
        <tr>
          <td align="center"><img src="images/dot03.gif" /></td>
          <td><a href="user.asp?action=viphd">VIP 活动</a></td>
          <td align="center"><img src="images/dot03.gif" /></td>
          <td><a href="user.asp?action=sqvip")">VIP 申请</a></td>
        </tr>
        <tr>
          <td width="15%" align="center"><img src="images/dot03.gif" /></td>
          <td width="35%"><a href="user.asp?action=dindan">我的订单</a></td>
          <td width="15%" align="center"><img src="images/dot03.gif" /></td>
          <td width="35%"><a href=logout.asp>退出登录</a></td>
        </tr>
        <tr>
          <td width="15%" align="center"><img src="images/dot03.gif" /></td>
          <td><a href="user.asp?action=famess">发送短信</a></td>
          <td width="15%" align="center"><img src="images/dot03.gif" /></td>
          <td width="35%"><a href="user.asp?action=soumess">接收短信</a></td>
        </tr>
        <%if request.cookies("Cnhww")("reglx")=2 then%>
        <%else%>
        <%end if%>
      </table>
<%end if%></td>
</tr>
</table>
2010-05-02 21:03
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
request.cookies("Cnhww")("username")=""
你这段代码里是使用cookies存的?里面只存了用户名?
2010-05-02 21:12
故事人生
Rank: 2
等 级:论坛游民
帖 子:58
专家分:36
注 册:2010-3-30
收藏
得分:0 
以下是引用yms123在2010-5-2 21:12:29的发言:

request.cookies("Cnhww")("username")=""
你这段代码里是使用cookies存的?里面只存了用户名?
就是这样子的了.请版主赐教.
2010-05-02 21:14
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
user.asp页面还能使用VIP功能?
2010-05-02 21:25
故事人生
Rank: 2
等 级:论坛游民
帖 子:58
专家分:36
注 册:2010-3-30
收藏
得分:0 
以下是引用yms123在2010-5-2 21:25:30的发言:

user.asp页面还能使用VIP功能?
我的USER.ASP代码如下,
<!--#include file="conn.asp"-->
<!--#include file="config.asp"-->
<html><head><title><%=webname%>--我的专区</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  <LINK href="eshop_img/css.css" type=text/css rel=stylesheet></head>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!--#include file="head.asp" -->
<table width="980" height="20" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="10" class="menuer_linebg"></td>
  </tr>
</table>
<table width="980" height="200" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td width="21"></td>
    <td width="200" valign="top"><!--#include file="userinfo.asp"-->
        <table width="100%"  border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td height="15"></td>
          </tr>
        </table>
        <!--#include file="shopcart.asp"-->
        <table width="200" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td height="8"></td>
          </tr>
        </table>
        <table width="100%"  border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td height="15"></td>
          </tr>
        </table>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><!--#include file="include/selltop.asp" --></td>
          </tr>
      </table></td>
    <td width="15"></td>
    <td width="720" valign="top"><table width="720" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
            <%xAction=lcase(request("action"))
    select case xAction
    case ""
    %>
            <TR>
              <td height=28 bgcolor="#f1f1f1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href=index.asp><%=webname%></a> >> <%=request.cookies("Cnhww")("username")%> >> 我的信息</td>
            </tr>
            <%
    case "myinfo"
    %>
            <TR>
              <td height=28 bgcolor="#f1f1f1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href=index.asp><%=webname%></a> >> <%=request.cookies("Cnhww")("username")%> >> 我的信息</td>
            </tr>
            <%
    case "userziliao"
    %>
            <TR>
              <td height=28 bgcolor="#f1f1f1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href=index.asp><%=webname%></a> >> <%=request.cookies("Cnhww")("username")%> >> 个人资料</td>
            </tr>
            <%
    case "savepass"
    %>
            <TR>
              <td height=28 bgcolor="#f1f1f1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href=index.asp><%=webname%></a> >> <%=request.cookies("Cnhww")("username")%> >> 修改密码</td>
            </tr>
                        <%
    case "viphd"
    %>
              <TR>
                <td height=28 bgcolor="#f1f1f1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href=index.asp><%=webname%></a> >> <%=request.cookies("Cnhww")("username")%> >> VIP活动</td>
              </tr>
              
                        <%
    case "sqvip"
    %>
              <TR>
                <td height=28 bgcolor="#f1f1f1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href=index.asp><%=webname%></a> >> <%=request.cookies("Cnhww")("username")%> >> VIP申请</td>
              </tr>
              
              
              <%
    case "dindan"
    %>
            <TR>
              <td height=28 bgcolor="#f1f1f1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href=index.asp><%=webname%></a> >> <%=request.cookies("Cnhww")("username")%> >> 我的订单</td>
            </tr>
            <%
    case "shoucang"
    %>
            <TR>
              <td height=28 bgcolor="#f1f1f1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href=index.asp><%=webname%></a> >> <%=request.cookies("Cnhww")("username")%> >> 我的收藏</td>
            </tr>
            <%
    case "jifen"
    %>
            <TR>
              <td height=28 bgcolor="#f1f1f1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href=index.asp><%=webname%></a> >> <%=request.cookies("Cnhww")("username")%> >> 我的积分</td>
            </tr>
            <%
    case else
    %>
            <tr>
              <td height=28 bgcolor="#f1f1f1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href=index.asp><%=webname%></a> >> <%=request.cookies("Cnhww")("username")%> >> 专区首页</td>
            </tr>
            <%end select%>
          </table>
            <table width="100%" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td>&nbsp;</td>
              </tr>
            </table>
            <!--#include file="user_inc.asp"-->
            <%xAction=lcase(request("action"))
select case xAction
case ""
    call myinfo()
case "myinfo"
    call myinfo()
case "userziliao"
    call userziliao()
case "savepass"
    call savepass()
case "dindan"
    call dindan()
case "shoucang"
    call shoucang()
case "jifen"
    call jifen()
case "viphd"
    call viphd()
case "sqvip"
    call sqvip()
case "famess"
    call famess()
case "soumess"
    call soumess()
case else
%>
            <%end select%>
        </td>
      </tr>
    </table></td>
    <td width="24">&nbsp;</td>
  </tr>
</table>
<table width="980"  border="0"  align="center" cellspacing="0" cellpadding="0">
  <tr>
    <td><!--#include file="end.asp"--></td>
  </tr>
</table>
</body>
</html>



2010-05-02 21:36
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
没看到你的读取用户信息的代码。
2010-05-03 11:20
故事人生
Rank: 2
等 级:论坛游民
帖 子:58
专家分:36
注 册:2010-3-30
收藏
得分:0 
以下是引用yms123在2010-5-3 11:20:42的发言:

没看到你的读取用户信息的代码。
<!--#include file="conn.asp"-->
<!--#include file="md5.asp"-->
<%dim username,userpassword,comeurl,verifycode
username=replace(trim(request("username")),"'","")
userpassword=md5(replace(trim(request("userpassword")),"'",""))
verifycode=replace(trim(request("verifycode")),"'","")
if username="" or userpassword="" then
response.write "<script LANGUAGE='javascript'>alert('您的用户名或密码有误!');history.go(-1);</script>"
response.end
end if
if cstr(session("getcode"))<>cstr(trim(request("verifycode"))) then
response.Write "<script LANGUAGE='javascript'>alert('请输入正确的验证码!');history.go(-1);</script>"
response.end
end if
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from [user] where username='"&username&"' and userpassword='"&userpassword&"' " ,conn,1,3
if not(rs.bof and rs.eof) then
if userpassword=rs("userpassword") then
response.cookies("Cnhww")("username")=trim(request("username"))
response.cookies("Cnhww")("reglx")=rs("reglx")
response.cookies("Cnhww")("jifen")=rs("jifen")
response.cookies("Cnhww")("jiaoyijine")=rs("jiaoyijine")
rs("lastlogin")=now()
rs("logins")=rs("logins")+1
rs("userlastip")=Request.ServerVariables("REMOTE_ADDR")
rs.Update
rs.Close
set rs=nothing
username=trim(request("username"))
conn.execute("delete from orders where username='"&username&"' and zhuangtai=7")
conn.execute("delete from ordersaward where username='"&username&"' and zhuangtai=7")
if request("linkaddress")="" then
response.redirect request.servervariables("http_referer")
else
response.redirect request("linkaddress")
end if
else
response.write "<script LANGUAGE='javascript'>alert('对不起,您的用户名或密码有误!');history.go(-1);</script>"
end if
else
response.write "<script LANGUAGE='javascript'>alert('对不起!您的用户名或密码有误!');history.go(-1);</script>"
end if
sub loginok()
response.Write "欢迎您 <font color=red>"&request.cookies("Cnhww")("username")&"</font>"
response.redirect "index.asp"
end sub


%>
2010-05-03 14:10
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from [user] where username='"&UsName&"'" ,conn,1,3
if not(rs.bof and rs.eof) then
if userpassword=rs("userpassword") then
response.cookies("Cnhww")("username")=trim(request("username"))
response.cookies("Cnhww")("reglx")=rs("reglx")
response.cookies("Cnhww")("jifen")=rs("jifen")
response.cookies("Cnhww")("jiaoyijine")=rs("jiaoyijine")
rs("lastlogin")=now()
rs("logins")=rs("logins")+1
rs("userlastip")=Request.ServerVariables("REMOTE_ADDR")
rs.Update
rs.Close
set rs=nothing
降级后你要再执行一次这个代码
2010-05-03 19:59
故事人生
Rank: 2
等 级:论坛游民
帖 子:58
专家分:36
注 册:2010-3-30
收藏
得分:0 
以下是引用yms123在2010-5-3 19:59:35的发言:

set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from  where username='"&UsName&"'" ,conn,1,3
if not(rs.bof and rs.eof) then
if userpassword=rs("userpassword") then
response.cookies("Cnhww")("username")=trim(request("username"))
response.cookies("Cnhww")("reglx")=rs("reglx")
response.cookies("Cnhww")("jifen")=rs("jifen")
response.cookies("Cnhww")("jiaoyijine")=rs("jiaoyijine")
rs("lastlogin")=now()
rs("logins")=rs("logins")+1
rs("userlastip")=Request.ServerVariables("REMOTE_ADDR")
rs.Update
rs.Close
set rs=nothing
降级后你要再执行一次这个代码
我上面的哪个文件里包含了,这段代码了.还是不行也.我在多测试测试.非常感谢版主的热心解答.
谢谢!

这代码是在前面哪个文件加会合适些呢?还是在最后这个文件里在加入这段代码?

[ 本帖最后由 故事人生 于 2010-5-3 21:00 编辑 ]
2010-05-03 20:55
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
要加在下面,加在降级代码上面没有意义
2010-05-04 00:16
快速回复:如何实现VIP到期停止权限
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.021295 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved