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


PHP session_save_path函数代码示例

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


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

示例1: session_init

/**
 * Initialize session.
 * @param boolean $keepopen keep session open? The default is
 * 			to close the session after $_SESSION has been populated.
 * @uses $_SESSION
 */
function session_init($keepopen = false)
{
    $settings = new phpVBoxConfigClass();
    // Sessions provided by auth module?
    if (@$settings->auth->capabilities['sessionStart']) {
        call_user_func(array($settings->auth, $settings->auth->capabilities['sessionStart']), $keepopen);
        return;
    }
    // No session support? No login...
    if (@$settings->noAuth || !function_exists('session_start')) {
        global $_SESSION;
        $_SESSION['valid'] = true;
        $_SESSION['authCheckHeartbeat'] = time();
        $_SESSION['admin'] = true;
        return;
    }
    // start session
    session_start();
    // Session is auto-started by PHP?
    if (!ini_get('session.auto_start')) {
        ini_set('session.use_trans_sid', 0);
        ini_set('session.use_only_cookies', 1);
        // Session path
        if (isset($settings->sessionSavePath)) {
            session_save_path($settings->sessionSavePath);
        }
        session_name(isset($settings->session_name) ? $settings->session_name : md5('phpvbx' . $_SERVER['DOCUMENT_ROOT'] . $_SERVER['HTTP_USER_AGENT']));
        session_start();
    }
    if (!$keepopen) {
        session_write_close();
    }
}
开发者ID:rgooler,项目名称:personal-puppet,代码行数:39,代码来源:utils.php

示例2: setup

 public static function setup()
 {
     $session_conf = (array) \Gini\Config::get('system.session');
     $cookie_params = (array) $session_conf['cookie'];
     $session_name = $session_conf['name'] ?: 'gini-session';
     $host_hash = sha1($cookie_params['domain'] ?: $_SERVER['HTTP_HOST']);
     ini_set('session.name', $session_name . '_' . $host_hash);
     if ($session_conf['save_handler']) {
         self::$_handlerName = $session_conf['save_handler'];
         // save_handler = internal/files
         if (0 == strncmp(self::$_handlerName, 'internal/', 9)) {
             ini_set('session.save_handler', substr(self::$_handlerName, 9));
         } else {
             // save_handler = Database
             $class = '\\Gini\\Session\\' . self::$_handlerName;
             if (class_exists($class)) {
                 self::$_handler = \Gini\IoC::construct($class);
                 session_set_save_handler(self::$_handler, false);
             }
         }
     }
     if ($session_conf['save_path']) {
         session_save_path($session_conf['save_path']);
     }
     if ($session_conf['gc_maxlifetime']) {
         ini_set('session.gc_maxlifetime', $session_conf['gc_maxlifetime']);
     }
     if (isset($_POST['gini-session'])) {
         session_id($_POST['gini-session']);
     } elseif (isset($_SERVER['HTTP_X_GINI_SESSION'])) {
         session_id($_SERVER['HTTP_X_GINI_SESSION']);
     }
     session_set_cookie_params($cookie_params['lifetime'], $cookie_params['path'], $cookie_params['domain']);
     self::open();
 }
开发者ID:iamfat,项目名称:gini,代码行数:35,代码来源:Session.php

示例3: __construct

 /**
  * Constructor of SessionContext, init session and set session file path
  *
  * @return void
  **/
 function __construct()
 {
     if (defined('SESSION_PATH')) {
         session_save_path(SESSION_PATH);
     }
     if (is_writable(session_save_path())) {
         if (!defined('CLI') || CLI == 0) {
             session_start();
         }
     } else {
         // we cannot write in the session save path; aborting
         die("Unable to write in the session save path [" . session_save_path() . "]");
     }
     // retrieve objects data
     if (defined('SESSION_PATH')) {
         $this->_sessObjFileName = SESSION_PATH . "/" . session_id() . "_obj";
     }
     // record access time
     $curTime = time();
     if (isset($_SESSION["LastAccessTime"])) {
         $this->_lastAccessTime = $_SESSION["LastAccessTime"];
     } else {
         $this->_lastAccessTime = $curTime;
     }
     $_SESSION["LastAccessTime"] = $curTime;
     // see if timeout
     $this->_timeOut = false;
     if (TIMEOUT > 0 && $curTime - $this->_lastAccessTime > TIMEOUT) {
         $this->_timeOut = true;
     }
 }
