當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。