 |
|
ss
Oracle Tips by Burleson |
session_registery
session_register
-- Registers
one or more global variables with the current session.
Description
session_register() accepts a variable number of arguments, any of which can be
either a string holding the name of a variable or an array consisting
of variable names or other arrays. For each name, session_register()
registers the global variable with that name in the current session.
M Warning: For a script to work regardless of
register_globals, use the $_SESSION array as
$_SESSION entries are automatically registered. If a
script uses session_register(), it will not work in
environments where the PHP directive register_globals are
disabled.
Since PHP 4.2.0, the default value for the PHP
directive register_globals is off. The PHP community encourages
users not to rely on this directive but instead use other means, such
as the superglobals.
M This registers a global variable. To register a session
variable from within a function, make it global using the global
keyword or the
$GLOBALS[] array, or use
the special session arrays as noted below. If using
$_SESSION
(or $HTTP_SESSION_VARS),
do not use session_register(), session_is_registered(),
and session_unregister().
This function returns TRUE when all of the
variables are successfully registered with the session.
If session_start() was not called before
this function is called, an implicit call to session_start()
with no parameters will be made.
$_SESSION does not
mimic this behavior and requires session_start() before use.
Also create a session variable by simply setting
the appropriate member of the
$_SESSION or
$HTTP_SESSION_VARS
(PHP < 4.1.0) array.
Register_globals is a deprecated
configuration directive which was used to automatically register any
global variable with the started session. It was very convenient and
very insecure. Users would open two unrelated scripts from the same
browser session, and inadvertently share data and set incorrect
starting values.
PHP 5, the latest version, is shipped with
register_globals set to OFF. The best option is to leave it that
way and use the $_SESSION array in the same way shown in the
example7b. Can it get any better than this; should there be a
character to use $_SESSION array? It turns out that there is a
function called “extract” that makes life more livable. Here is what
the manual says:
See
code depot for complete scripts
The above book excerpt is from:
Easy Oracle
PHP
Create Dynamic Web Pages with Oracle Data
ISBN
0-9761573-0-6
Mladen Gogala
http://www.rampant-books.com/book_2005_2_php_oracle.htm
|