cvs: phpdoc /en/functions session.xml

From: Date: Tue, 01 May 2001 18:25:08 +0000
Subject: cvs: phpdoc /en/functions session.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969335169@lists.php.net to get a copy of this message
hholzgra Tue May 1 11:25:08 2001 EDT Modified files: /phpdoc/en/functions session.xml Log: reverting my last (accidential) commit Index: phpdoc/en/functions/session.xml diff -u phpdoc/en/functions/session.xml:1.36 phpdoc/en/functions/session.xml:1.37 --- phpdoc/en/functions/session.xml:1.36 Tue May 1 09:20:51 2001 +++ phpdoc/en/functions/session.xml Tue May 1 11:25:08 2001 @@ -136,8 +136,6 @@ <para> The following example demonstrates how to register a variable, and how to link correctly to another page using SID. - </para> - <para> <example> <title>Counting the number of hits of a single user</title> <programlisting role="php"> @@ -149,94 +147,17 @@ Hello visitor, you have seen this page &lt;?php echo $count; ?&gt; times.&lt;p&gt; &lt;php? -# the &lt;?php echo SID;?&gt; is necessary to preserve the session id +# the &lt;?=SID?&gt; is necessary to preserve the session id # in the case that the user has disabled cookies ?&gt; -To continue, &lt;A HREF="nextpage.php?&lt;?php echo SID;?&gt;"&gt;click here&lt;/A&gt; +To continue, &lt;A HREF="nextpage.php?&lt;?=SID?&gt;"&gt;click here&lt;/A&gt; </programlisting> </example> </para> <para> - To implement database storage you need PHP code and a user level - function <function>session_set_save_handler</function>. You would - have to extend the following functions to cover MySQL or another - database. - </para> - <para> -<<<<<<< session.xml - <example> - <title> - Usage of <function>session_set_save_handler</function> - </title> - <programlisting role="php"> -&lt;?php - -function open ($save_path, $session_name) { - echo "open ($save_path, $session_name)\n"; - return true; -} - -function close() { - echo "close\n"; - return true; -} - -function read ($key) { -<<<<<<< session.xml - echo "read ($key, $val)\n"; -======= - echo "read ($key)\n"; ->>>>>>> 1.19 - return "foo|i:1;"; -} - -function write ($key, $val) { - echo "write ($key, $val)\n"; - return true; -} - -function destroy ($key) { - return true; -} - -function gc ($maxlifetime) { - return true; -} - -session_set_save_handler ("open", "close", "read", "write", "destroy", "gc"); - -session_start(); - -$foo++; - -?&gt; - </programlisting> - </example> - </para> - <para> - Will produce this results: - </para> - <para> - <programlisting> -$ ./php save_handler.php -Content-Type: text/html -Set-cookie: PHPSESSID=f08b925af0ecb52bdd2de97d95cdbe6b - -open (/tmp, PHPSESSID) -read (f08b925af0ecb52bdd2de97d95cdbe6b) -write (f08b925af0ecb52bdd2de97d95cdbe6b, foo|i:2;) -close - </programlisting> -======= The <literal>&lt;?=SID?&gt;</literal> is not necessary, if <literal>--enable-trans-sid</literal> was used to compile PHP. ->>>>>>> 1.23 - </para> - <para> -<<<<<<< session.xml - The <literal>&lt;?php echo SID;?&gt;</literal> is not necessary, if - <literal>--enable-trans-sid</literal> was used to compile PHP. </para> <note> <para> @@ -246,13 +167,11 @@ </para> </note> <para> -======= To implement database storage, or any other storage method, you will need to use <function>session_set_save_handler</function> to create a set of user-level storage functions. </para> <para> ->>>>>>> 1.23 The session management system supports a number of configuration options which you can place in your php.ini file. We will give a short overview.

« previous php.doc (#969335169) next »