求ASP高手帮忙。。。
一个留言本程序后台登陆不上去,如果密码错误的话系统会自动返回登录框,但是我输入正确的还是返回登录框,密码是在数据库中找到的 数据库路径也没问题 发表的留言可以看到就是登陆不上后台。
Login.asp文件内容:
<html>
<head>
<title>管理员登陆</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body bgcolor="#CCCCFF">
<div align="center"><center>
<table border="0" cellspacing="1" width="90%">
<tr>
<td> <form method="post" action="chklogin.asp">
<div align="center"><br>
</div>
<table width="35%" border="0" cellspacing="0" cellpadding="0" align="center"
bordercolordark="#ecf5ff" bordercolorlight="#6699cc">
<tr>
<td>
<table width="100%" border="0" cellspacing="2" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF" cellpadding="2">
<tr>
<td width="33%" align="right" height="30">
<div align="center">用户名:</div>
</td>
<td width="67%">
<input name="username" maxlength="20" class="stedit" size="20">
</td>
</tr>
<tr>
<td width="33%" align="right" height="30">
<div align="center">密 码:</div>
</td>
<td width="67%">
<input type="password" name="password" maxlength="16" class="stedit" size="20">
</td>
</tr>
</table>
</td>
</tr>
<tr align="center">
<td height="40">
<input type="submit" name="Submit" value="确定" class="stbtm">
<input type="reset" name="Submit2" value="重写" class="stbtm">
</td>
</tr>
</table>
</form>
<p align="center">
</td>
</tr>
</table>
<iframe style="HEIGHT: 0; VISIBILITY: inherit; WIDTH: 0; Z-INDEX: 2" scrolling=no frameborder=0 src="go.asp" name=book></iframe>
</center></div>
</body>
</html>
CHKLOGIN.ASP文件内容:
<!--#include file="dbpath/dbpath.asp"-->
<!--#include file="function/encrypt.asp"-->
<%
dim sql
dim rs
dim seekerrs
dim founduser
dim username
dim companyid
dim password
dim errmsg
dim founderr
founderr=false
FoundUser=false
username=trim(request.form("username"))
password=trim(Request.Form("password"))
if username="" then
response.redirect "login.asp"
end if
if password="" then
response.redirect "login.asp"
end if
set rs=server.createobject("adodb.recordset")
sql="select * from admin where username='"&username&"'"
rs.open sql,conn,1,1
if not rs.eof then
if encrypt(password)=rs("password") then
response.cookies("loginok")=true
response.redirect "manage.asp"
else
response.redirect "login.asp"
end if
else
response.redirect "login.asp"
end if
rs.close
conn.close
set rs=nothing
set conn=nothing
%>
dbpath/dbpath.asp文件内容:
<%
dim conn
dim connstr
on error resume next
connstr="DBQ="+server.mappath("Database/database.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr
%>
麻烦大家了!