Working with session and post form variables

Discussion forum for Extension Writers regarding Extension Development.
User avatar
T0ny
Registered User
Posts: 1383
Joined: Sun Jan 29, 2006 8:42 pm
Location: Lancashire
Name: Tony

Re: Working with session and post form variables

Post by T0ny »

Yes, you have to call session_start() before the request class is instantiated. e.g.

Code: Select all

<?php

session_start(); // WORKS HERE

define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);


// session_start(); // WON'T WORK HERE


// start phpbb session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();



if (isset($_SESSION['T']))
{
	echo('SESSION VAR: ' . $_SESSION['T'] . '<br />');
}

$_SESSION['T'] = 'TEST SESSION SET';

MKULTRA
Registered User
Posts: 188
Joined: Tue Oct 16, 2007 12:07 pm
Contact:

Re: Working with session and post form variables

Post by MKULTRA »

Sorry, I tested that and it did not work. Sessions are being killed or unset within a function pertaining to includes/compatibility_globals.php I checked through sessions.php and did not find anything in there that was helpful either.
135
Registered User
Posts: 3
Joined: Mon Sep 05, 2016 8:25 pm
Contact:

Re: Working with session and post form variables

Post by 135 »

If anybody try to found solution for access to $_SESSION as I am also...
Don't lost your time. You have just two ways:
1.$request->enable_super_globals(); before use standard php session management (session_start() etc.)
2. Use Symfony session management http://symfony.com/doc/current/componen ... sions.html

No other ways.
Any attempts to add $_SESSION support to phpbb code will be fail because source more deeper - in the Symfony.
Post Reply

Return to “Extension Writers Discussion”