Logging someone out of a site after a certin time period

Ask a Question related to Coldfusion - Getting Started, Design and Development.

  1. #1

    Default Logging someone out of a site after a certin time period

    Can someone help me. I have created a login form and used Application.cfm to
    hold my login and loginuser. I would like to know if anyone knows how to
    logout a user if they are logged in the site for lets say more than 5 hours.
    So they have to log back in after 5 hours or what ever the time is specified.
    I am attaching my Application.cfm code of what I have currently. If any body
    knows can you please tell me how to do this and where should I place this in my
    code. Thank you very much everyone. Thank you, AdonaiEchad
    --------------------------------------

    <cflogin>

    <cfif isDefined ('FORM.login_button.y')>
    <cfquery datasource="#sLOMM#" name="qLogin">
    SELECT users.user_id, users.name_first, user_type.type
    FROM users, user_type
    WHERE user_type.user_type_id = users.user_type_id
    AND users.email = '#FORM.email#'
    AND users.password = '#FORM.password#'
    </cfquery>
    <cfif qLogin.RecordCount GT 0>
    <cfset session.name_first = #qlogin.name_first#/>
    <cfloginuser name="#qLogin.user_id#" password="#FORM.password#"
    roles="#qLogin.type#"/>
    <cfelse>
    <cfset sHeaderMessage = "The e-mail and password combination you tried is
    incorrect." />
    <cfinclude template="login_form.cfm" />
    <cfabort />
    </cfif>
    <cfelse>
    <cfinclude template="login_form.cfm" />
    <cfabort />
    </cfif>
    </cflogin>

    AdonaiEchad Guest

  2. Similar Questions and Discussions

    1. Allowing opening pdf for a period of time
      Is there a way to create a pdf so that when provided to users, there is a time limit on opening it??? In other words, I have material that is...
    2. How can I avoid the mouse click during a short period of time???
      Hello to all!!! I have a projector movie that opens another projector movie when a specific button is clicked. It works fine , but, if the...
    3. Way to automatically recycle aspnet_wp work process when close to 100% CPU for certain period of time?
      I have a server setup that is dedicate to providing a "proxy" by exposing a web service that calls methods in a 3rd party ActiveX control and then...
    4. Changing a sprite member for a period of time
      Dear Forum I have developed a childs numeracy and spelling game. I have managed to build the back-end of the system i.e the creation of random...
    5. Loop for a period of time.
      Hello everyone. I am making a auto play slide show of about 50 images. How can i make director loop on a image for say 10 seconds before moving...
  3. #2

    Default Re: Logging someone out of a site after a certin timeperiod

    Does anyone know how to do this?
    AdonaiEchad Guest

  4. #3

    Default Re: Logging someone out of a site after a certin time period

    AdonaiEchad wrote:
    > Does anyone know how to do this?
    The user's session will time out after the amount of time specified in
    the CF administrator. That doesn't really log them out per se, but they
    do lose their session. In CFMX 7 there is a new onSessionEnd method
    that is run when a session ends (as long as you're using the new
    Application.cfc as opposed to Application.cfm) so you could leverage
    that to handle a more graceful logout if you're on CF 7.

    Matt

    --
    Matt Woodward
    Team Macromedia - ColdFusion
    mpwoodward *TMM* Guest

  5. #4

    Default Re: Logging someone out of a site after a certin timeperiod

    Actually, there is an easy way to do what you're trying accomplish. A few years
    back I wanted to do the same thing. Now, I can't remember exactly how to do it,
    but it would require using http-refresh tags (remember those?) and CF's
    CreateTimeSpan or something. You match the timespan with the refresh time,
    which would be like 20 or 30 minutes (in seconds) and if the timespan was
    greater than the refresh time, you would spit them out to a page that explained
    that they were idle too long.

    Sorry for the vagueness, I'll try to find the source of the one I did and post
    it for you.

    HTH

    Defuse Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139