YET ANOTHER QUESTION ON SESSION TIMEOUT AND SESSION_ONEND()

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • HolaGoogle

    #1

    YET ANOTHER QUESTION ON SESSION TIMEOUT AND SESSION_ONEND()

    hi there,
    i've 2 questions for you guys....
    1: is there any way to "force" a session_onend() , session timeout or
    at least call my logout method when a user leaves the application
    window without logging out? i.e: using the "X" in the right corner???
    i'd like to reset to their default all my variables session?? is this
    possible???

    2: I've succesfully been able to ask the user to confirm whether he
    wants to extend his session before it ends due to inactivity. This
    works perfectly and my question is: if the user is not there to answer
    the question is there any way to automaticaly end the session after 1
    minutes without any answer???

    i.e:
    function UserToConfirm()
    {
    if (confirm('Hey.. .your session is about to time out extend?'))//if
    the user
    //is not there to answer, then force log out ho to do this?????
    {
    clearTimeout(Se ssionTimer );
    }
    else
    {
    parent.top.loca tion.href = 'LogOut.asp';

    }
    }

    function SetSessionTimer ()
    {
    if(SessionTimer > 0)
    {
    clearTimeout(Se ssionTimer );
    }
    TimeOutID = setTimeout("Use rToConfirm()",1 20000);//2
    minutes
    //before session ends
    }
    and i call my SetSessionTimer () method in my body onload event...


    thanks a lot...
  • Lasse Reichstein Nielsen

    #2
    Re: YET ANOTHER QUESTION ON SESSION TIMEOUT AND SESSION_ONEND()

    holaasp@yahoo.c om (HolaGoogle) writes:
    [color=blue]
    > hi there,
    > i've 2 questions for you guys....
    > 1: is there any way to "force" a session_onend() , session timeout or
    > at least call my logout method when a user leaves the application
    > window without logging out? i.e: using the "X" in the right corner???[/color]

    No. They might not even be connected to the internet when they close
    the browser.
    [color=blue]
    > 2: I've succesfully been able to ask the user to confirm whether he
    > wants to extend his session before it ends due to inactivity. This
    > works perfectly and my question is: if the user is not there to answer
    > the question is there any way to automaticaly end the session after 1
    > minutes without any answer???[/color]

    Probably. Don't use a modal confirm dialog, though. You have no way
    of making that go away after one minute. If you use HTML to pose
    the question, you can remove it again, and then do whatever you want.

    I.e., something like:
    ---
    /**
    * text : text to display for yes/no answer
    * onYes : optional, function called if yes chosen
    * onNo : optional, function called if no chosen
    * timeout : optional, time in milliseconds before defaulting
    * timeoutDefault: optional, default answer for timeout
    *
    * Don't omit both onYes and onNo.
    */
    function myConfirm(text, onYes,onNo,time out,timeoutDefa ult) {
    var div = document.create Element("div");
    div.style.borde r = "3px grey outset";
    div.style.width ="8em";
    div.style.heigh t="6em";
    div.style.backg round = "grey";
    div.style.posit ion = "absolute"; // or use fixed
    div.style.left = "10em";
    div.style.top = "10em"; // do something to make sure it is visible
    var p = document.create Element("p");
    p.appendChild(d ocument.createT extNode(text));
    div.appendChild (p);
    var div2 = document.create Element("div");
    div2.style.text Align = "center";
    var butYes = document.create Element("input" );
    butYes.style.ma rgin="0px 5px";
    butYes.type="bu tton";
    butYes.value="Y es";
    butYes.onclick= function(){acti on(true);};
    var butNo = document.create Element("input" );
    butNo.style.mar gin="0px 5px";
    butNo.type="but ton";
    butNo.value="No ";
    butNo.onclick= function(){acti on(false);};
    div2.appendChil d(butYes);
    div2.appendChil d(butNo);
    div.appendChild (div2);
    div.style.zInde x = 1;
    document.body.a ppendChild(div) ;
    if (timeout) {
    var timer = setTimeout(func tion(){action(t imeoutDefault); },timeout);
    }
    function action(choice) {
    clearTimeout(ti mer);
    document.body.r emoveChild(div) ;
    if (choice) { if (onYes) {onYes();}}
    else { if (onNo) {onNo();} }
    }
    }
    ---
    You can call it as, e.g.,:
    ---
    myConfirm("Are you sure?",
    function(){aler t("yes");},func tion(){alert("n o");},
    5000,true);
    ---
    You should do something more to make sure the dialogue is visible, even
    if the page is scrolled down.

    You can save code space by having the confirm HTML already in the page,
    and just changing the actions and text.

    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    • HolaGoogle

      #3
      Re: QUESTION ON SESSION TIMEOUT AND SESSION_ONEND()

      Thanks Lasse for your quick answer...i<ll try your solution and let
      you know...yeah you<Re right i tried everything to make my confirm
      dialog go away after 1 minute and couldn't. So i'm gonna try you way
      and see what happens.

      For my 1st question, i do have a logout method, is there any way that
      i could use this instead of calling session_end() to force the user to
      logout when he exits the application???

      Thanks a lot once again....

      Lasse Reichstein Nielsen <lrn@hotpop.com > wrote in message news:<ptfq4uk4. fsf@hotpop.com> ...[color=blue]
      > holaasp@yahoo.c om (HolaGoogle) writes:
      >[color=green]
      > > hi there,
      > > i've 2 questions for you guys....
      > > 1: is there any way to "force" a session_onend() , session timeout or
      > > at least call my logout method when a user leaves the application
      > > window without logging out? i.e: using the "X" in the right corner???[/color]
      >
      > No. They might not even be connected to the internet when they close
      > the browser.
      >[color=green]
      > > 2: I've succesfully been able to ask the user to confirm whether he
      > > wants to extend his session before it ends due to inactivity. This
      > > works perfectly and my question is: if the user is not there to answer
      > > the question is there any way to automaticaly end the session after 1
      > > minutes without any answer???[/color]
      >
      > Probably. Don't use a modal confirm dialog, though. You have no way
      > of making that go away after one minute. If you use HTML to pose
      > the question, you can remove it again, and then do whatever you want.
      >
      > I.e., something like:
      > ---
      > /**
      > * text : text to display for yes/no answer
      > * onYes : optional, function called if yes chosen
      > * onNo : optional, function called if no chosen
      > * timeout : optional, time in milliseconds before defaulting
      > * timeoutDefault: optional, default answer for timeout
      > *
      > * Don't omit both onYes and onNo.
      > */
      > function myConfirm(text, onYes,onNo,time out,timeoutDefa ult) {
      > var div = document.create Element("div");
      > div.style.borde r = "3px grey outset";
      > div.style.width ="8em";
      > div.style.heigh t="6em";
      > div.style.backg round = "grey";
      > div.style.posit ion = "absolute"; // or use fixed
      > div.style.left = "10em";
      > div.style.top = "10em"; // do something to make sure it is visible
      > var p = document.create Element("p");
      > p.appendChild(d ocument.createT extNode(text));
      > div.appendChild (p);
      > var div2 = document.create Element("div");
      > div2.style.text Align = "center";
      > var butYes = document.create Element("input" );
      > butYes.style.ma rgin="0px 5px";
      > butYes.type="bu tton";
      > butYes.value="Y es";
      > butYes.onclick= function(){acti on(true);};
      > var butNo = document.create Element("input" );
      > butNo.style.mar gin="0px 5px";
      > butNo.type="but ton";
      > butNo.value="No ";
      > butNo.onclick= function(){acti on(false);};
      > div2.appendChil d(butYes);
      > div2.appendChil d(butNo);
      > div.appendChild (div2);
      > div.style.zInde x = 1;
      > document.body.a ppendChild(div) ;
      > if (timeout) {
      > var timer = setTimeout(func tion(){action(t imeoutDefault); },timeout);
      > }
      > function action(choice) {
      > clearTimeout(ti mer);
      > document.body.r emoveChild(div) ;
      > if (choice) { if (onYes) {onYes();}}
      > else { if (onNo) {onNo();} }
      > }
      > }
      > ---
      > You can call it as, e.g.,:
      > ---
      > myConfirm("Are you sure?",
      > function(){aler t("yes");},func tion(){alert("n o");},
      > 5000,true);
      > ---
      > You should do something more to make sure the dialogue is visible, even
      > if the page is scrolled down.
      >
      > You can save code space by having the confirm HTML already in the page,
      > and just changing the actions and text.
      >
      > /L[/color]

      Comment

      • HolaGoogle

        #4
        Re: QUESTION ON SESSION TIMEOUT AND SESSION_ONEND()

        Thanks Lasse for your quick answer...i<ll try your solution and let
        you know...yeah you<Re right i tried everything to make my confirm
        dialog go away after 1 minute and couldn't. So i'm gonna try you way
        and see what happens.

        For my 1st question, i do have a logout method, is there any way that
        i could use this instead of calling session_end() to force the user to
        logout when he exits the application???

        Thanks a lot once again....

        Lasse Reichstein Nielsen <lrn@hotpop.com > wrote in message news:<ptfq4uk4. fsf@hotpop.com> ...[color=blue]
        > holaasp@yahoo.c om (HolaGoogle) writes:
        >[color=green]
        > > hi there,
        > > i've 2 questions for you guys....
        > > 1: is there any way to "force" a session_onend() , session timeout or
        > > at least call my logout method when a user leaves the application
        > > window without logging out? i.e: using the "X" in the right corner???[/color]
        >
        > No. They might not even be connected to the internet when they close
        > the browser.
        >[color=green]
        > > 2: I've succesfully been able to ask the user to confirm whether he
        > > wants to extend his session before it ends due to inactivity. This
        > > works perfectly and my question is: if the user is not there to answer
        > > the question is there any way to automaticaly end the session after 1
        > > minutes without any answer???[/color]
        >
        > Probably. Don't use a modal confirm dialog, though. You have no way
        > of making that go away after one minute. If you use HTML to pose
        > the question, you can remove it again, and then do whatever you want.
        >
        > I.e., something like:
        > ---
        > /**
        > * text : text to display for yes/no answer
        > * onYes : optional, function called if yes chosen
        > * onNo : optional, function called if no chosen
        > * timeout : optional, time in milliseconds before defaulting
        > * timeoutDefault: optional, default answer for timeout
        > *
        > * Don't omit both onYes and onNo.
        > */
        > function myConfirm(text, onYes,onNo,time out,timeoutDefa ult) {
        > var div = document.create Element("div");
        > div.style.borde r = "3px grey outset";
        > div.style.width ="8em";
        > div.style.heigh t="6em";
        > div.style.backg round = "grey";
        > div.style.posit ion = "absolute"; // or use fixed
        > div.style.left = "10em";
        > div.style.top = "10em"; // do something to make sure it is visible
        > var p = document.create Element("p");
        > p.appendChild(d ocument.createT extNode(text));
        > div.appendChild (p);
        > var div2 = document.create Element("div");
        > div2.style.text Align = "center";
        > var butYes = document.create Element("input" );
        > butYes.style.ma rgin="0px 5px";
        > butYes.type="bu tton";
        > butYes.value="Y es";
        > butYes.onclick= function(){acti on(true);};
        > var butNo = document.create Element("input" );
        > butNo.style.mar gin="0px 5px";
        > butNo.type="but ton";
        > butNo.value="No ";
        > butNo.onclick= function(){acti on(false);};
        > div2.appendChil d(butYes);
        > div2.appendChil d(butNo);
        > div.appendChild (div2);
        > div.style.zInde x = 1;
        > document.body.a ppendChild(div) ;
        > if (timeout) {
        > var timer = setTimeout(func tion(){action(t imeoutDefault); },timeout);
        > }
        > function action(choice) {
        > clearTimeout(ti mer);
        > document.body.r emoveChild(div) ;
        > if (choice) { if (onYes) {onYes();}}
        > else { if (onNo) {onNo();} }
        > }
        > }
        > ---
        > You can call it as, e.g.,:
        > ---
        > myConfirm("Are you sure?",
        > function(){aler t("yes");},func tion(){alert("n o");},
        > 5000,true);
        > ---
        > You should do something more to make sure the dialogue is visible, even
        > if the page is scrolled down.
        >
        > You can save code space by having the confirm HTML already in the page,
        > and just changing the actions and text.
        >
        > /L[/color]

        Comment

        • HolaGoogle

          #5
          Re: YET ANOTHER QUESTION ON SESSION TIMEOUT AND SESSION_ONEND()

          Hi Lasse,

          étried your suggestion but it doesn't work for me. my browser doesn't
          do anything...well it's ok...i try to fin some other solution....
          thanks a lot though!

          Lasse Reichstein Nielsen <lrn@hotpop.com > wrote in message news:<ptfq4uk4. fsf@hotpop.com> ...[color=blue]
          > holaasp@yahoo.c om (HolaGoogle) writes:
          >[color=green]
          > > hi there,
          > > i've 2 questions for you guys....
          > > 1: is there any way to "force" a session_onend() , session timeout or
          > > at least call my logout method when a user leaves the application
          > > window without logging out? i.e: using the "X" in the right corner???[/color]
          >
          > No. They might not even be connected to the internet when they close
          > the browser.
          >[color=green]
          > > 2: I've succesfully been able to ask the user to confirm whether he
          > > wants to extend his session before it ends due to inactivity. This
          > > works perfectly and my question is: if the user is not there to answer
          > > the question is there any way to automaticaly end the session after 1
          > > minutes without any answer???[/color]
          >
          > Probably. Don't use a modal confirm dialog, though. You have no way
          > of making that go away after one minute. If you use HTML to pose
          > the question, you can remove it again, and then do whatever you want.
          >
          > I.e., something like:
          > ---
          > /**
          > * text : text to display for yes/no answer
          > * onYes : optional, function called if yes chosen
          > * onNo : optional, function called if no chosen
          > * timeout : optional, time in milliseconds before defaulting
          > * timeoutDefault: optional, default answer for timeout
          > *
          > * Don't omit both onYes and onNo.
          > */
          > function myConfirm(text, onYes,onNo,time out,timeoutDefa ult) {
          > var div = document.create Element("div");
          > div.style.borde r = "3px grey outset";
          > div.style.width ="8em";
          > div.style.heigh t="6em";
          > div.style.backg round = "grey";
          > div.style.posit ion = "absolute"; // or use fixed
          > div.style.left = "10em";
          > div.style.top = "10em"; // do something to make sure it is visible
          > var p = document.create Element("p");
          > p.appendChild(d ocument.createT extNode(text));
          > div.appendChild (p);
          > var div2 = document.create Element("div");
          > div2.style.text Align = "center";
          > var butYes = document.create Element("input" );
          > butYes.style.ma rgin="0px 5px";
          > butYes.type="bu tton";
          > butYes.value="Y es";
          > butYes.onclick= function(){acti on(true);};
          > var butNo = document.create Element("input" );
          > butNo.style.mar gin="0px 5px";
          > butNo.type="but ton";
          > butNo.value="No ";
          > butNo.onclick= function(){acti on(false);};
          > div2.appendChil d(butYes);
          > div2.appendChil d(butNo);
          > div.appendChild (div2);
          > div.style.zInde x = 1;
          > document.body.a ppendChild(div) ;
          > if (timeout) {
          > var timer = setTimeout(func tion(){action(t imeoutDefault); },timeout);
          > }
          > function action(choice) {
          > clearTimeout(ti mer);
          > document.body.r emoveChild(div) ;
          > if (choice) { if (onYes) {onYes();}}
          > else { if (onNo) {onNo();} }
          > }
          > }
          > ---
          > You can call it as, e.g.,:
          > ---
          > myConfirm("Are you sure?",
          > function(){aler t("yes");},func tion(){alert("n o");},
          > 5000,true);
          > ---
          > You should do something more to make sure the dialogue is visible, even
          > if the page is scrolled down.
          >
          > You can save code space by having the confirm HTML already in the page,
          > and just changing the actions and text.
          >
          > /L[/color]

          Comment

          Working...