This topic is locked

Unsuccessful Login's

5/31/2007 10:45:38
ASPRunnerPro General questions
S
stealthwifi author

Hello,
I have been trying to add log tables to my asprunner sites to incereas security.

I have the Successfull Login attempts log down and working great. I am pretty much

using the same code for the Unsuccessfull attempts log except changing status to "failed".

I am using the Global Unccessfull Login event in asprunner 4.0 and it just dosent seem to do

anything, no errors or anything it just doesnt add any values to the table. Below is the code I am using.
[codebox]Sub AfterUnsuccessfulLogin()

'** Insert a record into another table ****

LogDate = now()

USERID = UCase(Session("UserID"))

MACHIP = Request.ServerVariables("REMOTE_ADDR")

STATUS = "Failed"

strSQLInsert = "insert into LoginAttemptsTable (LogDate, USERID, MACHIP, STATUS )

values (' " & LogDate & " ', ' " & USERID & " ', ' " & MACHIP & " ', ' " & STATUS & " ' ) "

dbConnection.Execute strSQLInsert

End Sub
%>[/codebox]
It's not that big of a deal that it doesn't log unccessfull attempts because that will most likely be a huge

list anyway, but I would like to get the unccessfull login events working any way.
Thank You!

Stealth-

Sergey Kornilov admin 5/31/2007

Try to print SQL query on the page instead of executing it.
Post what it prints here.

S
stealthwifi author 5/31/2007

Try to print SQL query on the page instead of executing it.

Post what it prints here.


It would'nt Print anything, I put response write to print the variables like IP and such, and also just had a simple response write to print "Hello" and that still didn't work.
The successfull login works perfect, and the only diffrence in the code at all is the word "Success" insted of "Fail"
Cheers,

Stealth-

J
Jane 6/1/2007

answered in your personal email.

S
stealthwifi author 6/1/2007

Thank you for the solution:
Changed Code To: [codebox]Sub AfterUnsuccessfulLogin()

'** Insert a record into another table ****

LogDate = now()

USERID = UCase(postvalue("username"))

MACHIP = Request.ServerVariables("REMOTE_ADDR")

STATUS = "Failed"

strSQLInsert = "insert into LoginAttempts (LogDate, USERID, MACHIP, STATUS )

values (' " & LogDate & " ', ' " & USERID & " ', ' " & MACHIP & " ', ' " & STATUS & " ' ) "

dbConnection.Execute strSQLInsert

End Sub

[/codebox]
and Changed Login.asp to [codebox]else

DoEvent "Call AfterUnsuccessfulLogin()"

strMessage = "Invalid Login"

end if

rs.MoveNext

else

DoEvent "Call AfterUnsuccessfulLogin()"

strMessage = "Invalid Login"

[/codebox]
and Everything works prefect, thanks again for all your help!
Cheers,

Stealth-