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


PHP session::start方法代码示例

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


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

示例1: index

 public static function index()
 {
     session::start();
     render::add_val('content', phpexcel_block_class::getBlock());
     render::get_main_tpl();
     render::rend();
     session::close();
 }
开发者ID:Ate1st,项目名称:test,代码行数:8,代码来源:main_controller.php

示例2: getBlock

 public static function getBlock()
 {
     session::start();
     $block_path = __DIR__ . '/block/';
     $block_name = str_replace('_class', '', __CLASS__) . '.php';
     self::$block_name = $block_name;
     self::$blocks[$block_name] = ['name' => $block_name, 'path' => $block_path];
     return self::show();
 }
开发者ID:Ate1st,项目名称:test,代码行数:9,代码来源:test_auth_block_class.php

示例3: logon_perform

function logon_perform()
{
    // Check to see if the user is logging in as a guest or a normal user.
    if (isset($_POST['guest_logon'])) {
        // Check the Guest account is enabled.
        if (!user_guest_enabled()) {
            return false;
        }
        // Initialise Guest user session.
        session::start(0);
        // Generate new CSRF token
        session::refresh_csrf_token();
        // Update the visitor log
        session::update_visitor_log(0, true);
        // Success
        return true;
    } else {
        if (isset($_POST['user_logon']) && isset($_POST['user_password'])) {
            // Extract the submitted username
            $user_logon = $_POST['user_logon'];
            // Extract the submitted password
            $user_password = $_POST['user_password'];
            // Try and login the user.
            if (($uid = user_logon($user_logon, $user_password)) !== false) {
                // Initialise a user session.
                session::start($uid);
                // Generate new CSRF token
                session::refresh_csrf_token();
                // Update User's last forum visit
                forum_update_last_visit($uid);
                // Update the visitor log
                session::update_visitor_log($uid, true);
                // Check if we should save a token to allow auto logon,
                if (isset($_POST['user_remember']) && $_POST['user_remember'] == 'Y') {
                    // Get a token for the entered password.
                    $user_token = user_generate_token($uid);
                    // Set a cookie with the logon and the token.
                    html_set_cookie('user_logon', $user_logon, time() + YEAR_IN_SECONDS);
                    html_set_cookie('user_token', $user_token, time() + YEAR_IN_SECONDS);
                } else {
                    // Remove the cookie.
                    html_set_cookie('user_logon', '', time() - YEAR_IN_SECONDS);
                    html_set_cookie('user_token', '', time() - YEAR_IN_SECONDS);
                }
                // Success
                return true;
            }
        }
    }
    // Failed
    return false;
}
开发者ID:DeannaG65,项目名称:BeehiveForum,代码行数:52,代码来源:logon.inc.php

示例4: getBlock

 public static function getBlock()
 {
     session::start();
     $block_path = __DIR__ . '/block/';
     $block_name = str_replace('_class', '', __CLASS__) . '.php';
     self::$block_name = $block_name;
     self::$blocks[$block_name] = ['name' => $block_name, 'path' => $block_path];
     // Create new PHPExcel object
     $xls = new PHPExcel();
     // Устанавливаем индекс активного листа
     $xls->setActiveSheetIndex(0);
     // Получаем активный лист
     $sheet = $xls->getActiveSheet();
     // Подписываем лист
     $sheet->setTitle('Таблица умножения');
     // Вставляем текст в ячейку A1
     $sheet->setCellValue("A1", 'Таблица умножения');
     $sheet->getStyle('A1')->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID);
     $sheet->getStyle('A1')->getFill()->getStartColor()->setRGB('EEEEEE');
     // Объединяем ячейки
     $sheet->mergeCells('A1:H1');
     // Выравнивание текста
     $sheet->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     for ($i = 2; $i < 10; $i++) {
         for ($j = 2; $j < 10; $j++) {
             // Выводим таблицу умножения
             $sheet->setCellValueByColumnAndRow($i - 2, $j, $i . "x" . $j . "=" . $i * $j);
             // Применяем выравнивание
             $sheet->getStyleByColumnAndRow($i - 2, $j)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         }
     }
     //Сохранение листа excel в PDF рабочий вариант
     //1. скачать tcpdf, распаковать в classes
     //2. в PHPExcel/Settings строка 49 заменить tcPDF на tcpdf
     //3. далее работающий код
     $rendererLibrary = 'tcpdf';
     $rendererLibraryPath = 'app/classes/' . $rendererLibrary;
     PHPExcel_Settings::setPdfRenderer('tcpdf', $rendererLibraryPath);
     $path = 'files/asdfg1_' . date('i') . '_' . date('s') . '.pdf';
     $objWriter = new PHPExcel_Writer_PDF($xls);
     $objWriter = PHPExcel_IOFactory::createWriter($xls, 'PDF');
     $objWriter->setSheetIndex(0);
     $objWriter->save($path);
     self::$values['path'] = $path;
     //echo
     //controller::call('/main/get_pdf', ['params' => ['path' => 'files/asdfg1.pdf']]);
     return self::show();
 }
