當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Frontend::getUser方法代碼示例

本文整理匯總了PHP中Frontend::getUser方法的典型用法代碼示例。如果您正苦於以下問題:PHP Frontend::getUser方法的具體用法?PHP Frontend::getUser怎麽用?PHP Frontend::getUser使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Frontend的用法示例。


在下文中一共展示了Frontend::getUser方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: checkLoginFromAdmin

function checkLoginFromAdmin($userid_from_zend)
{
    $front = Frontend::getInstance();
    if (isset($userid_from_zend) && $userid_from_zend != "" && $userid_from_zend != -2) {
        //echo "0*".$userid_from_zend."*";
        $user_id = (int) $userid_from_zend;
        if ($user_id == 0) {
            die("Admin session expired");
        }
        if ($front->isUserLoggedIn() && isset($_SESSION["userid"]) && $_SESSION["userid"] != 0 && $_SESSION["userid"] == $user_id) {
            // already logged nothing to do
        } else {
            if ($front->isUserLoggedIn() && isset($_SESSION["userid"]) && $_SESSION["userid"] != 0 && $_SESSION["userid"] != $user_id) {
                die("You are logged in Love application with another userid in this session. Please, logout from Love application!" . $_SESSION["userid"] . "**" . $user_id);
            } else {
                $sql = "SELECT " . USERS . ".*, " . COMPANY . ".name as company_name  " . "FROM " . USERS . ", " . COMPANY . " " . "WHERE " . USERS . ".id = " . mysql_real_escape_string($user_id) . " AND " . USERS . ".company_id = " . COMPANY . ".id";
                $row = doQuery($sql);
                $username = $row->username;
                $nickname = $row->nickname;
                //           $admin = $row->admin;
                $_SESSION["userid"] = $user_id;
                $_SESSION["username"] = $username;
                $_SESSION["nickname"] = $nickname;
                //         $_SESSION["admin"] = $admin;
                $_SESSION['running'] = "true";
                if (!$front->isUserLoggedIn()) {
                    $front = new Frontend();
                    if (!$front->isUserLoggedIn()) {
                        clearSession();
                        die("You are still not logged! Click on another tab, and come back back here it could work");
                    }
                }
                if (!isAdmin($user_id)) {
                    clearSession();
                    die("You should have admin right to get access to this page." . $admin . "**" . USERS);
                }
            }
        }
    }
    if (!$front->isUserLoggedIn()) {
        clearSession();
        $front->getUser()->askUserToAuthenticate();
    }
    if (!isAdmin($_SESSION["userid"])) {
        clearSession();
        die("You should have admin right to get access to this page.");
    }
}
開發者ID:highfidelity,項目名稱:love,代碼行數:48,代碼來源:loginFromAdmin.php

示例2:

if (!$front->isUserLoggedIn()) {
    $pageURL = 'http';
    if ($_SERVER["HTTPS"] == "on") {
        $pageURL .= "s";
    }
    $pageURL .= "://";
    if ($_SERVER["SERVER_PORT"] != "80") {
        $pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"];
    } else {
        $pageURL .= $_SERVER["SERVER_NAME"];
    }
    die;
}
// supports outputting user
if (isset($_GET['user']) && isset($_GET['var'])) {
    echo "{$_GET['var']}.user = '" . $front->getUser()->getNickname() . "';\n";
    // support for just returning the username / logged in status for bookmarklet
    if (array_key_exists('userOnly', $_GET)) {
        exit;
    }
}
// supports outputting as variable assignment
if (isset($_GET['var']) && $_GET['var'] != '') {
    echo "{$_GET['var']}.emails = ";
}
// supports getting all records
if (isset($_GET['term']) && $_GET['term'] != '') {
    $q = mysql_real_escape_string(strtolower($_GET['term']));
} else {
    $q = '';
}
開發者ID:highfidelity,項目名稱:love,代碼行數:31,代碼來源:getemails.php


注:本文中的Frontend::getUser方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。