关于密码验证的问题(简单的)
string userstring
string txtusername,psword,password
string ls_sql
datastore li_datastore
int n,m
txtusername=trim(ddlb_name.text)//ddlb.name是一个输入用户名的控件
psword=trim(sle_pw.text)//sle_pw.text是一个密码的控件
if txtusername="" then
messagebox("警告","用户名不能为空")
ddlb_name.setfocus()
return
end if
li_datastore=create datastore
select count(*) into :n from user where userid=:txtusername;
if n=0 then
messagebox("警告","你不是本系统的合法用户")
ddlb_name.setfocus()
destroy li_datastore;
return
end if
password=li_datastore.getitemstring(1,"password")
if isnull(password) then
password=""
end if
if trim(password) <> trim(psword) then
messagebox("警告","你的口令有误,请重新输入!")
sle_pw.setfocus()
return
end if
userstring=ddlb_name.text
sqlca.logid=userstring
//初始化
setprofilestring("user.ini","server","username",userstring)//?????
destroy li_datastore;
select hosname
into :gs_topic
from hospital;
if gs_topic="" or isnull(gs_topic) then
gs_topic="未注册"
end if
gs_bottom="PB工作室!"
///注:这是我抄的书上的程序,有点看不懂,请大家指教。。
建了一个表名字是user,存贮用户名称userid和密码password,就是datastore是什么意思?有什么用??直接从数据库中读用户名的密码在验证不是更简单吗?
还有setprofilestring()是什么意思??
select count(*) into :n from user where userid=:txtusername;这句的意思是
判断数据库中有此用户名是把?那后来n=0是什么意思,如果数据库中没有的话是返回0还是n为空呢,我运行时老说 你的口令有误,请重新输入! 。。
怎么回事呀?