| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 878 人关注过本帖
标题:再问:登陆密码错误,显示源码内容,如何处理?
取消只看楼主 加入收藏
yinxinhong
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2010-3-22
结帖率:100%
收藏
已结贴  问题点数:16 回复次数:1 
再问:登陆密码错误,显示源码内容,如何处理?
程序代码:
<%
dim username,UserPassword,comeurl,passcode
username=FormatSQL(replace(trim(request.form("username")),"'",""))
UserPassword=md5(FormatSQL(replace(trim(request.Form("Password")),"'","")))

if trim(request.form("comeurl"))="" then
comeurl="index.asp"
else
comeurl=trim(request.form("comeurl"))
end if
if username="" or UserPassword="" then
response.Write "<script LANGUAGE='javascript'>alert('登录失败!请检查您的登录名和密码!');history.go(-1);</script>"
response.end
end if

passcode=request.form("passcode")
if passcode="" then
response.Write "<script LANGUAGE='javascript'>alert('登录失败!请输入您的验证码!');history.go(-1);</script>"
response.end
end if
passcode=Cint(request.form("passcode"))
if passcode<>Session("GetCode") then
response.Write "<script LANGUAGE='javascript'>alert('登录失败!验证码错误!');history.go(-1);</script>"
response.end
end if

set rs=server.CreateObject("adodb.recordset")
sql="select * from [user] where username='"&username&"' and Password='"&UserPassword&"' "

response.write sql
rs.Open sql,conn,1,3
if not(rs.bof and rs.eof) then

if UserPassword=rs("Password")  then
response.Cookies("Huibo")("username")=trim(request.form("username"))
response.Cookies("vip")=rs("vip")
rs("Lastvst")=now()
rs("loginnum")=rs("loginnum")+1
rs.Update
rs.Close
set rs=nothing
call loginok()
else
response.write "<script LANGUAGE='javascript'>alert('登录失败,请检查您的登录名和密码!');history.go(-1);</script>"
end if

else
response.write "<script LANGUAGE='javascript'>alert('登录失败!请检查您的登录名和密码!');history.go(-1);</script>"
end if
sub loginok()
response.Write "<font size=2>欢迎  <font color=red size=2>"&request.Cookies("Huibo")("username")&"</font>,光临两秒种后将自动跳转到相应页!</font>"
response.redirect comeurl
end sub
conn.close
set conn = nothing
%>
代码如上述
密码正确能正常登陆
当密码错误的时候居然显示[select * from [user] where username='输入的用户名' and Password='输入的密码(加密后的)']
请问:如何处理,不显示?
搜索更多相关主题的帖子: 源码 密码 登陆 
2010-03-22 21:04
yinxinhong
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2010-3-22
收藏
得分:0 
呵呵,看回帖之前已经解决了,删除了response.write sql,不过依然谢谢
3楼版主说程序存在SQL注入风险,该怎么办?
2010-03-23 08:36
快速回复:再问:登陆密码错误,显示源码内容,如何处理?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.021447 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved