本文整理汇总了PHP中session_write_close函数的典型用法代码示例。如果您正苦于以下问题:PHP session_write_close函数的具体用法?PHP session_write_close怎么用?PHP session_write_close使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了session_write_close函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: xoonips_session_regenerate
function xoonips_session_regenerate()
{
$old_sessid = session_id();
session_regenerate_id();
$new_sessid = session_id();
session_id($old_sessid);
session_destroy();
$old_session = $_SESSION;
session_id($new_sessid);
$sess_handler =& xoops_gethandler('session');
session_set_save_handler(array(&$sess_handler, 'open'), array(&$sess_handler, 'close'), array(&$sess_handler, 'read'), array(&$sess_handler, 'write'), array(&$sess_handler, 'destroy'), array(&$sess_handler, 'gc'));
session_start();
$_SESSION = array();
foreach (array_keys($old_session) as $key) {
$_SESSION[$key] = $old_session[$key];
}
// write and close session for xnp_is_valid_session_id()
session_write_close();
// restart session
session_set_save_handler(array(&$sess_handler, 'open'), array(&$sess_handler, 'close'), array(&$sess_handler, 'read'), array(&$sess_handler, 'write'), array(&$sess_handler, 'destroy'), array(&$sess_handler, 'gc'));
session_start();
$_SESSION = array();
foreach (array_keys($old_session) as $key) {
$_SESSION[$key] = $old_session[$key];
}
}
示例2: 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();
}
}
示例3: sendFile
/**
* Output file to the browser.
* For performance reasons, we avoid SS_HTTPResponse and just output the contents instead.
*/
public function sendFile($file)
{
$path = $file->getFullPath();
if (SapphireTest::is_running_test()) {
return file_get_contents($path);
}
header('Content-Description: File Transfer');
// Quotes needed to retain spaces (http://kb.mozillazine.org/Filenames_with_spaces_are_truncated_upon_download)
header('Content-Disposition: inline; filename="' . basename($path) . '"');
header('Content-Length: ' . $file->getAbsoluteSize());
header('Content-Type: ' . HTTP::get_mime_type($file->getRelativePath()));
header('Content-Transfer-Encoding: binary');
// Fixes IE6,7,8 file downloads over HTTPS bug (http://support.microsoft.com/kb/812935)
header('Pragma: ');
if ($this->config()->min_download_bandwidth) {
// Allow the download to last long enough to allow full download with min_download_bandwidth connection.
increase_time_limit_to((int) (filesize($path) / ($this->config()->min_download_bandwidth * 1024)));
} else {
// Remove the timelimit.
increase_time_limit_to(0);
}
// Clear PHP buffer, otherwise the script will try to allocate memory for entire file.
while (ob_get_level() > 0) {
ob_end_flush();
}
// Prevent blocking of the session file by PHP. Without this the user can't visit another page of the same
// website during download (see http://konrness.com/php5/how-to-prevent-blocking-php-requests/)
session_write_close();
readfile($path);
die;
}
开发者ID:helpfulrobot,项目名称:i-lateral-silverstripe-commerce-downloadableproduct,代码行数:35,代码来源:DownloadableFileController.php
示例4: getFramePosition
function getFramePosition($offset = 0, $usemetadata = true)
{
session_write_close();
$this->start();
$skipTagTypes = array();
$skipTagTypes[FLV_TAG_TYPE_AUDIO] = FLV_TAG_TYPE_AUDIO;
if ($usemetadata && $offset && $this->metadata['keyframes']['times']) {
foreach ($this->metadata['keyframes']['times'] as $key => $value) {
if ($value >= $offset / 1000) {
$offset = $value * 1000;
return $this->metadata['keyframes']['filepositions'][$key];
break;
}
}
}
while ($tag = $this->getTag($skipTagTypes)) {
if ($tag->type == FLV_TAG_TYPE_VIDEO) {
if ($tag->timestamp >= $offset && $tag->frametype == 1) {
return $tag->start;
break;
}
}
//Does it actually help with memory allocation?
unset($tag);
}
return -1;
}
示例5: set
public static function set($key, $value, $close = false)
{
$_SESSION[$key] = $value;
if ($close) {
session_write_close();
}
}
示例6: reset
/**
* Resets the entire session
*
* Generates a new session ID and reassigns the current session
* to the new ID, then wipes out the Cart contents.
*
* @since 1.0
*
* @return boolean
**/
function reset () {
session_regenerate_id();
$this->session = session_id();
session_write_close();
do_action('ecart_session_reset');
return true;
}
示例7: set_member_session
public static function set_member_session($result, $cookiepre, $username)
{
session_write_close();
session_name("{$cookiepre}" . session_name());
session_start();
foreach ($result as $key => $value) {
$_SESSION["{$cookiepre}" . $key] = $value;
}
$_SESSION["{$cookiepre}" . 'alias_show'] = self::clip_str_width(htmlspecialchars($result['alias']));
$_SESSION["{$cookiepre}" . "time"] = time();
$_SESSION["{$cookiepre}" . "REMOTE_ADDR"] = $_SERVER["REMOTE_ADDR"];
$_SESSION["{$cookiepre}" . 'login_username'] = $username;
$_SESSION["{$cookiepre}" . 'ssl'] = intval($result['sec_ssl']);
$_SESSION["{$cookiepre}" . 'dynamic_proxy'] = intval($result['sec_dynamic_proxy']);
$_SESSION["{$cookiepre}" . 'vaild_logon'] = intval($result['sec_vaild_logon']);
$_SESSION["{$cookiepre}" . 'auto_logout_without_opt'] = intval($result['sec_logout_without_opt']);
////////////////////////////////////////////////////////////////////////////
if ($result['sec_vaild_logon'] == 4) {
setcookie(session_name(), session_id(), time() + 9999999, "/");
//'4' => '永久',
} elseif ($result['sec_vaild_logon'] == 3) {
setcookie(session_name(), session_id(), time() + 30 * 24 * 60 * 60, "/");
//'3' => '一个月',
} elseif ($result['sec_vaild_logon'] == 2) {
setcookie(session_name(), session_id(), time() + 24 * 60 * 60, "/");
//'2' => '一天',
} elseif ($result['sec_vaild_logon'] == 1) {
setcookie(session_name(), session_id(), time() + 60 * 60, "/");
//'1' => '一小时',
} else {
setcookie(session_name(), session_id(), 0, "/");
//'0' => '浏览器进程',
}
}
示例8: __destruct
function __destruct()
{
if ($this->alive) {
session_write_close();
$this->alive = false;
}
}
示例9: execute
/**
* Add (export) several products to Google Content
*
* @return \Magento\Framework\Controller\ResultInterface
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function execute()
{
$flag = $this->_getFlag();
if ($flag->isLocked()) {
return $this->resultFactory->create(\Magento\Framework\Controller\ResultFactory::TYPE_RAW);
}
session_write_close();
ignore_user_abort(true);
set_time_limit(0);
$storeId = $this->_getStore()->getId();
$productIds = $this->getRequest()->getParam('product', null);
try {
$flag->lock();
$this->_objectManager->create('Magento\\GoogleShopping\\Model\\MassOperations')->setFlag($flag)->addProducts($productIds, $storeId);
} catch (\Zend_Gdata_App_CaptchaRequiredException $e) {
// Google requires CAPTCHA for login
$this->messageManager->addError(__($e->getMessage()));
$flag->unlock();
return $this->_redirectToCaptcha($e);
} catch (\Exception $e) {
$flag->unlock();
$this->notifier->addMajor(__('Something went wrong while adding products to the Google shopping account.'), $e->getMessage());
$this->_objectManager->get('Psr\\Log\\LoggerInterface')->critical($e);
return $this->resultFactory->create(\Magento\Framework\Controller\ResultFactory::TYPE_RAW);
}
$flag->unlock();
return $this->resultFactory->create(\Magento\Framework\Controller\ResultFactory::TYPE_RAW);
}
示例10: view
public function view()
{
session_write_close();
$keywords = $_REQUEST['q'];
$pl = new \PageList();
$pl->filterByName($keywords);
$pl->sortBy('cID', 'asc');
$pl->setItemsPerPage(5);
$pl->setPermissionsChecker(function ($page) {
$pp = new \Permissions($page);
return $pp->canViewPageInSitemap();
});
$pagination = $pl->getPagination();
$pages = $pagination->getCurrentPageResults();
$results = array();
$nh = \Core::make('helper/navigation');
foreach ($pages as $c) {
$obj = new \stdClass();
$obj->href = $nh->getLinkToCollection($c);
$obj->cID = $c->getCollectionID();
$obj->name = $c->getCollectionName();
$results[] = $obj;
}
echo json_encode($results);
\Core::shutdown(array('jobs' => true));
}
示例11: read
public function read($key)
{
@session_start();
$value = $_SESSION ? $_SESSION[$key] : '';
session_write_close();
return $value;
}
示例12: __new__
/**
* セッションを開始する
* @param string $name
* @return $this
*/
protected function __new__($name = 'sess')
{
$this->ses_n = $name;
if ('' === session_id()) {
$session_name = \org\rhaco\Conf::get('session_name', 'SID');
if (!ctype_alpha($session_name)) {
throw new \InvalidArgumentException('session name is is not a alpha value');
}
session_cache_limiter(\org\rhaco\Conf::get('session_limiter', 'nocache'));
session_cache_expire((int) (\org\rhaco\Conf::get('session_expire', 10800) / 60));
session_name();
if (static::has_module('session_read')) {
ini_set('session.save_handler', 'user');
session_set_save_handler(array($this, 'open'), array($this, 'close'), array($this, 'read'), array($this, 'write'), array($this, 'destroy'), array($this, 'gc'));
if (isset($this->vars[$session_name])) {
session_regenerate_id(true);
}
}
session_start();
register_shutdown_function(function () {
if ('' != session_id()) {
session_write_close();
}
});
}
}
示例13: Gerar
function Gerar()
{
@session_start();
$this->pessoa_logada = $_SESSION['id_pessoa'];
session_write_close();
$this->titulo = "Disciplina Tópico - Detalhe";
$this->cod_disciplina_topico = $_GET["cod_disciplina_topico"];
$tmp_obj = new clsPmieducarDisciplinaTopico($this->cod_disciplina_topico);
$registro = $tmp_obj->detalhe();
if (!$registro) {
header("location: educar_disciplina_topico_lst.php");
die;
}
if ($registro["nm_topico"]) {
$this->addDetalhe(array("Nome Tópico", "{$registro["nm_topico"]}"));
}
if ($registro["desc_topico"]) {
$this->addDetalhe(array("Descrição Tópico", "{$registro["desc_topico"]}"));
}
$objPermissao = new clsPermissoes();
if ($objPermissao->permissao_cadastra(565, $this->pessoa_logada, 7)) {
$this->url_novo = "educar_disciplina_topico_cad.php";
$this->url_editar = "educar_disciplina_topico_cad.php?cod_disciplina_topico={$registro["cod_disciplina_topico"]}";
}
$this->url_cancelar = "educar_disciplina_topico_lst.php";
$this->largura = "100%";
}
示例14: indexAction
/**
* This action gets called into as the OAuth callback after the user
* successfully authenticates with Google and approves the scope. A code
* is passed that can be used to make authorized requests later.
*/
public function indexAction()
{
$this->disableLayout();
$this->disableView();
$code = $this->getParam('code');
$state = $this->getParam('state');
if (strpos($state, ' ') !== false) {
list($csrfToken, $redirect) = preg_split('/ /', $state);
} else {
$redirect = null;
}
if (!$code) {
$error = $this->getParam('error');
throw new Zend_Exception('Failed to log in with Google OAuth: ' . $error);
}
$info = $this->_getUserInfo($code);
$user = $this->_createOrGetUser($info);
session_start();
$this->userSession->Dao = $user;
$userNs = new Zend_Session_Namespace('Auth_User');
$sessionToken = $userNs->oauthToken;
session_write_close();
if ($redirect && $csrfToken === $sessionToken) {
$this->redirect($redirect);
} else {
$this->redirect('/');
}
}
示例15: preprocess
function preprocess()
{
if (isset($_REQUEST['selectlist'])) {
if (!empty($_REQUEST['selectlist'])) {
$print_class = CoreLocal::get('ReceiptDriver');
if ($print_class === '' || !class_exists($print_class)) {
$print_class = 'ESCPOSPrintHandler';
}
$PRINT_OBJ = new $print_class();
$receipt = ReceiptLib::printReceipt('reprint', $_REQUEST['selectlist']);
if (session_id() != '') {
session_write_close();
}
if (is_array($receipt)) {
if (!empty($receipt['any'])) {
$PRINT_OBJ->writeLine($receipt['any']);
}
if (!empty($receipt['print'])) {
$PRINT_OBJ->writeLine($receipt['print']);
}
} elseif (!empty($receipt)) {
$PRINT_OBJ->writeLine($receipt);
}
}
$this->change_page($this->page_url . "gui-modules/pos2.php");
return false;
}
return true;
}