|
Home
iRate! IceMelon IM Tutorials Headlines CoolSites PHP Functions |
|
Most Referenced Functions » google_pagerank() » preg_replace() » imagecreatefrompng() » site_pageranks() » imagepng() » imagedestroy() » imagestring() » imagecolorallocate() » htmlentities() » preg_match() » fopen() » header() » getimagesize() » preg_match_all() » session_start() » htmlspecialchars() » ob_start() » ob_flush() » strstr() » flush() » strpos() » setcookie() » str_replace() » array2vars() » nl2br() » preg_split() » ereg() » ereg_replace() » urlencode() » readgzfile() Become a sponsor for $15/month. Link is sitewide - PR5 homepage, 20+ PR4 pages, 90+ PR3 pages. Email dave[AT]icemelon[D0T]c0m. |
PHP Functions
Function: sesam_settransaction (PHP 3 CVS only) sesam_settransaction -- Set SESAM transaction parametersDescriptionbool sesam_settransaction ( int isolation_level, int read_only )Returns: TRUE if the values are valid, and the settransaction() operation was successful, FALSE otherwise. sesam_settransaction() overrides the default values for the "isolation level" and "read-only" transaction parameters (which are set in the SESAM configuration file), in order to optimize subsequent queries and guarantee database consistency. The overridden values are used for the next transaction only. sesam_settransaction() can only be called before starting a transaction, not after the transaction has been started already. To simplify the use in PHP scripts, the following constants have been predefined in PHP (see SESAM handbook for detailed explanation of the semantics): Table 1. Valid values for "Isolation_Level" parameter Value Constant Meaning 1 SESAM_TXISOL_READ_UNCOMMITTED Read Uncommitted 2 SESAM_TXISOL_READ_COMMITTED Read Committed 3 SESAM_TXISOL_REPEATABLE_READ Repeatable Read 4 SESAM_TXISOL_SERIALIZABLE SerializableTable 2. Valid values for "Read_Only" parameter Value Constant Meaning 0 SESAM_TXREAD_READWRITE Read/Write 1 SESAM_TXREAD_READONLY Read-OnlyThe values set by sesam_settransaction() will override the default setting specified in the SESAM configuration file .
Example 1. Setting SESAM transaction parameters
<?php
sesam_settransaction (SESAM_TXISOL_REPEATABLE_READ,
SESAM_TXREAD_READONLY);
?>
CXX. Session Handling Functions
IntroductionSession support in PHP consists of a way to preserve certain data across subsequent accesses. This enables you to build more customized applications and increase the appeal of your web site. A visitor accessing your web site is assigned an unique id, the so-called session id. This is either stored in a cookie on the user side or is propagated in the URL. The session support allows you to register arbitrary numbers of variables to be preserved across requests. When a visitor accesses your site, PHP will check automatically (if session.auto_start is set to 1) or on your request (explicitly through session_start() or implicitly through session_register() ) whether a specific session id has been sent with the request. If this is the case, the prior saved environment is recreated. Caution If you do turn on session.auto_start then you cannot put objects into your sessions since the class definition has to be loaded before starting the session in order to recreate the objects in your session. All registered variables are serialized 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. Warning Some types of data can not be serialized thus stored in sessions. It includes resource variables or objects with circular references (i.e. objects which passes a reference to itself to another object). Note: Session handling was added in PHP 4.0. Note: Please note when working with sessions that a record of a session is not created until a variable has been registered using the session_register() function or by adding a new key to the $_SESSION superglobal array. This holds true regardless of if a session has been started using the session_start() function. Sessions and securityExternal links: Session fixation The session module cannot guarantee that the information you store in a session is only viewed by the user who created the session. You need to take additional measures to actively protect the integrity of the session, depending on the value associated with it. Assess the importance of the data carried by your sessions and deploy additional protections -- this usually comes at a price, reduced convenience for the user. For example, if you want to protect users from simple social engineering tactics, you need to enable session.use_only_cookies . In that case, cookies must be enabled unconditionally on the user side, or sessions will not work. There are several ways to leak an existing session id to third parties. A leaked session id enables the third party to access all resources which are associated with a specific id. First, URLs carrying session ids. If you link to an external site, the URL including the session id might be stored in the external site's referrer logs. Second, a more active attacker might listen to your network traffic. If it is not encrypted, session ids will flow in plain text over the network. The solution here is to implement SSL on your server and make it mandatory for users. RequirementsNo external libraries are needed to build this extension. Note: Optionally you can use shared memory allocation (mm), developed by Ralf S. Engelschall, for session storage. You have to download mm and install it. This option is not available for Windows platforms. Note that the session storage module for mm does not guarantee that concurrent accesses to the same session are properly locked. It might be more appropriate to use a shared memory based filesystem (such as tmpfs on Solaris/Linux, or /dev/md on BSD) to store sessions in files, because they are properly locked. InstallationSession support is enabled in PHP by default. If you would not like to build your PHP with session support, you should specify the --disable-session option to configure. To use shared memory allocation (mm) for session storage configure PHP --with-mm[=DIR] . The windows version of PHP has built in support for this extension. You do not need to load any additional extension in order to use these functions. Note: By default, all data related to a particular session will be stored in a file in the directory specified by the session.save_path INI option. A file for each session (regardless of if any data is associated with that session) will be created. This is due to the fact that a session is opened (a file is created) but no data is even written to that file. Note that this behavior is a side-effect of the limitations of working with the file system and it is possible that a custom session handler (such as one which uses a database) does not keep track of sessions which store no data. Runtime ConfigurationThe behaviour of these functions is affected by settings in php.ini .
Table 1. Session configuration options Name Default Changeable Changelog session.save_path "" PHP_INI_ALL session.name "PHPSESSID" PHP_INI_ALL session.save_handler "files" PHP_INI_ALL session.auto_start "0" PHP_INI_ALL session.gc_probability "1" PHP_INI_ALL session.gc_divisor "100" PHP_INI_ALL Available since PHP 4.3.2. session.gc_maxlifetime "1440" PHP_INI_ALL session.serialize_handler "php" PHP_INI_ALL session.cookie_lifetime "0" PHP_INI_ALL session.cookie_path "/" PHP_INI_ALL session.cookie_domain "" PHP_INI_ALL session.cookie_secure "" PHP_INI_ALL Available since PHP 4.0.4. session.use_cookies "1" PHP_INI_ALL session.use_only_cookies "0" PHP_INI_ALL Available since PHP 4.3.0. session.referer_check "" PHP_INI_ALL session.entropy_file "" PHP_INI_ALL session.entropy_length "0" PHP_INI_ALL session.cache_limiter "nocache" PHP_INI_ALL session.cache_expire "180" PHP_INI_ALL session.use_trans_sid "0" PHP_INI_ALL PHP_INI_ALL in PHP <= 4.2.3. PHP_INI_PERDIR in PHP < 5. Available since PHP 4.0.3. session.bug_compat_42 "1" PHP_INI_ALL Available since PHP 4.3.0. session.bug_compat_warn "1" PHP_INI_ALL Available since PHP 4.3.0. session.hash_function "0" PHP_INI_ALL Available since PHP 5.0.0. session.hash_bits_per_character "4" PHP_INI_ALL Available since PHP 5.0.0. url_rewriter.tags "a=href,area=href,frame=src,form=,fieldset=" PHP_INI_ALL Available since PHP 4.0.4. For further details and definitions of the PHP_INI_* constants, see the Appendix H .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. session.save_handler string session.save_handler defines the name of the handler which is used for storing and retrieving data associated with a session. Defaults to files Related Function(s) |