Changeset 99

Show
Ignore:
Timestamp:
2007-12-12 16:53:32 (1 year ago)
Author:
hannes
Message:

authentication codes (guest passwords) are valid only on the page following the one which they've been set (ticket #39)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/classes/misc/Authcode.php

    r76 r99  
    4343        // remove auth code from session since it's no longer needed 
    4444        unset($_SESSION['pw']); 
     45        unset($_SESSION['pw_page']); 
    4546    } /* function destroy */ 
    4647 
     
    5960        // put into session 
    6061        $_SESSION['pw'] = $p->get(); 
     62        // remember number of page this was written 
     63        $_SESSION['pw_page'] = $_SESSION['page']; 
    6164    } /* function generate */ 
    6265 
  • trunk/classes/pages/Page.php

    r70 r99  
    5151        // get current timestamp (microseconds) for execution time 
    5252        $this->exec_time_start = microtime(TRUE); 
     53        // check if auth code in session is set 
     54        if (isset($_SESSION['pw']) && $_SESSION['pw'] != '') { 
     55            // check if it's still valid 
     56            if ($_SESSION['pages'] > $_SESSION['pw_page'] + 1) { 
     57                // has been set longer ago than the previous page -> remove 
     58                $auth = new Authcode(); 
     59                $auth->destroy(); 
     60                unset($auth); 
     61            } 
     62        } 
    5363        /* Have some kind of manual per-page login credentials been posted? 
    5464         * This shouldn't be checked on 'Userpanel' page, because there is a special handling of that there. */