[color navy]I have set up a page with a login counter that increments by 1 everytime a user fails to log in, either because he\she forgets the password or leaves the field blank.
Basically what I did was set my counter to reach 3 tries and then lock them out (then they would have to call a number to get unlocked) So, [color blue]schase's[/color] help who credits Link9 for his help to him, I was able to come up with this version on how to do it. I know this may not be the best way but it's working for me. Those familiar with DreamWeaver will recognize the coding and I will color-code the areas that actually made this page work for me. I hope this really helps someone in the near future.[/color]
[tt]
MM_LoginAction = Request.ServerVariables("URL")
If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" + Request.QueryString
MM_valUsername=CStr(Request.Form("username"))
If MM_valUsername <> "" Then
MM_fldUserAuthorization=""
MM_redirectLoginSuccess="page1.asp"
MM_redirectLoginFailed="login.asp"
MM_flag="ADODB.Recordset"
set MM_rsUser = Server.CreateObject(MM_flag)
MM_rsUser.ActiveConnection = MM_mydsn_STRING
MM_rsUser.Source = "SELECT account, password"
If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
[color green] MM_rsUser.Source = MM_rsUser.Source & " FROM dbo.mydatabase WHERE account='" & MM_valUsername &"' AND password='" & CStr(Request.Form("password")) & "' and counter < 3"[/color]
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
Session("MM_Password") = CStr(Request.Form("password"))
[color blue]dim sql
set sql = server.createobject("adodb.recordset")
sql.open "UPDATE mydatabase SET counter=0 WHERE account = '" & session("MM_username") & "'" , "dsn=mydsn;uid=me;pwd=cdn;"[/color]
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")
[/tt]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.