这个asp登陆验证有错吗?

来源:百度知道 编辑:UC知道 时间:2024/09/28 01:24:10
代码如下:
<!--#include file="conn.asp" -->
<!--#include file="md5.asp"-->
<%
session.Timeout=100 '登陆超时时间(单位为分钟)
dim userid,password
userid=trim(Request.form("userid"))
password=trim(Request.form("password"))

if request("verifycode")="" then
response.write "<script LANGUAGE='javascript'>alert('请输入确认码!');history.go(-1);</script>"
response.end
elseif session("verifycode")="" then
response.write "<script LANGUAGE='javascript'>alert('请不要重复提交,如需重新登陆请返回登陆页面!');history.go(-1);</script>"
response.end
elseif session("verifycode")<>trim(request("verifycode")) then
response.write "<script LANGUAGE='javascript'>alert('您输入的确认码有误,请重新输入!');history.go(-1);</script>"
response.end

确实存在users这个表?

如果确认,conn.asp的链接方式换一下:

Dim conn,ConnStr
Dim SqlDatabaseName,SqlPassword,SqlUsername,SqlLocalName
SqlDatabaseName = "1111" '数据库名
SqlPassword = "11" '数据库密码
SqlUsername = "1111" '数据库用户名
SqlLocalName = "(local)" '数据库服务器,一般是(local),可用IP
ConnStr = "Provider = Sqloledb; User ID = " & SqlUsername & "; Password = " & SqlPassword & "; Initial Catalog = " & SqlDatabaseName & "; Data Source = " & SqlLocalName & ";"
set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr
If Err then '当错误时
err.Clear
Set Conn = Nothing
response.write"系统数据库连接错误,请检查连接字符" '可自己翻译
Response.End
End If

把users加个[]改为:[users]

sql="select * from [users] where userid='"&userid&"' and password