建设项目管理业务流程:求助asp高手!

来源:百度文库 编辑:神马品牌网 时间:2024/04/29 08:16:08
症状:不能自动升级为vip会员

亲爱的会员:nayi ,欢迎您升级为VIP会员,享受更多的购物优惠。

您现有购物积分:(此处不能自动显示) 点 ,升级为VIP会员需要购物积分 100 点,有效期为 30 天。

问题似乎在 jifen

源码:

<!--#include file="top.asp"-->
<title>升级VIP会员 - <%=sitename%></title>
<%webtop()%>
<table width="<%=webwidth%>" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="<%=lwidth%>" align="center" valign="top">
<!--#include file="include/56770_userlogins.asp"-->
</td>
<%width_td()%>
<%
if session("user_id")="" then
response.write "<script language='javascript'>"
response.write "alert('请您先登陆!');"
response.write "window.document.location.href='login.asp';"
response.write "</script>"
Response.End
end if
dim vip
vip=request("vip")
if vip="" then
call main()
elseif vip=1 then
call update()
end if
set rs=server.createobject("adodb.recordset")
sql="select * from 56770_user where user_id='"&session("user_id")&"'"
rs.open sql, conn, 1, 1
jifen=rs("jifen")
yxq=rs("yxq")
user_grade=rs("user_grade")
user_id=rs("user_id")
rs.close
set rs=nothing

sub main()
%>
<td align="center" valign=top>
<table width="100%" border="0" cellpadding="0" class=bk>
<FORM METHOD=POST ACTION="?vip=1">
<tr class=bk_h><td height=25> 升级VIP会员</td></tr>
<tr class=bg_l><td height="25"><li>亲爱的会员:<%=session("user_id")%> ,欢迎您升级为<font color=red><b>VIP</b></font>会员,享受更多的购物优惠。
</td></tr>
<tr class=bg_l><td height="25"><li>您现有购物积分:<font color=red><%=jifen%></font> 点 ,升级为<font color=red><b>VIP</b></font>会员需要购物积分 <font color=red><%=needjifen%></font> 点,有效期为 <font color=red><%=jifenyxq%></font> 天。
</td></tr>
<tr class=bg_l><td height="50" align="center">
<%
if user_grade<>"VIP" then
%><input type=submit name=submit value="升级为VIP会员" class=wenbenkuang1> <%else%>您的 <font color=red><b>VIP</b></font>会员 有效期还剩下 <font color=red><%=yxq-date()%></font> 天<%end if%>
</td></tr>
</FORM>
</table>
<br><br>
</td></tr></table>
<%end sub%>
<%sub update()%>
<td align="center" valign=top>
<table width="100%" border="0" cellpadding="0" class=bk>
<tr><td height="25"><%if jifen<int(needjifen) then response.write"<SCRIPT language=JavaScript>alert('您没有足够的积分!');"
response.write"javascript:history.go(-1)</SCRIPT>"
response.end else
conn.execute "update 56770_user set jifen=jifen-'"&needjifen&"' where user_id='"&user_id&"'"
conn.execute "update 56770_user set yxq=date()+'"&jifenyxq&"' where user_id='"&user_id&"'"
conn.execute "update 56770_user set user_grade='VIP' where user_id='"&user_id&"'"
response.write "<script language='javascript'>"
response.write "alert('恭喜您成功升级为Vip会员!');"
response.write "window.document.location.href='default.asp';"
response.write "</script>"
Response.End
end if%>
</td></tr></table>
<br><br>
</td></tr></table>
<%end sub%>
<!--#include file="footer.asp"-->
谢谢三位的热心!因为限制,有一部分没有发上来。请再看看!万分感谢!

如果yxq能正常显示,基本可以排除变量作用域问题;
建议你检查56770_user.jifen字段的数据类型和赋值给jifen后的数据类型
实在不行,就改写main(),把jifen作为参数传给

needjifen的判断在你的程序里怎么没有看到?

方法:
先取得用户积分并进行进行判断。
if 积分>=100 then
更新数据库,进行升级
end if