HTML调用asp数据库

来源:百度知道 编辑:UC知道 时间:2024/05/21 09:08:02
<%
logintxt2="<table width=190 border=0 align=center cellpadding=0 cellspacing=0>"
logintxt2=logintxt2 & "<tr>"
logintxt2=logintxt2 & "<td colspan=2><div align=center>"

set rs=server.createobject("adodb.recordset")
rs.open "select jifen,yucun,reglx,vipdate from [user] where username='"&request.cookies("Cnhww")("username")&"'",conn,1,3
if rs("vipdate")<>"" then
if rs("vipdate")<date and rs("reglx")=2 then
rs("reglx")=1
rs.update
end if
end if
response.cookies("Cnhww")("yucun")=rs("yucun")
response.cookies("Cnhww")("jifen")=rs("jifen")
response.cookies("Cnhww")("reglx=")=rs("reglx")
rs.close
set rs=nothing

if request.cookies("

你的connection在哪里创建的?

你这里没有调用if rs.eof then来判断数据库中是否有这个用户,如果数据库中根本没有你的request.cookies("Cnhww")("username")这个值,它当然无法调出数据

还有,你为什么要把登录信息存入cookies?这个很容易被人伪造的。。登录时也没有用密码判断啊?