当前位置: 首页>>代码示例>>PHP>>正文


PHP isLoggedIn函数代码示例

本文整理汇总了PHP中isLoggedIn函数的典型用法代码示例。如果您正苦于以下问题:PHP isLoggedIn函数的具体用法?PHP isLoggedIn怎么用?PHP isLoggedIn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了isLoggedIn函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: userName

function userName()
{
    if (isLoggedIn()) {
        return $_SESSION['username'];
    } else {
        return '';
    }
}
开发者ID:r0the,项目名称:paedawan,代码行数:8,代码来源:session.php

示例2: action

 /**
  * Function renders main page and implements user login behaviour.
  * If user is already logged in, he will be redirected to his twitter wall.
  * If user doesn't exist or entered data is wrong, warning message will show.
  */
 public function action()
 {
     if (isLoggedIn()) {
         redirect(\route\Route::get("twitterWall")->generate(array("id" => UserRepository::getIdByUsername($_SESSION['username']))));
     }
     $main = new Main();
     $main->setPageTitle("Twitter App");
     $body = new \templates\Index();
     $main->setBody($body);
     echo $main;
     if (UserRepository::isLoggedIn()) {
         redirect(\route\Route::get("twitterWall")->generate());
     }
     if (post('login')) {
         $username = htmlentities(trim(post('username')));
         $password = htmlentities(trim(post('password')));
         $hashedPassword = hash_password($password);
         if (UserRepository::login($username, $hashedPassword)) {
             redirect(\route\Route::get("twitterWall")->generate(array("id" => UserRepository::getIdByUsername($_SESSION['username']))));
             exit;
         } else {
             ?>
             <script src="assets/js/loginError.js"></script>
             <?php 
         }
     }
 }
开发者ID:chiiiro,项目名称:SSP-TwitterApp,代码行数:32,代码来源:Index.php

示例3: redirect

function redirect($page)
{
    $currentPage = basename($_SERVER['PHP_SELF']);
    // prevent redirecting away from graphs.php when $.post is accessing
    if ($currentPage == 'graphs.php' || $currentPage == 'verify.php') {
        if ($_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest') {
            header('Location: /fp2.0/');
            exit;
        }
    } else {
        if ($currentPage != $page) {
            if ($page == 'index.php') {
                $page = '';
            }
            // make sure index.php is not included so that the url is shorter
            if (!isLoggedIn()) {
                header("Location: login.php");
                exit;
            } else {
                if ($currentPage != 'monthlyReport.php' && $currentPage != 'settings.php') {
                    header("Location: /fp2.0/" . $page);
                    exit;
                }
            }
        }
    }
}
开发者ID:HomerGaidarski,项目名称:Gunter-Hans-Transaction-Reports,代码行数:27,代码来源:session.php

示例4: handleCookies

 function handleCookies()
 {
     // if no session lets check for cookies
     if (!isLoggedIn()) {
         if (isset($_COOKIE["urika_userlogin"]) == true && isset($_COOKIE["urika_login_tried"]) == false) {
             $CI =& get_instance();
             $CI->load->model("user_model");
             $query = $CI->user_model->getUser($_COOKIE["urika_userlogin"], "u_username");
             if ($query) {
                 // now verify secret before creating session
                 $row = $query->row();
                 if (isset($_COOKIE["urika_usersecret"]) && md5($row->u_username . $row->u_password) == $_COOKIE["urika_usersecret"]) {
                     // win lets make a session
                     $data = array('username' => $row->u_username, 'user_id' => $row->user_id, 'is_logged_in' => true, 'image_url' => getUserProfileURL($row->u_profile_id, $row->u_email));
                     $CI->session->set_userdata($data);
                 } else {
                     // no luck
                     setcookie("urika_login_tried", $_COOKIE["urika_userlogin"]);
                 }
             } else {
                 // no match, so et a cookie so we don't try over and over again
                 setcookie("urika_login_tried", $_COOKIE["urika_userlogin"]);
             }
         }
     }
 }
开发者ID:redroot,项目名称:URIKA,代码行数:26,代码来源:user_cookie.php

示例5: logout

function logout()
{
    if (isLoggedIn()) {
        unset($_SESSION['user']);
    }
    return true;
}
开发者ID:Tourepedia,项目名称:v1.1,代码行数:7,代码来源:userFunctions.php