开发者ID:Ate1st,项目名称:test,代码行数:48,代码来源:phpexcel_block_class.php

示例5: spl_autoload_unregister

if (isset($_REQUEST['signout']) && $_REQUEST['signout']) {
    if (session::global_is_set('connected')) {
        $config = session::global_get('config');
        if ($config->get_cfg_value('casActivated') == 'TRUE') {
            require_once 'CAS.php';
            /* Move CAS autoload before FD autoload */
            spl_autoload_unregister('CAS_autoload');
            spl_autoload_register('CAS_autoload', TRUE, TRUE);
            phpCAS::client(CAS_VERSION_2_0, $config->get_cfg_value('casHost', 'localhost'), (int) $config->get_cfg_value('casPort', 443), $config->get_cfg_value('casContext', ''));
            // Set the CA certificate that is the issuer of the cert
            phpCAS::setCasServerCACert($config->get_cfg_value('casServerCaCertPath'));
            phpCas::logout();
        }
    }
    session::destroy();
    session::start();
}
/* Reset errors */
session::set('errors', '');
session::set('errorsAlreadyPosted', '');
session::set('LastError', '');
/* Check if we need to run setup */
if (!file_exists(CONFIG_DIR . '/' . CONFIG_FILE)) {
    header('location:setup.php');
    exit;
}
/* Check if fusiondirectory.conf (.CONFIG_FILE) is accessible */
if (!is_readable(CONFIG_DIR . '/' . CONFIG_FILE)) {
    msg_dialog::display(_('Configuration error'), sprintf(_('FusionDirectory configuration %s/%s is not readable. Please run fusiondirectory-setup --check-config to fix this.'), CONFIG_DIR, CONFIG_FILE), FATAL_ERROR_DIALOG);
    exit;
}
开发者ID:misel228,项目名称:fusiondirectory,代码行数:31,代码来源:index.php

示例6: init

 /**
  * Initialize db connections, cache and session
  */
 public static function init($options = [])
 {
     // initialize mbstring
     mb_internal_encoding('UTF-8');
     mb_regex_encoding('UTF-8');
     // get flags & dependencies
     $flags = application::get('flag');
     $backend = application::get('numbers.backend', ['backend_exists' => true]);
     // processing wildcard first
     $wildcard = application::get('wildcard');
     $wildcard_keys = null;
     if (!empty($wildcard['enabled']) && !empty($wildcard['model'])) {
         $wildcard_keys = call_user_func($wildcard['model']);
         application::set(['wildcard', 'keys'], $wildcard_keys);
     }
     // initialize cryptography
     $crypt = application::get('crypt');
     if (!empty($crypt) && $backend) {
         foreach ($crypt as $crypt_link => $crypt_settings) {
             if (!empty($crypt_settings['submodule']) && !empty($crypt_settings['autoconnect'])) {
                 $crypt_object = new crypt($crypt_link, $crypt_settings['submodule'], $crypt_settings);
             }
         }
     }
     // create database connections
     $db = application::get('db');
     if (!empty($db) && $backend) {
         foreach ($db as $db_link => $db_settings) {
             if (empty($db_settings['autoconnect']) || empty($db_settings['servers']) || empty($db_settings['submodule'])) {
                 continue;
             }
             $connected = false;
             foreach ($db_settings['servers'] as $server_key => $server_values) {
                 $db_object = new db($db_link, $db_settings['submodule']);
                 // wildcards replaces
                 if (isset($wildcard_keys[$db_link])) {
                     $server_values['dbname'] = $wildcard_keys[$db_link]['dbname'];
                 }
                 // connecting
                 $server_values = array_merge2($server_values, $db_settings);
                 $db_status = $db_object->connect($server_values);
                 if ($db_status['success'] && $db_status['status']) {
                     $connected = true;
                     break;
                 }
             }
             // checking if not connected
             if (!$connected) {
                 throw new Exception('Unable to open database connection!');
             }
         }
     }
     // initialize cache
     $cache = application::get('cache');
     if (!empty($cache) && $backend) {
         foreach ($cache as $cache_link => $cache_settings) {
             if (empty($cache_settings['submodule']) || empty($cache_settings['autoconnect'])) {
                 continue;
             }
             $connected = false;
             foreach ($cache_settings['servers'] as $cache_server) {
                 $cache_object = new cache($cache_link, $cache_settings['submodule']);
                 $cache_status = $cache_object->connect($cache_server);
                 if ($cache_status['success']) {
                     $connected = true;
                     break;
                 }
             }
             // checking if not connected
             if (!$connected) {
                 throw new Exception('Unable to open cache connection!');
             }
         }
     }
     // if we are from command line we exit here
     if (!empty($options['__run_only_bootstrap'])) {
         return;
     }
     // initialize session
     $session = application::get('flag.global.session');
     if (!empty($session['start']) && $backend && !application::get('flag.global.__skip_session')) {
         session::start(isset($session['options']) ? $session['options'] : []);
     }
     // we need to get overrides from session and put them back to flag array
     $flags = array_merge_hard($flags, session::get('numbers.flag'));
     application::set('flag', $flags);
     // initialize i18n
     if ($backend) {
         $temp_result = i18n::init();
         if (!$temp_result['success']) {
             throw new Exception('Could not initialize i18n.');
         }
     }
     // format
     format::init();
     // including libraries that we need to auto include
     if (!empty($flags['global']['library'])) {
//.........这里部分代码省略.........
开发者ID:volodymyr-volynets,项目名称:framework,代码行数:101,代码来源:bootstrap.php

示例7: array

 }
 if ($valid) {
     $user_data = array('IPADDRESS' => get_ip_address(), 'REFERER' => session::get_http_referer(), 'LOGON' => $logon, 'NICKNAME' => $nickname, 'EMAIL' => $email);
     if (ban_check($user_data)) {
         $error_msg_array[] = gettext("The username or password you supplied is not valid.");
         $valid = false;
     }
 }
 if ($valid) {
     if (($new_uid = user_create($logon, $password, $nickname, $email)) !== false) {
         // Save the new user preferences
         user_update_prefs($new_uid, $new_user_prefs);
         // Save the new user signature
         user_update_sig($new_uid, $sig_content, true);
         // Initialise the new user session.
         session::start($new_uid);
         // Update User's last forum visit
         forum_update_last_visit($new_uid);
         // Update the visitor log
         session::update_visitor_log($new_uid, true);
         // Check to see if the user is going somewhere after they have registered.
         $final_uri = isset($final_uri) ? rawurlencode($final_uri) : '';
         // If User Confirmation is enabled send the forum owners an email.
         if (forum_get_setting('require_user_approval', 'Y')) {
             admin_send_user_approval_notification($new_uid);
         }
         // If New User Notification is enabled send the forum owners an email.
         if (forum_get_setting('send_new_user_email', 'Y')) {
             admin_send_new_user_notification($new_uid);
         }
         // Display final success / confirmation page.
开发者ID:DeannaG65,项目名称:BeehiveForum,代码行数:31,代码来源:lregister.php

示例8: end

 public static function end()
 {
     session::start(0);
 }
开发者ID:DeannaG65,项目名称:BeehiveForum,代码行数:4,代码来源:session.inc.php

示例9: session_start

 /**
  *  开启SESSION
  *  系统会对SESSION开启状态进行自动配置,所以这个方法不要使用
  */
 static function session_start()
 {
     session::start();
 }
开发者ID:com-itzcy,项目名称:hdjob,代码行数:8,代码来源:Control.class.php

示例10: cache_disable_proxy

cache_disable_proxy();
// Check that Beehive is installed correctly
install_check();
// Required includes
require_once BH_INCLUDE_PATH . 'banned.inc.php';
require_once BH_INCLUDE_PATH . 'constants.inc.php';
require_once BH_INCLUDE_PATH . 'format.inc.php';
require_once BH_INCLUDE_PATH . 'header.inc.php';
require_once BH_INCLUDE_PATH . 'html.inc.php';
require_once BH_INCLUDE_PATH . 'lang.inc.php';
require_once BH_INCLUDE_PATH . 'session.inc.php';
// End Required includes
// Initialise the session
session::init();
// Populate the session store.
session::start($_SESSION['UID']);
// Perform ban check
ban_check($_SESSION);
// Update User's last forum visit
forum_update_last_visit($_SESSION['UID']);
// Update the visitor log
session::update_visitor_log($_SESSION['UID']);
// Initialise gettext
lang_init();
// Enable the word filter ob filter
ob_start('word_filter_ob_callback');
// Check to see if user account has been banned.
if (session::user_banned()) {
    html_user_banned();
    exit;
}
开发者ID:DeannaG65,项目名称:BeehiveForum,代码行数:31,代码来源:boot.php

示例11: values

        } else {
            $sql = "insert into " . SESSION . " values('{$key}',{$expiry},'{$value}')";
        }
        $re = $this->db->query($sql);
        if ($re) {
            return true;
        } else {
            return false;
        }
    }
    function destroy($key)
    {
        $qry = "delete from " . SESSION . " where sesskey = '{$key}'";
        $qid = $this->db->query($qry);
        return $qid;
    }
    function gc($maxlifetime)
    {
        $qry = "delete from " . SESSION . " where expiry < " . time();
        $qid = $this->db->query($qry);
        return true;
    }
    function start()
    {
        session_set_save_handler(array($this, 'open'), array($this, 'close'), array($this, 'read'), array($this, 'write'), array($this, 'destroy'), array($this, 'gc'));
        session_start();
    }
}
$sess = new session();
$sess->start();
开发者ID:Lin07ux,项目名称:notes,代码行数:30,代码来源:PHP+session存入DB.php

