Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7069973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:30:39+00:00 2026-05-28T05:30:39+00:00

When I include the Joomla framework, the Joomla session seems to be overwriting the

  • 0

When I include the Joomla framework, the Joomla session seems to be overwriting the session that I am using in another script.
How can I get information from the first session AND from Joomla?

DETAILS

I started a session in a php script external to Joomla.

That file is file1.php

<?php 
    session_start();
    $qid[0]=1;
    $qid[0]=2;
    $qid[0]=3;
    $_SESSION['qid']=$qid;
?>

I then have a php script called main.php It includes 2 files, getsessdata.php and getjoomla.php

main.php

<?php 
    include("getsessdata.php"); 
    include("getjoomla.php"); 
?>

I can get the session data from main.php if getjoomla.php is not included.

var_dump($_SESSION); Shows that the session data for qid is missing when getjoomla.php is included.

getsessdata.php

<?php 
    session_start();
    $qid=$_SESSION['qid']; 
?>

getjoomla.php

<?php
   define( '_JEXEC', 1 );
   define('JPATH_BASE', dirname(__FILE__));   
   define( 'DS', DIRECTORY_SEPARATOR );   
   require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
   require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
   require_once (JPATH_BASE.DS.'libraries'.DS.'joomla'.DS.'environment'.DS.'request.php');

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

QUESTION:

How can I access the session information from file1.php and still access data from getjoomla.php ? Why am I losing the information from the first session?

Not sure if this helps, but once I have the session data from file1 in main.php the session is no longer needed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:30:40+00:00Added an answer on May 28, 2026 at 5:30 am

    Going on the use of $mainframe, I’m guessing Joomla! 1.5.x.

    When you call JFactory::getApplication(‘site’) in it’s construction, a new session is created using session_start() with a passed in Id, this blows away any previous session.

    More specifically when JSession is called it’s __construct calls _start

    function _start()
    {
        //  start session if not startet
        if( $this->_state == 'restart' ) {
            session_id( $this->_createId() );
        }
    
        session_cache_limiter('none');
        session_start();
    
        // Send modified header for IE 6.0 Security Policy
        header('P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"');
    
        return true;
    }
    

    To get around this you could try* this:

    1. put your data in a namespace in $_SESSION

    2. pass an option array after the ‘site’ value, eg. your session namespace.

    ->

    $options['name'] = 'qidSpace';
    
    $mainframe =& JFactory::getApplication('site', $options);
    

    HTH.

    *I’m not 100% sure of the mechanics but it should be close.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a helper script for a Joomla 1.0 module I'm developing. I'm using
Joomla 1.5.25 just upgraded from 1.5.23 having problems saving to session and persistency, works
I am developing a web app using the Joomla Framework. The jQuery UI accordion
i m using yootheme joomla template in joomla 1.5.x, my problem is that i
How can I take advantage of the Joomla! 1.6 login variable that displays the
#include <iostream> using namespace std; int main() { double u = 0; double w
include(conn.php); $result = mysql_query(SELECT * FROM sggame); while($row = mysql_fetch_assoc($result)); { $id = $row['id'];
#include<iostream> using namespace std; class A { int a; int b; public: void eat()
#include <iostream> using namespace std; class Base { public: Base(){cout <<Base<<endl;} virtual ~Base(){cout<<~Base<<endl;} virtual
I've found out the hard way that my website can be hacked by passing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.