<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/book.session.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'uk',
  ),
  'this' => 
  array (
    0 => 'intro.session.php',
    1 => 'Вступ',
    2 => 'Вступ',
  ),
  'up' => 
  array (
    0 => 'book.session.php',
    1 => 'Sessions',
  ),
  'prev' => 
  array (
    0 => 'book.session.php',
    1 => 'Sessions',
  ),
  'next' => 
  array (
    0 => 'session.setup.php',
    1 => 'Встановлення/налаштування',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/session/book.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="intro.session" class="preface">
  <h1 class="title">Вступ</h1>
  <p class="para">
   Session support in PHP consists of a way to preserve certain data
   across subsequent accesses. 
  </p>
  <p class="para">
   A visitor accessing your web site is assigned a unique id, the
   so-called session id. This is either stored in a cookie on the
   user side or is propagated in the URL.
  </p>
  <p class="para">
   The session support allows you to store data between requests in the
   <var class="varname"><a href="reserved.variables.session.php" class="classname">$_SESSION</a></var> superglobal array. When a visitor accesses
   your site, PHP will check automatically (if <a href="session.configuration.php#ini.session.auto-start" class="link">session.auto_start</a>
   is set to 1) or on your request (explicitly through
   <span class="function"><a href="function.session-start.php" class="function">session_start()</a></span>) whether a specific session
   id has been sent with the request. If this is the case, the prior
   saved environment is recreated.
  </p>
  <div class="caution"><strong class="caution">Застереження</strong>
   <p class="para">
    If you turn on <a href="session.configuration.php#ini.session.auto-start" class="link">
    session.auto_start</a> then the only way to put objects
    into your sessions is to load its class definition using
    <a href="ini.core.php#ini.auto-prepend-file" class="link">auto_prepend_file</a>
    in which you load the class definition else you will have to
    <span class="function"><a href="function.serialize.php" class="function">serialize()</a></span> your object
    and <span class="function"><a href="function.unserialize.php" class="function">unserialize()</a></span> it
    afterwards.
   </p>
  </div>
  <p class="para">
   <var class="varname"><a href="reserved.variables.session.php" class="classname">$_SESSION</a></var> (and all registered variables) are serialized
   internally by PHP using the serialization handler specified by the
   <a href="session.configuration.php#ini.session.serialize-handler" class="link">session.serialize_handler</a> ini setting,
   after the request finishes.  Registered variables which are undefined are
   marked as being not defined.  On subsequent accesses, these are not defined
   by the session module unless the user defines them later. 
  </p>
  <div class="warning"><strong class="warning">Увага</strong>
   <p class="para">
    Because session data is serialized, <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> variables cannot
    be stored in the session.
   </p>
   <p class="para">
     Serialize handlers (<code class="literal">php</code>
     and <code class="literal">php_binary</code>) inherit register_globals
     limitations. Therefore, numeric index or string index contains
     special characters (<code class="literal">|</code>
     and <code class="literal">!</code>) cannot be used. Using these will end up
     with errors at script shutdown. <code class="literal">php_serialize</code>
     does not have such limitations.
   </p>
  </div>
  <blockquote class="note"><p><strong class="note">Зауваження</strong>: 
   <p class="para">
    Please note when working with sessions that a record of a session
    is not created until a variable has been registered by adding a new
    key to the <var class="varname"><a href="reserved.variables.session.php" class="classname">$_SESSION</a></var> superglobal array. This
    holds true regardless of if a session has been started using the
    <span class="function"><a href="function.session-start.php" class="function">session_start()</a></span> function.
   </p>
  </p></blockquote>
 </div><?php manual_footer($setup); ?>