View source for Captcha And Session

%%(info type="note")---This issue has been fixed in ((/Dev/Release/R5.5/ReleaseNotes R5.5)).%%

If you want use ((/Dev/Components/Lib/Captcha Captcha)), you __must__ set these values in **freecap.php** if they differ from default values or your config settings,
so that Captcha can pass its values to the session. This is a workaround until a more ((/Dev/Release/R5.5/ChangeLog general approach is found / implemented)).

#|
*| # | setting |location |freecap.php |default value |*
||**1** | $this->config['cookie_prefix']
| ((/Doc/English/Configuration secondary config))
| COOKIE_PREFIX
| ##_wacko##
||
||**2** | SESSION_HANDLER_ID
| constants.php
| SESSION_HANDLER_ID
| ##sid##
||
||**3** | SESSION_HANDLER_PATH 
| constants.php
| SESSION_HANDLER_PATH 
| ##null##
||
|#

  1. $this->config['cookie_prefix'] can be access via the Admin panel or ~phpMyAdmin and config table.
  1. -
  1. The session handler path can be determined with ##ini_get('session.save_path')## or via ##phpinfo();## and session.save_path. 
    1. You can also look up the value via Admin panel and System Informations. 
    1. If you specify the SESSION_HANDLER_PATH then this must be done in in both files. 
    1. If the path containing additional values like ##'3;600;/home/web-sessions'## then add the entire string. 
    1. In some cases the SESSION_HANDLER_PATH must be provided in any case to get it work. 

===Example===
**table prefix_config**
#|
*|config_name |config_value |*
||cookie_prefix |wacko_ ||
|#

**config/constants.php**
%%
define('SESSION_HANDLER_ID',			'sid');
define('SESSION_HANDLER_PATH',			null);	// if you are using specific path (instead of system default /tmp) for session variables storing, define it here
%%


**lib/captcha/freecap.php**
%%
define('COOKIE_PREFIX',            'wacko_');         // Part 1 of session_name - see init.php session function for details "  session_name($this->config['cookie_prefix'].SESSION_HANDLER_ID);  "
define('SESSION_HANDLER_ID',            'sid');       // Part 2 of session_name - see previous . Same setting as in config/constants.php
define('SESSION_HANDLER_PATH',            null);    // Where to find session files. Same setting as in config/constants.php 
%%

%%(wacko wrapper="shade")
All three setting values must be equal in both files 
  1. config table
  2. config/constants.php
  3. lib/captcha/freecap.php

and SESSION_HANDLER_PATH must match the value of your system.
%%

%%
$catch_session_name = COOKIE_PREFIX.SESSION_HANDLER_ID;

if(isset($_GET[$catch_session_name]))
{
	session_name($catch_session_name);
	session_id($_GET[$catch_session_name]);

	// Save session information where specified or with PHP's default
	session_save_path(SESSION_HANDLER_PATH);

	session_start();	// we don't actually start a new session - we open the existing one by name & id and add our variables
}
%%