感觉这个logincheck.asp文件有问题,恳请高手帮助

jason197704 2012-05-20 01:15:06
大家好,本人是新手,正在学习用ACCESS+ASP制作网站。从网上下载的教程教程里的代码感觉有问题,代码是先验证用户名和密码然后跳转到定义好的网页brand.asp,然后还要验证验证码。可是其实是同时验证用户名,密码和验证码,正确以后跳转到定义好的brand.asp,也就说怎么样才能把验证码放到正确的位置,但是我不会改动,所以恳请各位高手帮忙指点,谢谢。

<html>
<head>
<title>公司</title>
</head>
<!--#include file="../include/conn.asp" -->
<!--#include file="md5.asp" -->
<body>
<%'查询数据库中adminname为用户所输入的用户名的所有信息
set rs=Server.CreatObject("ADODB.Recordset")
sql="Select * Form admin Where adminname='"&user&"'"
rs.open sql,conn,1,3

'检查输入的用户名是否存在,不存在,给出提示信息,并使页面后退
if rs.bof and rs.eof then%>
<script language='javascript'>
alert("错误:此用户名不存在!");
location.href=”javascript:history.go(-1);";
</script>

<%else
'检查输入的密码是否正确,不正确,给出提示信息,并使页面后退
if md5(pwd)<>rs("adminpwd") then%>
<script language="javascript">
alert("错误:您的密码不正确!");
location.href=”javascript:history.go(-1);";
</script>

<%'用户名和密码都正确,将页面跳转到brand.asp
else%>
<script language="javascript">
window.navigate("../web/brand.asp");
</script>
<%end if
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
<%
'获取用户提交的验证码
code=trim(request("checkcode"))
if code<>trim(Session("ProcessControl/login.com_ValidateCode")) then %>
<script language="javascript">
alert("请输入正确的验证码!");
location.href="javascript:history.go(-l);" ;
</script>
<% end if
%>
</body>
...全文
91 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
jason197704 2012-05-20
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 的回复:]
HTML code

<html>
<head>
<title>公司</title>
</head>
<!--#include file="../include/conn.asp" -->
<!--#include file="md5.asp" -->
<body>
<%
'获取用户提交的验证码
code=trim(request("checkcode"))
……
[/Quote]谢谢您,我先试一下了
fujunle 2012-05-20
  • 打赏
  • 举报
回复
<html>
<head>
<title>公司</title>
</head>
<!--#include file="../include/conn.asp" -->
<!--#include file="md5.asp" -->
<body>
<%
'获取用户提交的验证码
code=trim(request("checkcode"))
if code<>trim(Session("ProcessControl/login.com_ValidateCode")) then %>
<script language="javascript">
alert("请输入正确的验证码!");
location.href="javascript:history.go(-l);" ;
</script>
<% end if
%>
<%'查询数据库中adminname为用户所输入的用户名的所有信息
set rs=Server.CreatObject("ADODB.Recordset")
sql="Select * Form admin Where adminname='"&user&"'"
rs.open sql,conn,1,3

'检查输入的用户名是否存在,不存在,给出提示信息,并使页面后退
if rs.bof and rs.eof then%>
<script language='javascript'>
alert("错误:此用户名不存在!");
location.href=”javascript:history.go(-1);";
</script>

<%else
'检查输入的密码是否正确,不正确,给出提示信息,并使页面后退
if md5(pwd)<>rs("adminpwd") then%>
<script language="javascript">
alert("错误:您的密码不正确!");
location.href=”javascript:history.go(-1);";
</script>

<%'用户名和密码都正确,将页面跳转到brand.asp
else%>
<script language="javascript">
window.navigate("../web/brand.asp");
</script>
<%end if
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
%>

</body>


这样子就是先验证:验证码,用户名,密码,再跳转
snlixing 2012-05-20
  • 打赏
  • 举报
回复
你感觉有什么问题

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