Captcha And Session
This issue has been fixed in R5.5[link1].
If you want use Captcha[link2], 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 general approach is found / implemented[link3].
# | setting | location | freecap.php | default value |
---|---|---|---|---|
1 | $this->config['cookie_prefix'] | secondary config[link4] | COOKIE_PREFIX | _wacko |
2 | SESSION_HANDLER_ID | constants.php | SESSION_HANDLER_ID | sid |
3 | SESSION_HANDLER_PATH | constants.php | SESSION_HANDLER_PATH | null |
- $this->config['cookie_prefix'] can be access via the Admin panel or phpMyAdmin and config table.
- -
- The session handler path can be determined with
ini_get('session.save_path')
or viaphpinfo();
and session.save_path.- You can also look up the value via Admin panel and System Informations.
- If you specify the SESSION_HANDLER_PATH then this must be done in in both files.
- If the path containing additional values like
'3;600;/home/web-sessions'
then add the entire string. - In some cases the SESSION_HANDLER_PATH must be provided in any case to get it work.
Example
table prefix_configconfig_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
All three setting values must be equal in both files
and SESSION_HANDLER_PATH must match the value of your system.
- config table
- config/constants.php
- 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 }
- [link1] https://wackowiki.org/doc/Dev/Release/R5.5/ReleaseNotes
- [link2] https://wackowiki.org/doc/Dev/Components/Lib/Captcha
- [link3] https://wackowiki.org/doc/Dev/Release/R5.5/ChangeLog
- [link4] https://wackowiki.org/doc/Doc/English/Configuration