注册 登录
编程论坛 ASP技术论坛

[求助]会员登录,我怎样才能与你相识相知?

zhy328 发布于 2007-10-20 15:38, 785 次点击

会员登录这一块,我都快做两天了,还是没做好,获得会员资料这一部分怎么也调不来。代码如下:
set rs=server.createobject("adodb.recordset")
sql="select * from SMT_member where SMT_company_id="&session("id")
rs.open sql,conn,1,1
key=rs("SMT_key")
key1=rs("SMT_key1")
vip=rs("SMT_regtype")
session("vip")=rs("SMT_regtype")
goname=rs("SMT_username")
goid=rs("SMT_company_id")

ksdate=rs("SMT_starttime") SMT_starttime开始时间
ktdate=rs("SMT_endtime") SMT_endtime 结束时间
zdate=rs("SMT_regtime") SMT_regtime为注册时间
lastdate=rs("SMT_lastdate")SMT_lastdate 最后登录时间
loginhtc=rs("SMT_loginhtc")
htc=rs("SMT_hit")

if session("comname")="" then
session("comname")=rs("SMT_comname")
session("comyb")=rs("SMT_compost")
session("comtel")=rs("SMT_comphone")
session("comfax")=rs("SMT_comfax")
session("comlxr")=rs("SMT_name")
session("comlxrsex")=rs("SMT_sex")
session("commail")=rs("SMT_email")
session("comweb")=rs("SMT_homepage")
session("comaddress")=rs("SMT_comadd")
end if

rs.close
set rs=nothing

if key=0 then
vipjbzt="待审"
elseif key=1 then
vipjbzt="正常"
elseif key=2 then
vipjbzt="过期"
elseif key=3 then
vipjbzt="推荐"
end if

if vip=0 then
vipjb="普通会员"
elseif vip=1 then
vipjb="黄金会员"
elseif vip=2 then
vipjb="黄金会员申请中..."
end if

tian=cdate(year(ktdate)&"-"&month(ktdate)&"-"&day(ktdate))-date()
ztian=cdate(year(ktdate)&"-"&month(ktdate)&"-"&day(ktdate))-cdate(year(ksdate)&"-"&month(ksdate)&"-"&day(ksdate))


错误类型:
Microsoft JET Database Engine (0x80040E14)
语法错误 (操作符丢失) 在查询表达式 'SMT_company_id=' 中。

大家再帮忙看看这部分还有没有其他错误?
多谢了!!!!

[此贴子已经被作者于2007-10-20 16:04:22编辑过]

9 回复
#2
永夜的极光2007-10-20 15:47
你的session("id")没有被赋值
#3
zhy3282007-10-20 15:57
我知道啊  但是我不知道怎么赋值啊?
#4
zhy3282007-10-20 16:02
tian=zdate(year(ktdate)&"-"&month(ktdate)&"-"&day(ktdate))-date()
ztian=zdate(year(ktdate)&"-"&month(ktdate)&"-"&day(ktdate))-zdate(year(ksdate)&"-"&month(ksdate)&"-"&day(ksdate))

时间计算这也有问题
#5
永夜的极光2007-10-20 16:03

假设有这么三个页面
index.asp 用户登录后进入的页面,该页面显示用户的信息
login.asp 用户登录的页面,里面有个form,用于输入用户名和密码
check.asp 验证用户登录的页面

check.asp负责验证用户输入的用户名和密码是否合法,
如果不合法,自动跳转到login.asp,
如果合法,设置session("id")=用户的ID,然后自动跳转到index.asp

#6
zhy3282007-10-20 16:06
login.asp 用户登录的页面,里面有个form,用于输入用户名和密码
check.asp 验证用户登录的页面
这两个页面都做好了,就是index.asp这个页面有问题啊
#7
永夜的极光2007-10-20 16:09

那你的check.asp里面设置 session("id")=用户的ID 了吗?

#8
zhy3282007-10-20 16:10
没有,不知道怎么设?
#9
zhy3282007-10-20 16:12
这是我check.asp的代码
<%dbdns="../"%>
<!--#include file="../incs/conn.asp"-->
<% username=replace(trim(request("username")),"'","")
password=replace(trim(Request("password")),"'","")
regjm=replace(trim(Request("regjm")),"'","")
regjm1=replace(trim(Request("regjm1")),"'","")
if username="" then
response.write "<script>alert('Makes a mistake, under has the wrong Possible:\n\n·Please input the user id');history.go(-1);</Script>"
end if
if password="" then
response.write"<script>alert('Makes a mistake, under has the wrong Possible:\n\n·Please input the password');history.go(-1);</script>"
end if
if regjm1="" then
response.write"<script>alert('Makes a mistake, under has the wrong Possible:\n\n·Please input the check code');history.go(-1);</script>"
end if
if regjm<>regjm1 then
response.write"<script>alert('Makes a mistake, under has the wrong Possible:\n\n·The check code mistake ,Please input again');history.go(-1);</script>"
response.End()
end if
set rs=server.CreateObject("adodb.recordset")
sql="select * from SMT_member where SMT_password='"&password&"' and SMT_username='"&username&"'"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write"<SCRIPT language=JavaScript>alert('用户名或密码不正确!');"
response.write"javascript:history.go(-1)</SCRIPT>"
response.end
else
session("password")=rs("SMT_password")
session("username")=rs("SMT_username")
response.Cookies("adminok")=true
response.Redirect("admin.asp")
end if
rs.close
conn.close
%>
#10
huoqilin2007-10-20 17:15
else
session("password")=rs("SMT_password")
session("username")=rs("SMT_username")
session("id")=rs("SMT_company_id") 'check.asp里面加个这一行试下
response.Cookies("adminok")=true
response.Redirect("admin.asp")
end if

[此贴子已经被作者于2007-10-20 17:16:59编辑过]

1