Local info on logout popup



  • I don't know if this has been asked before, if true please post a link to that thread. My search attempts gave me nothing.

    I want to embed some local content in that popup (weather information, traffic details, etc.). This should not be too difficult as I've locate the captive portal php file and modified it already (a small translation here and there). The difficult part is "moving" the logout script from on-click to on-popup-close. Can this be done? If true, can someone point me in the right direction?

    In laymen's terms I want the logout popup to contain local information and to disconnect the user when he clicks the close button.

    Sorry for my bad speling, English is not my native tongue.



  • you need to use onUnload javascript which will trigger when user close the windows. inside the javascript you need to post the form to logout the user.



  • Thank you very much, I'll try it and post the code if anyone is interested.



  • @praetor:

    Thank you very much, I'll try it and post the code if anyone is interested.

    yes I'm interested



  • ok, it seems I am not doing this right.

    I created a .js file and added the following to it

    
    function doIt() {
                     window.document.getElementById('form').submit();
                     alert('Ati fost deconectati de la Internet');
                    }
    
    

    then I modified the /usr/local/captiveportal/index.php file with:

    
        LogoutWin.document.write('');
        LogoutWin.document.write(' ');
        LogoutWin.document.write('  <title>WiFi Network :: Logout</title>');
        LogoutWin.document.write('  ');
        LogoutWin.document.write(' ');
        LogoutWin.document.write(' ');
        LogoutWin.document.write('  ');
        LogoutWin.document.write('   
    
    <form name="form" method="POST" action="{$logouturl}">');
        LogoutWin.document.write('    ');
        LogoutWin.document.write('    ');
        LogoutWin.document.write('   </form>
    
    ');
        LogoutWin.document.write('  ');
        LogoutWin.document.write(' ');
        LogoutWin.document.write('');
    
    

    The problem? I can close the window without it submitting anything (i.e. ctrl+alt+del -> kill process).



  • then I modified the /usr/local/captiveportal/index.php file with:

    LogoutWin.document.write('');
        LogoutWin.document.write('') ;
        LogoutWin.document.write('<title>Logout</title>') ;
        LogoutWin.document.write(' ');
        LogoutWin.document.write('') ;
        LogoutWin.document.write(' ');
        LogoutWin.document.write('') ;
        LogoutWin.document.write('Click the button below to disconnect

    ');
        LogoutWin.document.write('

    <form id="dologout" name="dologout" method="POST" action="{$logouturl}">');
        LogoutWin.document.write('');
        LogoutWin.document.write('');
        LogoutWin.document.write('</form>

    ');
        LogoutWin.document.write('');
        LogoutWin.document.write('');
        LogoutWin.document.close();

    /********************/
    I am sure 100%


Locked