开发者ID:que273,项目名称:siremis,代码行数:36,代码来源:SessionContext.php

示例4: __construct

 protected function __construct()
 {
     /* Call the parent constructor in case it should become
      * necessary in the future.
      */
     parent::__construct();
     /* Initialize the php session handling.
      *
      * If session_id() returns a blank string, then we need
      * to call session start. Otherwise the session is already
      * started, and we should avoid calling session_start().
      */
     if (session_id() === '') {
         $config = SimpleSAML_Configuration::getInstance();
         $params = $this->getCookieParams();
         $version = explode('.', PHP_VERSION);
         if ((int) $version[0] === 5 && (int) $version[1] < 2) {
             session_set_cookie_params($params['lifetime'], $params['path'], $params['domain'], $params['secure']);
         } else {
             session_set_cookie_params($params['lifetime'], $params['path'], $params['domain'], $params['secure'], $params['httponly']);
         }
         $this->cookie_name = $config->getString('session.phpsession.cookiename', NULL);
         if (!empty($this->cookie_name)) {
             session_name($this->cookie_name);
         } else {
             $this->cookie_name = session_name();
         }
         $savepath = $config->getString('session.phpsession.savepath', NULL);
         if (!empty($savepath)) {
             session_save_path($savepath);
         }
     }
 }
开发者ID:williamamed,项目名称:Raptor2,代码行数:33,代码来源:SessionHandlerPHP.php

示例5: run

 function run($config)
 {
     try {
         //session设置,控制访问
         if (isset($config['session']) && !empty($config['session'])) {
             if (is_string($config['session'])) {
                 session_save_path(__DIR__ . '/' . $config['session']);
             }
             if (!isset($_SESSION)) {
                 session_start();
             }
             if (!isset($_SESSION['admin'])) {
                 throw new Exception('你没有文件管理权限.');
             }
         }
         if (!file_exists('YesFinder.class.php')) {
             throw new Exception('主文件YesFinder.class.php丢失了.');
         }
         require 'YesFinder.class.php';
         $app = new YesFinder($config);
         if (!method_exists($app, $this->action)) {
             throw new Exception("请求无效," . $this->action . " 不存在");
         }
         $data = call_user_func_array(array($app, $this->action), $this->params);
     } catch (Exception $e) {
         $data['error'] = $e->getMessage();
     }
     $this->output($data);
 }
开发者ID:steven-ye,项目名称:YesFinder,代码行数:29,代码来源:Connector.class.php

示例6: open

 /**
  * Open a session
  *
  * @access public
  * @param  string   $base_path    Cookie path
  * @param  string   $save_path    Custom session save path
  */
 public function open($base_path = '/', $save_path = '')
 {
     if ($save_path !== '') {
         session_save_path($save_path);
     }
     // HttpOnly and secure flags for session cookie
     session_set_cookie_params(self::SESSION_LIFETIME, $base_path ?: '/', null, Tool::isHTTPS(), true);
     // Avoid session id in the URL
     ini_set('session.use_only_cookies', '1');
     // Ensure session ID integrity
     ini_set('session.entropy_file', '/dev/urandom');
     ini_set('session.entropy_length', '32');
     ini_set('session.hash_bits_per_character', 6);
     // If session was autostarted with session.auto_start = 1 in php.ini destroy it, otherwise we cannot login
     if (isset($_SESSION)) {
         session_destroy();
     }
     // Custom session name
     session_name('__S');
     session_start();
     // Regenerate the session id to avoid session fixation issue
     if (empty($_SESSION['__validated'])) {
         session_regenerate_id(true);
         $_SESSION['__validated'] = 1;
     }
 }
开发者ID:cvalenti,项目名称:kanboard,代码行数:33,代码来源:Session.php

示例7: __construct

 public function __construct($config = null)
 {
     if (!isset($config['savePath'])) {
         $config['savePath'] = session_save_path();
     }
     $this->_config = $config;
 }
