菜鸟求助,asp网站后台管理员登录不上去了,数据库里看用户名和密码都正确

izaragg 2017-04-11 04:16:53
环境是server2003iis+sql2005和server2008+sql2008都试过了,输入用户名1密码1都提示错误。代码在下面:
default.asp文件:
<HTML><HEAD><TITLE>公文传输系统</TITLE>
<!--#include file="asp/sqlstr.asp"-->
<!--#include file="asp/opendb.asp"-->
<!--#include file="asp/maxqstime.asp"-->
<%
'登录
session.timeout=1000
username=request("username")
password=request("password")
if username<>"" and password<>"" then
set rs=server.createobject("adodb.recordset")
sql="select userinf.id, userinf.name,userinf.username,dept.dept,userinf.forbid,userinf.dwdm from userinf,dept where dept.dwdm=userinf.dwdm and userinf.username=" & sqlstr(username) & " and userinf.password=" & sqlstr(password) & " and userinf.forbid='no'"
rs.open sql,conn,1
lssss=""
if not rs.eof and not rs.bof then
lssss=rs("forbid")
lsdm=rs("dwdm")
lsuid=rs(0)
response.Cookies("userid")=rs(0)
rs.close
set rs=nothing
ls1=request.Cookies("maxqstime")
if isnull(ls1) or ls1="" then response.Cookies("maxqstime")=getmaxtime(lsdm)
ls1=request.Cookies("maxnewemail")
if isnull(ls1) or ls1="" then response.Cookies("maxnewemail")=getnewemail(lsuid)
set conn=nothing
response.Redirect("gensystem.asp")
else%>
<SCRIPT LANGUAGE=javascript>
alert("用户名和密码输入有误,请重新输入");
</SCRIPT>
<%
end if
end if
%>

<STYLE type=text/css>
*{ font-size:12px}
BODY {
COLOR: #c4c4c4;
margin:0px;
background:url(../office/gwcs/img/bg.gif);
font-size: 12px;
background-image: url(img/bg.gif);
}
.but {
background-image: url(IMAGES/but_bg1.jpg);
border: 1px solid #999999;
width: 70px;
}
A:link {
FONT-SIZE: 9pt; COLOR: #262626; FONT-FAMILY: "宋体"; TEXT-DECORATION: none
}
A:hover {
FONT-SIZE: 9pt; COLOR: #ff6600; FONT-FAMILY: "宋体"; TEXT-DECORATION: none
}
A:visited {
COLOR: #333333; TEXT-DECORATION: none
}
.blue{color:#0000ff;}
.STYLE1 {
font-family: "华文新魏", "华文行楷", "方正舒体";
font-size: 36px;
color: #FFFFFF;
}
.box {
width: 150px;
border: 1px solid #999999;
}
</STYLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"></HEAD>
<BODY><center>
<table width="765" height="100%" border="0" cellpadding="0" cellspacing="0" >
<tr>
<td valign="middle"><table width="765" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="60"><div align="center"><span class="STYLE1">公文流转网络办公系统</span></div></td>
</tr>
</table>
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
<tr height="35" >
<td width="10"><img src="img/cdt_1.gif" width="10" height="35"></td>
<td width="311" background="img/cdt_bj.gif"><font color="#FFFFFF">用户登陆</font></td>
<td colspan="2" background="img/cdt_bj.gif">欢迎您使用本系统</td>
<td width="11"><img src="img/cdt_15.gif" width="11" height="35"></td>
</tr>
<tr height="35" >
<td height="94" bgcolor="#FFFFFF"> </td>
<td bgcolor="#FFFFFF" class="blue"><form action="default.asp" method="post" name="form1" id="form1">
用户名:
<input name="username" type="text" class="box" id="username" onFocus="">

<br>
密  码:
<input name="password" type="password" class="box" id="password">
<br>
<br>         <input name="submit" type="submit" class="but" value="进入"></form> </td>
<td width="155" bgcolor="#FFFFFF" class="blue"><img src="img/abc.gif" width="127" height="83"></td>
<td width="273" valign="bottom" bgcolor="#FFFFFF" class="blue" style="font-size:9pt"><a href="help.htm" target="_blank"></a></td>
<td bgcolor="#FFFFFF"> </td>
</tr>
<tr height="35" >
<td colspan="5" background="../office/gwcs/img/index_48.gif"> </td>
</tr>
</table>
<div style="width:760; text-align:center"><FONT color=#ffffff></FONT><FONT color=#ffffff><br>
建议使用分辨率800x600以上,最好1024x768。IE版本在6.0以上。<BR>
<BR>
</FONT></div></td>
</tr>
</table>
</center>
</BODY></HTML>
...全文
371 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
漠叔 2017-04-11
  • 打赏
  • 举报
回复
用户名和密码加上单引号 where userinf.username='" & sqlstr(username) & "' and userinf.password='" & sqlstr(password) & "' and userinf.forbid='no'"

28,391

社区成员

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

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