示例6: find

 public function find()
 {
     if (!$this->uri->segment(3)) {
         show_404(current_url(), FALSE);
     } else {
         if ($this->data['Treasure'] = $this->treasure_model->get_by('md5', $this->uri->segment(3))) {
             if (isFound($this->data['Treasure']->id, $this->session->userdata('id'))) {
                 $found = TRUE;
             } else {
                 $found = FALSE;
                 if (isLoggedIn()) {
                     if (!isBanned($this->session->userdata('id'))) {
                         if (!isAdmin()) {
                             $this->mytreasure_model->insert(array('pirate' => $this->session->userdata('id'), 'treasure' => $this->data['Treasure']->id, 'time' => time()));
                         }
                     }
                 }
             }
             $this->data['found'] = $found;
             $this->template->write_view('content', 'views/treasure/find', $this->data);
             $this->template->render();
         } else {
             show_404(current_url(), FALSE);
         }
     }
 }
开发者ID:robertmain,项目名称:Treasure-Hunt,代码行数:26,代码来源:treasure.php

示例7: loggedin_user

 /**
  * Returns the current logged in user
  *
  * @return array|null
  */
 function loggedin_user()
 {
     //User is not lgged in
     if (!isLoggedIn()) {
         //we return null
         return null;
     }
     //Check if we have user id
     if (!isset($_SESSION['user_id']) || $_SESSION['user_id'] == '' || $_SESSION['user_id'] == null) {
         //Return null
         return null;
     }
     //Create new user object
     $user = new App\Models\User();
     //Get user id
     $user_id = $_SESSION['user_id'];
     //Get the user
     $results = $user->query("SELECT * FROM users WHERE id = '" . $user_id . "'");
     //We got the results
     if ($results != false) {
         //Return the current user row
         return $results[0];
     } else {
         //No user found
         //return null
         return null;
     }
 }
开发者ID:AshniSukhoo,项目名称:blog,代码行数:33,代码来源:helpers.php

示例8: getUsername

/**
 * Vraca korisnicko ime ako je korisnik ulogiran.
 */
function getUsername()
{
    if (isLoggedIn()) {
        return $_SESSION["username"];
    }
    return null;
}
开发者ID:chiiiro,项目名称:SSP-TwitterApp,代码行数:10,代码来源:functions.php

示例9: index

 function index($info = "")
 {
     $menuList[] = array('id' => 1, 'name' => $this->spTextPanel['Website Manager'], 'url_section' => 'websites');
     if (isAdmin()) {
         $menuList[] = array('id' => 2, 'name' => $this->spTextPanel['User Manager'], 'url_section' => 'users');
     }
     if (isLoggedIn()) {
         $menuList[] = array('id' => 3, 'name' => $this->spTextPanel['Reports Manager'], 'url_section' => 'report-manager');
     }
     if (isAdmin()) {
         $menuList[] = array('id' => 4, 'name' => $this->spTextPanel['Seo Tools Manager'], 'url_section' => 'seo-tools-manager');
         $menuList[] = array('id' => 5, 'name' => $this->spTextPanel['Seo Plugins Manager'], 'url_section' => 'seo-plugin-manager');
         $menuList[] = array('id' => 6, 'name' => $this->spTextPanel['Directory Manager'], 'url_section' => 'directory-manager');
         $menuList[] = array('id' => 11, 'name' => $this->spTextPanel['Search Engine Manager'], 'url_section' => 'se-manager');
         $menuList[] = array('id' => 9, 'name' => $this->spTextPanel['Proxy Manager'], 'url_section' => 'proxy-manager');
         $menuList[] = array('id' => 7, 'name' => $this->spTextPanel['System Settings'], 'url_section' => 'settings');
     }
     $menuList[] = array('id' => 8, 'name' => $this->spTextPanel['My Profile'], 'url_section' => 'my-profile');
     $menuList[] = array('id' => 10, 'name' => $this->spTextPanel['About Us'], 'url_section' => 'about-us');
     $menuSelected = empty($info['menu_selected']) ? 'websites' : urldecode($info['menu_selected']);
     $this->set('menuList', $menuList);
     $this->set('menuSelected', $menuSelected);
     $startScript = empty($info['start_script']) ? "websites.php" : urldecode($info['start_script']);
     if (!stristr($startScript, '.php')) {
         $startScript .= ".php";
     }
     $arguments = "";
     foreach ($info as $key => $value) {
         if (!in_array($key, array('menu_selected', 'start_script'))) {
             $arguments .= "&{$key}=" . urldecode($value);
         }
     }
     $this->set('startFunction', "scriptDoLoad('{$startScript}', 'content', '{$arguments}')");
     $this->render('adminpanel/adminpanel');
 }