开发者ID:quyenminh102,项目名称:flywheel-framework,代码行数:7,代码来源:File.php

示例8: session_start_session

function session_start_session()
{
    global $cfg;
    session_save_path($cfg['SESSION_SAVE_PATH']);
    session_name("UAPORTAL");
    session_start();
}
开发者ID:agatho,项目名称:uaenhanced,代码行数:7,代码来源:session.inc.php

示例9: doTest

 function doTest()
 {
     $handler = ini_get("session.save_handler");
     if ($handler != "files") {
         $this->testedParams["Session Save Path"] = "Handler is not file based";
         return TRUE;
     }
     $tmpDir = session_save_path();
     $this->testedParams["Session Save Path"] = $tmpDir;
     if ($tmpDir != "") {
         $this->testedParams["Session Save Path Writeable"] = @is_writable($tmpDir);
         if (!$this->testedParams["Session Save Path Writeable"]) {
             $this->failedLevel = "error";
             $this->failedInfo = "The temporary folder used by PHP to save the session data is either incorrect or not writeable! Please check : " . session_save_path();
             $this->failedInfo .= "<p class='suggestion'><b>Suggestion</b> : create your own temporary folder for sessions and set the session.save_path parameter in the conf/bootstrap_conf.php</p>";
             return FALSE;
         }
     } else {
         $this->failedLevel = "warning";
         $this->failedInfo = "Warning, it seems that your temporary folder used to save session data is not set. If you are encountering troubles with logging and sessions, please check session.save_path in your php.ini. Otherwise you can ignore this.";
         return FALSE;
     }
     $this->failedLevel = "info";
     return FALSE;
 }
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:25,代码来源:test.PHPSession.php

示例10: __construct

 public function __construct($output = true)
 {
     ini_set('date.timezone', 'GMT');
     $this->initClasses();
     session_save_path($this->config->get('core.session'));
     session_start();
     $this->loadUser();
     if ($output) {
         $in_redirect_endpoint = false;
         $redirect_endpoints = ['preregister', 'banned', 'account/terms', 'account/settings', 'account/login', 'account/logout'];
         foreach ($redirect_endpoints as $endpoint) {
             if (strpos($_SERVER['REQUEST_URI'], $endpoint) !== false) {
                 $in_redirect_endpoint = true;
             }
         }
         $this->logger->log($_SERVER['REQUEST_URI'], 'DEBUG');
         if ($this->config->get('mode') == 'preregistration' && !$in_redirect_endpoint) {
             $this->output->redirect('/preregister');
         }
         if ($this->user->isLoggedIn() && $this->user->isRank('Banned') && !$in_redirect_endpoint) {
             $this->output->redirect('/banned');
         } elseif ($this->user->isLoggedIn() and $this->user->tos_agree == 0 && !$in_redirect_endpoint) {
             $this->output->redirect('/account/terms');
         } elseif ($this->user->isLoggedIn() && empty($this->user->trade_url) && !$in_redirect_endpoint) {
             $this->output->redirect('/account/settings');
         }
         $this->router->resolve();
     }
 }
开发者ID:puttyplayer,项目名称:CSGOShop,代码行数:29,代码来源:CSGOShop.class.php

示例11: SetID

 /**
  * set session ID
  *
  * @param $sessionid
  *
  * @return mixed
  */
 public static function SetID($sessionid)
 {
     $file = session_save_path() . "/sess_" . $sessionid;
     if (file_exists($file)) {
         session_id($sessionid);
     }
 }
开发者ID:shalvasoft,项目名称:MVC,代码行数:14,代码来源:sessions.php

