How to get session working with PHP/Jumi?

A multipurpose module, plugin and component

How to get session working with PHP/Jumi?

New postby dekoster » Fri Apr 11, 2014 6:33 pm

Hello,

I am working on a joomla 2.5.19 website with jumi. I need to log in a user à part from the joomla identification system. So i tryed to use a PHP session in jumi... But it doesn't seem to work. If i plugin the joomla framework to store the session, i can't get the session data back either on another PHP/Jumi page.

Here is the code i wrote.

Page 1 :

Code: Select all
define( '_JEXEC', 1 );
define('JPATH_BASE', dirname(dirname(__FILE__)));
define( 'DS', DIRECTORY_SEPARATOR );

require_once (JPATH_BASE . DS . 'includes' . DS . 'defines.php');
require_once (JPATH_BASE . DS . 'includes' . DS . 'framework.php');

$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();
$session = &JFactory::getSession();

$session->set('testid', 'oki');



Page 2:

Code: Select all
define( '_JEXEC', 1 );
define('JPATH_BASE', dirname(dirname(__FILE__)));
define( 'DS', DIRECTORY_SEPARATOR );

require_once (JPATH_BASE . DS . 'includes' . DS . 'defines.php');
require_once (JPATH_BASE . DS . 'includes' . DS . 'framework.php');

$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();
$session = &JFactory::getSession();

$mymessage = $session->get('testid');
echo("résultat page 2 : {$mymessage}.<br />");


If you see any error, please tell me! If you have any other php/jumi code using sessions that works, please share it.

Hope someone can help solving this session issue :?
dekoster
 
Posts: 2
Joined: Wed Nov 06, 2013 9:00 pm

Return to Jumi

Who is online

Users browsing this forum: No registered users and 3 guests

cron