Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-19-2013, 12:19 PM   PM User | #1
mjabado
New Coder

 
Join Date: Dec 2011
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
mjabado is an unknown quantity at this point
Joomla Session

Good day everyone,

I am having problems in retrieving sessions, i'm on a page that loads PHP scripts using jquery $.get, however, everything worked fine when testing on online server, but once i tried to embed the whole thing into joomla, it's doesn't work anymore, this is how i tried to create / retrieve sessions

Code:
define( '_JEXEC', 1 );
define( 'JPATH_BASE', 'Link to somewhere' );
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();

$name = "John";
$session->set('name',$name);
when i load the next php script and i calls for this session that way:

Code:
define( '_JEXEC', 1 );
define( 'JPATH_BASE', 'Link to somewhere' );
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();

$test = $session->get('name');
echo $test;
but i get empty !

Please i would apreciate any help about this one
mjabado is offline   Reply With Quote
Reply

Bookmarks

Tags
joomla, php, sessions

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:44 PM.


Advertisement
Log in to turn off these ads.