示例12: initializeCAS

 private function initializeCAS()
 {
     $casClient = new \CAS_Client(CAS_VERSION_2_0, true, Config::get('cas.hostname'), Config::get('cas.port'), Config::get('cas.context'));
     $casClient->setNoCasServerValidation();
     if (true === Config::get('pgtservice.enabled', false)) {
         $casClient->setCallbackURL(Config::get('pgtservice.callback'));
         $casClient->setPGTStorage(new ProxyTicketServiceStorage($casClient));
     } else {
         if (false !== Config::get('redis.hostname', false)) {
             $casClient->setCallbackURL($this->url->getURL() . '/callback.php');
             $redis = new \Redis();
             $redis->connect(Config::get('redis.hostname'), Config::get('redis.port', 6379), 2, null, 100);
             $redis->setOption(\Redis::OPT_SERIALIZER, \Redis::SERIALIZER_PHP);
             $redis->setOption(\Redis::OPT_PREFIX, Config::get('application.project_name') . ':PHPCAS_TICKET_STORAGE:');
             $redis->select((int) Config::get('redis.hostname', 2));
             $casClient->setPGTStorage(new RedisTicketStorage($casClient, $redis));
         } else {
             $casClient->setCallbackURL($this->url->getURL() . '/callback.php');
             $casClient->setPGTStorageFile(session_save_path());
             // Handle logout requests but do not validate the server
             $casClient->handleLogoutRequests(false);
         }
     }
     // Accept all proxy chains
     $casClient->getAllowedProxyChains()->allowProxyChain(new \CAS_ProxyChain_Any());
     return $casClient;
 }
开发者ID:GlobalTechnology,项目名称:mpd-dashboard-app,代码行数:27,代码来源:ApplicationWrapper.php

示例13: auth

/**
 *	Check if user is authorized
 *
 *	@return boolean true if access granted, false if no access
 */
function auth()
{
    $cwd = getcwd();
    chdir(dirname(dirname(dirname(dirname(dirname(__DIR__))))));
    if (!defined('EP3_BS_DEV')) {
        define('EP3_BS_DEV', false);
    }
    $config = (require 'config/autoload/global.php');
    $sessionName = $config['session_config']['name'];
    $sessionPath = $config['session_config']['save_path'];
    if (isset($_COOKIE[$sessionName])) {
        require 'vendor/zendframework/zendframework/library/Zend/Stdlib/Exception/ExceptionInterface.php';
        require 'vendor/zendframework/zendframework/library/Zend/Stdlib/Exception/InvalidArgumentException.php';
        require 'vendor/zendframework/zendframework/library/Zend/Stdlib/ArrayObject.php';
        session_name($sessionName);
        session_save_path($sessionPath);
        session_start();
        chdir($cwd);
        if (isset($_SESSION['UserSession'])) {
            $userSession = $_SESSION['UserSession'];
            if ($userSession && $userSession instanceof Zend\Stdlib\ArrayObject) {
                if ($userSession->uid && is_numeric($userSession->uid) && $userSession->uid > 0) {
                    if ($userSession->status && ($userSession->status == 'assist' || $userSession->status == 'admin')) {
                        return true;
                    }
                }
            }
        }
    }
    return false;
}
开发者ID:Bertie1708,项目名称:ep3-bs,代码行数:36,代码来源:user.config.php

示例14: __construct

 public function __construct($Ethna_Backend)
 {
     $appid = $Ethna_Backend->getAppId();
     session_save_path($Ethna_Backend->getTmpdir());
     session_name($appid . 'SESSID');
     return parent::__construct(array('session_name' => $appid . 'SESSID'));
 }
开发者ID:remixgrjp,项目名称:captcha,代码行数:7,代码来源:Ethna_Securimage.php

示例15: __construct

 function __construct($config)
 {
     if (!$config || !is_array($config)) {
         $config["id"] = "PHPSESSID";
         $config["path"] = "./data/session/";
         $config["timeout"] = 3600;
     }
     $this->config($config);
     $sid = $config["id"] ? $config["id"] : "PHPSESSION";
     session_name($sid);
     $this->sid = $sid;
     $session_id = isset($_POST[$sid]) ? $_POST[$sid] : (isset($_GET[$sid]) ? $_GET[$sid] : "");
     if ($session_id && preg_match("/^[a-z0-9A-Z\\_\\-]+\$/u", $session_id)) {
         session_id($session_id);
         $this->sessid = $session_id;
     } else {
         $this->sessid = session_id();
     }
     session_save_path($config["path"]);
     $this->config = $config;
     $this->timeout = $config["timeout"] ? $config["timeout"] : 600;
     session_cache_expire(intval($this->timeout) / 60);
     session_cache_limiter('public');
     session_start();
 }
开发者ID:joyerma,项目名称:yongzhuo,代码行数:25,代码来源:file.php


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