This topic is already posted but I want to recall, here it goes
===============================================
Function BeforeLogin(username, password)
'** Custom code ****
' check if this IP address is currently blocked
set rstmp=Server.CreateObject("ADODB.Recordset")
rstmp.Open "select Attempts, case when LastLogin is NULL then 60 else datediff(mi, LastLogin, getdate()) end as Minutes from LoginAttempts where ip = '" & Request.ServerVariables("REMOTE_ADDR") & "'", dbConnection
if rstmp.eof then
BeforeLogin = True
else
if rstmp("Attempts")>=3 then
if rstmp("Minutes")<30 then
Response.Write "<p align=center>
<font color=red><b>Access denied for 30 minutes</b>< font></p>"
BeforeLogin = False
else
dbConnection.Execute "update LoginAttempts set Attempts=0 where ip = '" & Request.ServerVariables("REMOTE_ADDR") & "'"
BeforeLogin = True
end if
else
BeforeLogin = True
end if
end if
rstmp.Close : set rstmp = Nothing
End Function
========================================
I used the username & password as my field on my tblog, but when I build the page it goes an error like this
*Error number -2147217900
Error description [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'case when LastLogin is NULL then 60 else Datediff(mi, LastLogin, getdate()) end'.
URL /atm/login.asp
SQL query select from [user_access] where [username]='jong' and [pwd]='letmein'**
please help, thank you so much