ASP+VBscript 登陆检测密码

来源:百度知道 编辑:UC知道 时间:2024/06/25 10:23:06
代码如下。

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<%
huiyuanming=trim(request.Form("huiyuanming"))
mima=trim(request.Form("mima"))

if(huiyuanming="" or mima="" )then
response.Redirect"login.asp?errmsg=请完整填写登陆信息"
response.End()
end if

dim conn,strsql,objrs
set conn=serv

是SQL语句的问题
将strsql="select*from zhuce where huiyuanming="'& huiyuanming &'""
strsql=strsql & "and mima = "'& mima &' " "
改为:
strsql="select * from zhuce where huiyuanming='"&huiyuanming&"' and mima='"&mima&"'"
即可,是因为你的SQL语句中用户名和密码是属于文本的,因此要加上单引号,另外要注意and 与前面的SQL语名之间要有空格,也就是:
例如:
strsql="select * from zhuce where huiyuanming='china' and mima='china'"
其中的and与前面的'china'之间一定要有空格,这一点要注意。这一点体现在前面的strsql里的and与它前面的'之间有个空格

<!--#include file=../include/config.asp-->
<!--#include file=../include/conn_view.asp-->
<!--#include file=../include/function.asp-->
<%
dim user,password,strSql,rsTmp,retValue,rs
user=request("user")
password=request("password")
if user="" then
out("用户名不能为空!")
resonse.end