示例12: session

 <?php 
include 'session.class.php';
$session = new session();
$session->start();
$session->set('test', 'Kada Rachid');
$session->stop();
echo $session->get('test');
开发者ID:ATS001,项目名称:PRSIT,代码行数:7,代码来源:test.php

示例13: page

             echo $page->getOrdersStateIsone();
             break;
         case 2:
             echo $page->getOrdersStateIstwo();
             break;
     }
     break;
 case 14:
     //get orders from server
     $page = new page();
     echo $page->getOrdersZeroFromServer();
     break;
 case 15:
     //add or reduce prods of session
     $ses = new session();
     $ses->start();
     $_SESSION['shop'][$_POST['id']]['num'] += $_POST['add'];
     if ($_SESSION['shop'][$_POST['id']]['num'] <= 0) {
         unset($_SESSION['shop'][$_POST['id']]);
     }
     break;
     /* 	case 16://check root user
         if(isset($_POST['pass']) AND isset($_POST['name'])){
             if($_POST['name']=='hyy' AND $_POST['pass']=='123'){
                 setcookie('hyy','1784794036',time()+3600*12);
                 echo 1;
                 exit();
             }else{
                 echo 0;
             }
         }
开发者ID:AJLoveChina,项目名称:oshjf,代码行数:31,代码来源:functions.php

示例14: init

 public static function init()
 {
     session::start();
 }
开发者ID:ThisNameWasFree,项目名称:rude-univ,代码行数:4,代码来源:rude-template-session.php


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