/**
 * Log the user out
 *
 * @public
 * @return bool true if the user successfully logged out, false otherwise
 */
function pnUserLogOut()
{
    if (pnUserLoggedIn()) {
        $dbconn =& pnDBGetConn(true);
        $pntable =& pnDBGetTables();
        // Reset user session information (new table)
        $sessioninfocolumn =& $pntable['session_info_column'];
        $sessioninfotable = $pntable['session_info'];
        $query = "UPDATE {$sessioninfotable}\n                  SET {$sessioninfocolumn['uid']} = 0\n                  WHERE {$sessioninfocolumn['sessid']} = '" . pnVarPrepForStore(session_id()) . "'";
        $dbconn->Execute($query);
        pnSessionDelVar('rememberme');
        pnSessionDelVar('uid');
        pnSessionDestroy(session_id());
    }
}
Beispiel #2
0
/**
 * get status message from previous operation
 * <br>
 * Obtains any status message, and also destroys
 * it from the session to prevent duplication
 * @returns string
 * @return the status message
 */
function pnGetStatusMsg()
{
    $msg = pnSessionGetVar('statusmsg');
    pnSessionDelVar('statusmsg');
    $errmsg = pnSessionGetVar('errormsg');
    pnSessionDelVar('errormsg');
    // Error message overrides status message
    if (!empty($errmsg)) {
        return $errmsg;
    }
    return $msg;
}