Skip to main content
Inspiring
March 31, 2009
Answered

session.times_logged_on question

  • March 31, 2009
  • 1 reply
  • 1265 views
Hello;
I am using this code to lock out a user if they unsuccessfully attempted to log into an area. This code works nice! Can't dump it from the cookies and it really locks you out. BUT... It locks you out forever as far as I can see... and I need to put a time limit on it. That is where I am kind of lost.

This is my code:

<CFPARAM NAME="session.times_logged_on" default="0">
<CFIF session.times_logged_on gt 3>
<font color="#990000" face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Sorry too many attempts to log in. An email has been sent to the Administrator with your information:<br>
<cfoutput>#CGI.REMOTE_ADDR#<br>
#HTTP_USER_AGENT#<br><br></cfoutput></b></font>
<CFELSE>
my login form here
</cfif>

is there a way to put a timmer on this? so if they fail, they get locked out, but in lets say 20 min they can try again.
How would I do that?

Thank you.
    This topic has been closed for replies.
    Correct answer Newsgroup_User
    that if () statement should be AFTER your THIS.sessionmanagement = true;
    line

    you can also try this variant:

    if( isdefined('session') AND structkeyexists(session, 'times_logged_on')
    AND session.times_logged_on gte 3 ) THIS.sessiontimeout =
    createtimespan(0,0,10,0);

    the syntax for structkeyexists() function in your attempt is all wrong.
    check the cfml reference if you are not sure about syntax of any
    particular cf function. you can download a free CFML Reference Manul PDF
    from adobe.com if you do not have one.

    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com/

    1 reply

    Inspiring
    March 31, 2009
    i highly doubt it locks anyone out 'forever'.
    just until they close their browser, maybe clear out their cookies, and
    access your login page again...

    in any case, the session var you are setting to hold the number of login
    attempts will cease to exist after the session times out as per your
    sessiontimeout setting in application.cfm/cfc, and they should be able
    to try again...

    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com/
    CFmongerAuthor
    Inspiring
    March 31, 2009
    I thought that was when it would go away. Is there a way to over ride the session timeout on my application.cfc file with one I set for just this feature? like a <cfset session.times_logged_on Timeout =10> or something like that?