コード例 #1
0
    $a = 998;
    if ($a != 1) {
        // web users are stored with negative id
        $sql = "REPLACE INTO " . $modx->getFullTableName('active_users') . " (internalKey, username, lasthit, action, id, ip) values(-{$_SESSION['webInternalKey']}, '{$_SESSION['webShortname']}', '{$lasthittime}', '{$a}', {$itemid}, '{$ip}')";
        $modx->db->query($sql);
    }
}
// invoke OnWebLogin event
$modx->invokeEvent("OnWebLogin", array("userid" => $internalKey, "username" => $username, "userpassword" => $givenPassword, "rememberme" => $_POST['rememberme']));
// redirect
if (isset($_REQUEST['refurl']) && !empty($_REQUEST['refurl'])) {
    // last accessed page
    $targetPageId = urldecode($_REQUEST['refurl']);
    if (strpos($targetPageId, 'q=') !== false) {
        $urlPos = strpos($targetPageId, 'q=') + 2;
        $alias = substr($targetPageId, $urlPos);
        $aliasLength = strpos($alias, '&') ? strpos($alias, '&') : strlen($alias);
        $alias = substr($alias, 0, $aliasLength);
        $url = $modx->config['base_url'] . $alias;
    } elseif (intval($targetPageId)) {
        $url = preserveUrl($targetPageId);
    } else {
        $url = urldecode($_REQUEST['refurl']);
    }
    $modx->sendRedirect($url);
} else {
    // login home page
    $url = preserveUrl($id);
    $modx->sendRedirect($url);
}
return;
コード例 #2
0
ファイル: weblogin.inc.php プロジェクト: Fess7/evolution
            } else {
                $ip = "UNKNOWN";
            }
        }
    }
    $_SESSION['ip'] = $ip;
    $itemid = isset($_REQUEST['id']) && is_numeric($_REQUEST['id']) ? $_REQUEST['id'] : 'NULL';
    $lasthittime = time();
    $a = 998;
    if ($a != 1) {
        $sql = "REPLACE INTO " . $modx->getFullTableName('active_users') . " (internalKey, username, lasthit, action, id, ip) values(-{$_SESSION['webInternalKey']}, '{$_SESSION['webShortname']}', '{$lasthittime}', '{$a}', {$itemid}, '{$ip}')";
        $modx->db->query($sql);
    }
    // display logout
    $tpl = $tpls[1];
    $url = preserveUrl($modx->documentObject['id']);
    $url = $url . (strpos($url, "?") === false ? "?" : "&") . "webloginmode=lo";
    $tpl = str_replace("[+action+]", $url, $tpl);
    $tpl = str_replace("[+logouttext+]", $logoutText, $tpl);
    $output .= $tpl;
}
# Returns Default WebLogin tpl
function getWebLogintpl()
{
    ob_start();
    ?>
    <!-- #declare:separator <hr> -->
    <!-- login form section-->
    <form method="post" name="loginfrm" action="[+action+]" style="margin: 0px; padding: 0px;">
    <input type="hidden" value="[+rememberme+]" name="rememberme" />
    <table border="0" cellspacing="0" cellpadding="0">