|
主题: 用户登陆的问题!
|
 yukous
职务:普通成员
等级:1
金币:0.0
发贴:76
注册:2003/5/16 11:53:27
|
#12003/5/28 13:59:25
当数据输入正确的时候,他可以正常运行(跳转到指定页),用户名对了,密码错误也可以运行!但用户名输入错误时, 页面提示:BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。 哪位大虾指教!谢谢! <%@LANGUAGE="VBSCRIPT"%>
<% Dim user Dim user_numRows
Set user = Server.CreateObject("ADODB.Recordset") user.ActiveConnection = MM_newmica_STRING user.Source = "SELECT * FROM user_info" user.CursorType = 0 user.CursorLocation = 2 user.LockType = 1 user.Open()
user_numRows = 0
Set rst = Server.CreateObject("ADODB.Recordset") rst.ActiveConnection = MM_newmica_STRING rst.Source = "SELECT * FROM user_info WHERE user_name='" & CStr(Request.Form("name")) & "' " rst.CursorType = 0 rst.CursorLocation = 2 rst.LockType = 1 rst.Open()
rst_numRows = 0 %> <% ' *** Validate request to log in to this site. MM_LoginAction = Request.ServerVariables("URL") If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" + Request.QueryString MM_valUsername=CStr(Request.Form("name")) If MM_valUsername <> "" Then MM_fldUserAuthorization="" MM_redirectLoginSuccess= rst("user_page") MM_redirectLoginFailed="false.asp" MM_flag="ADODB.Recordset" set MM_rsUser = Server.CreateObject(MM_flag) MM_rsUser.ActiveConnection = MM_newmica_STRING MM_rsUser.Source = "SELECT user_name, user_pass" If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization MM_rsUser.Source = MM_rsUser.Source & " FROM user_info WHERE user_name='" & Replace(MM_valUsername,"'","''") &"' AND user_pass='" & Replace(Request.Form("pass"),"'","''") & "'" MM_rsUser.CursorType = 0 MM_rsUser.CursorLocation = 2 MM_rsUser.LockType = 3 MM_rsUser.Open If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then ' username and password match - this is a valid user Session("MM_Username") = MM_valUsername If (MM_fldUserAuthorization <> "") Then Session("MM_UserAuthorization") = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).value) Else Session("MM_UserAuthorization") = "" End If if CStr(Request.QueryString("accessdenied")) <> "" And false Then MM_redirectLoginSuccess = Request.QueryString("accessdenied") End If MM_rsUser.Close Response.Redirect(MM_redirectLoginSuccess) End If MM_rsUser.Close Response.Redirect(MM_redirectLoginFailed) End If %> :confused:
编辑历史:[这消息被allinhands编辑过(编辑时间2003-05-28 14:04:05)]
|
 缺缺
职务:管理员
等级:8
金币:41.0
发贴:9620
注册:2004/1/14 19:14:47
|
#22003/5/28 14:09:00
Set rst = Server.CreateObject("ADODB.Recordset") rst.ActiveConnection = MM_newmica_STRING rst.Source = "SELECT * FROM user_info WHERE user_name='" & CStr(Request.Form("name")) & "' " rst.CursorType = 0 rst.CursorLocation = 2 rst.LockType = 1 rst.Open()
rst_numRows = 0
If rst.EOF Or rst.BOF Then Response.Write("用户名不存在") Response.end() End If
编辑历史:[这消息被allinhands编辑过(编辑时间2003-05-28 14:15:27)] [这消息被allinhands编辑过(编辑时间2003-05-28 14:27:47)]
|
 yukous
职务:普通成员
等级:1
金币:0.0
发贴:76
注册:2003/5/16 11:53:27
|
#32003/5/28 14:22:21
还是不行呀!
|
 缺缺
职务:管理员
等级:8
金币:41.0
发贴:9620
注册:2004/1/14 19:14:47
|
#42003/5/28 14:28:09
刚才写错了,现在应该可以了
|
 yukous
职务:普通成员
等级:1
金币:0.0
发贴:76
注册:2003/5/16 11:53:27
|
#52003/5/28 14:33:11
现在怎么写呀?语句在哪?
|
 yukous
职务:普通成员
等级:1
金币:0.0
发贴:76
注册:2003/5/16 11:53:27
|
#62003/5/28 14:33:57
看见了!不好意思!谢谢你!
|
 yukous
职务:普通成员
等级:1
金币:0.0
发贴:76
注册:2003/5/16 11:53:27
|
#72003/5/28 14:52:08
数据库字段:用户名,密码,跳转页面地址, 功能:输入用户名和密码,两者正确,就跳转当前一条记录的页面地址的页面,有一个不正确,这跳转失败页面!有高手发一段代码给我参考吗?谢了!
|
 { 在指尖上绽放的花朵 }
职务:普通成员
等级:5
金币:14.0
发贴:3209
注册:2002/7/25 21:24:11
|
#82003/5/28 20:19:18
输入用前台控制,名字为usr和pwd。 后台相关判断如下。 <%
SQL="select * from [color=blue]admin[/color] where [color=blue]Name[/color]='" & Request.form("usr") & "'"
set asp = Server.CreateObject("ADODB.Recordset")
asp.open SQL,connstr,1,1
if Request.form("pwd") <> asp("[color=blue]Password[/color]") then
Response.redirect "[color=blue]失败页面[/color]"
else
Response.redirect "[color=blue]成功页面[/color]"
end if
%>
蓝色的部分,根据表的结构不同自己修改?
|