ASP后台登陆问题,高手请进
不管用户名密码是否正确,点击登陆后都提示用户名密码错误.<%dimconndimconnstrdb="../Db/Skyj.mdb"'数据库文件位置onerrorresu...
不管用户名密码是否正确,点击登陆后都提示用户名密码错误.
<%
dim conn
dim connstr
db="../Db/Skyj.mdb" '数据库文件位置
on error resume next
connstr="DBQ="+server.mappath(""&db&"")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
if err then
err.clear
else
conn.open connstr
end if
%>
<!--#include file="conn.asp"-->
<!--#include file="md5.asp"-->
<%
dim verifycode,verifycode2
verifycode=Session("pSN")
verifycode2=trim(Request.Form("verifycode"))
if verifycode<>verifycode2 then
response.write"<SCRIPT language=JavaScript>alert('您输入的验证码不正确。');"
response.write"location.href='default.asp'</SCRIPT>"
founderr=true
else
session("pSN")=""
if request("action")="login" then
admin_name=trim(request("admin_name"))
admin_pass=trim(request("admin_pass"))
end if
If Instr(admin_name,"or")<>0 or Instr(admin_pass,"or")<>0 or Instr(admin_name,"and")<>0 or Instr(admin_pass,"and")<>0Then
response.write "<br><br><br><br><font size=2><center>没事别搞人家后台,谢谢!<br>否则一切后果自负!</font>"
else
set rs=server.createobject("adodb.recordset")
sql="select * from admin where admin_name='"&admin_name&"' and admin_pass='"&md5(admin_pass)&"'"
rs.open sql,conn,1,3
if rs.eof then
response.write "<br><br><br><br><font size=2><center> "&admin_name&"对不起,您输入的用户名、密码或验证码有误,从重新输入,谢谢!<br><br>本软件建议您使用IE6.0以上版本,分辨率:1024*768<br><br>否则一切后果与本软件无关,特此声明!</font>"
else
session("admin_name")=request("admin_name")
session("quan")=rs("quan")
response.redirect "manage.asp"
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
end if
end if
%>
前台可以写入数据库,应该不是权限问题.
我将
sql="select * from admin where admin_name='"&admin_name&"' and admin_pass='"&md5(admin_pass)&"'"
rs.open sql,conn,1,3
替换成
sql="select * from admin where admin_name='"&admin_name&"' and admin_pass='"&md5(admin_pass)&"'"
response.write sql
response.end
提示select * from admin where admin_name='admin' and admin_pass='7a57a5a743894a0e'
还是不可以!
应该是空间问题,现已放弃哪个空间.谢谢各位的帮助! 展开
<%
dim conn
dim connstr
db="../Db/Skyj.mdb" '数据库文件位置
on error resume next
connstr="DBQ="+server.mappath(""&db&"")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
if err then
err.clear
else
conn.open connstr
end if
%>
<!--#include file="conn.asp"-->
<!--#include file="md5.asp"-->
<%
dim verifycode,verifycode2
verifycode=Session("pSN")
verifycode2=trim(Request.Form("verifycode"))
if verifycode<>verifycode2 then
response.write"<SCRIPT language=JavaScript>alert('您输入的验证码不正确。');"
response.write"location.href='default.asp'</SCRIPT>"
founderr=true
else
session("pSN")=""
if request("action")="login" then
admin_name=trim(request("admin_name"))
admin_pass=trim(request("admin_pass"))
end if
If Instr(admin_name,"or")<>0 or Instr(admin_pass,"or")<>0 or Instr(admin_name,"and")<>0 or Instr(admin_pass,"and")<>0Then
response.write "<br><br><br><br><font size=2><center>没事别搞人家后台,谢谢!<br>否则一切后果自负!</font>"
else
set rs=server.createobject("adodb.recordset")
sql="select * from admin where admin_name='"&admin_name&"' and admin_pass='"&md5(admin_pass)&"'"
rs.open sql,conn,1,3
if rs.eof then
response.write "<br><br><br><br><font size=2><center> "&admin_name&"对不起,您输入的用户名、密码或验证码有误,从重新输入,谢谢!<br><br>本软件建议您使用IE6.0以上版本,分辨率:1024*768<br><br>否则一切后果与本软件无关,特此声明!</font>"
else
session("admin_name")=request("admin_name")
session("quan")=rs("quan")
response.redirect "manage.asp"
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
end if
end if
%>
前台可以写入数据库,应该不是权限问题.
我将
sql="select * from admin where admin_name='"&admin_name&"' and admin_pass='"&md5(admin_pass)&"'"
rs.open sql,conn,1,3
替换成
sql="select * from admin where admin_name='"&admin_name&"' and admin_pass='"&md5(admin_pass)&"'"
response.write sql
response.end
提示select * from admin where admin_name='admin' and admin_pass='7a57a5a743894a0e'
还是不可以!
应该是空间问题,现已放弃哪个空间.谢谢各位的帮助! 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询