开发者ID:codegooglecom,项目名称:seopanel,代码行数:35,代码来源:adminpanel.ctrl.php

示例10: listSeoTools

 function listSeoTools()
 {
     $userId = isLoggedIn();
     $seoToolList = $this->__getAllSeoTools();
     $this->set('list', $seoToolList);
     $this->render('seotools/listseotools');
 }
开发者ID:codegooglecom,项目名称:seopanel,代码行数:7,代码来源:seotools.ctrl.php

示例11: addVideo

?>

<?php 
function addVideo()
{
    if (isLoggedIn()) {
        if (hasCurrentUserRight("video")) {
开发者ID:tgassner,项目名称:Blechophon,代码行数:7,代码来源:videos.php

示例12: isAdmin

 /**
  * Determinate if user is admin
  *
  * @return boolean
  */
 public function isAdmin()
 {
     if (!isLoggedIn()) {
         return false;
     }
     return (bool) $this->user()->site_access;
 }
开发者ID:Codex-NG,项目名称:cornexaac,代码行数:12,代码来源:ForumPost.php

示例13: Factory

 public static function Factory($default_page = null, $requireLogin = true)
 {
     $prefs = UserPreferences::Instance(EGS_USERNAME);
     $default_page = $prefs->getPreferenceValue('default_page', 'shared');
     if ($default_page == null) {
         $ao = AccessObject::Instance();
         $default_page = 'module,' . $ao->getDefaultModule();
     }
     if (get_config('SETUP')) {
         if (defined('MODULE')) {
             $default_page = MODULE;
         }
     }
     $router = RouteParser::Instance();
     $modules = array();
     if (!$requireLogin || isLoggedIn()) {
         foreach ($router->getDispatch() as $key => $dispatch) {
             if (($key == 'group' || $key == 'module' || strstr($key, 'submodule')) && !empty($dispatch)) {
                 $modules[$key] = $dispatch;
             }
         }
         if (empty($modules)) {
             // Default page contains permission type and permission name
             // i.e. type is group or module
             $array = explode(',', $default_page);
             $modules[$array[0]] = $array[1];
         }
     } else {
         $modules['module'] = 'login';
     }
     $al =& AutoLoader::Instance();
     return $modules;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:33,代码来源:ModuleFactory.php

示例14: __construct

 public function __construct()
 {
     parent::__construct();
     ini_set('memory_limit', '-1');
     $this->domain = 'http://localhost/cookindo';
     $this->webroot = $_SERVER['DOCUMENT_ROOT'] . '/cookindo/';
     // $this->domain = 'http://'.$_SERVER['SERVER_NAME'];
     // $this->webroot = $_SERVER['DOCUMENT_ROOT'];
     if (isLoggedIn()) {
         if ($this->session->userdata('userpassword') == 'def' && strtolower($this->router->method) != 'completion' && strtolower($this->router->method) != 'logout') {
             $this->load->helper('url');
             redirect($this->domain . '/users/completion');
         }
         $resNotification = $this->db->query('CALL GetNotifications(?)', array($this->session->userdata('userid')));
         $notifications = $resNotification->result_array();
         $resNotification->next_result();
         $this->load->vars(array('notifications' => $notifications));
     }
     if ($this->session->userdata('redirect_now') == true) {
         $this->session->set_userdata('redirect_now', false);
         if (!empty($this->session->userdata('redirect_after'))) {
             $redirect_after = $this->session->userdata('redirect_after');
             $this->session->set_userdata('redirect_after', false);
             $this->load->helper('url');
             redirect($this->domain . '/' . $redirect_after);
         }
     }
     $this->site_lang = get_cookie('site_lang') ? get_cookie('site_lang') : 'indonesian';
     $this->lang->load($this->site_lang, $this->site_lang);
     $this->load->vars(array('domain' => $this->domain, 'webroot' => $this->webroot, 'site_lang' => $this->site_lang));
 }
开发者ID:angelamuliawan,项目名称:rd,代码行数:31,代码来源:AB_Controller.php

示例15: requireUser

function requireUser($b = true)
{
    if ($b && !isLoggedIn()) {
        warning('You need to login to view this page.');
        redirect($GLOBALS['sLoginPage'] . '?ref=' . str_replace('?logout=true', '', $_SERVER['REQUEST_URI']));
    }
}
开发者ID:prymribb,项目名称:starter,代码行数:7,代码来源:user.php


注:本文中的isLoggedIn函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。