diff --git a/functions/session.xml b/functions/session.xml index 44489fd9bc..d4e82b08b0 100644 --- a/functions/session.xml +++ b/functions/session.xml @@ -136,8 +136,6 @@ $count++; The following example demonstrates how to register a variable, and how to link correctly to another page using SID. - - Counting the number of hits of a single user @@ -149,94 +147,17 @@ $count++; Hello visitor, you have seen this page <?php echo $count; ?> times.<p> <php? -# the <?php echo SID;?> is necessary to preserve the session id +# the <?=SID?> is necessary to preserve the session id # in the case that the user has disabled cookies ?> -To continue, <A HREF="nextpage.php?<?php echo SID;?>">click here</A> +To continue, <A HREF="nextpage.php?<?=SID?>">click here</A> - To implement database storage you need PHP code and a user level - function session_set_save_handler. You would - have to extend the following functions to cover MySQL or another - database. - - -<<<<<<< session.xml - - - Usage of <function>session_set_save_handler</function> - - -<?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++; - -?> - - - - - Will produce this results: - - - -$ ./php save_handler.php -Content-Type: text/html -Set-cookie: PHPSESSID=f08b925af0ecb52bdd2de97d95cdbe6b - -open (/tmp, PHPSESSID) -read (f08b925af0ecb52bdd2de97d95cdbe6b) -write (f08b925af0ecb52bdd2de97d95cdbe6b, foo|i:2;) -close - -======= The <?=SID?> is not necessary, if --enable-trans-sid was used to compile PHP. ->>>>>>> 1.23 - - -<<<<<<< session.xml - The <?php echo SID;?> is not necessary, if - --enable-trans-sid was used to compile PHP. @@ -246,13 +167,11 @@ close -======= To implement database storage, or any other storage method, you will need to use session_set_save_handler to create a set of user-level storage functions. ->>>>>>> 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.