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


PHP controller::sessionStart方法代码示例

本文整理汇总了PHP中controller::sessionStart方法的典型用法代码示例。如果您正苦于以下问题:PHP controller::sessionStart方法的具体用法?PHP controller::sessionStart怎么用?PHP controller::sessionStart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在controller的用法示例。


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

示例1: checkLogin

 public function checkLogin($close = true)
 {
     //Warning, sessions enabled, disable them after check, $_SESSION is in read only mode after disable
     parent::sessionStart();
     $this->userIsLogged = isset($_SESSION['cid']) && !empty($_SESSION['cid']);
     $this->userMail = isset($_SESSION['cid']) && !empty($_SESSION['cid']) ? $_SESSION['cid'] : null;
     $this->uid = isset($_SESSION['uid']) && !empty($_SESSION['uid']) ? $_SESSION['uid'] : null;
     if ($close) {
         parent::disableSessions();
     }
 }
开发者ID:indynagpal,项目名称:MateCat,代码行数:11,代码来源:ajaxController.php

示例2: __construct

 /**
  * Class constructor
  *
  * @param bool $isAuthRequired
  */
 public function __construct($isAuthRequired = false)
 {
     if (!parent::isRightVersion()) {
         header("Location: " . INIT::$HTTPHOST . INIT::$BASEURL . "badConfiguration", true, 303);
         exit;
     }
     //SESSION ENABLED
     parent::sessionStart();
     //load Template Engine
     require_once INIT::$ROOT . '/inc/PHPTAL/PHPTAL.php';
     $this->supportedBrowser = $this->isSupportedWebBrowser();
     //try to get user name from cookie if it is not present and put it in session
     if (empty($_SESSION['cid'])) {
         //log::doLog(get_class($this)." requires check for login");
         $username_from_cookie = AuthCookie::getCredentials();
         if ($username_from_cookie) {
             $_SESSION['cid'] = $username_from_cookie['username'];
             $_SESSION['uid'] = $username_from_cookie['uid'];
         }
     }
     //even if no login in required, if user data is present, pull it out
     if (!empty($_SESSION['cid'])) {
         $userSearch = new Users_UserStruct();
         $userSearch->email = $_SESSION['cid'];
         $userDao = new Users_UserDao(Database::obtain());
         $userObject = $userDao->read($userSearch);
         /**
          * @var $userObject Users_UserStruct
          */
         $userObject = $userObject[0];
         //            $this->logged_user = getUserData( $_SESSION[ 'cid' ] );
         $this->logged_user = $userObject;
     }
     if ($isAuthRequired) {
         //if auth is required, stat procedure
         $this->doAuth();
     }
 }
开发者ID:indynagpal,项目名称:MateCat,代码行数:43,代码来源:viewController.php


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