Fiji Web Design
Welcome, Guest
Please Login or Register.    Lost Password?
Session variables not passing through (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: Session variables not passing through
#1123
empirebattles (User)
Fresh Boarder
Posts: 5
graphgraph
User Offline Click here to see the profile of this user
Re:Session variables not passing through 8 Months, 3 Weeks ago Karma: 0  
yeah.... i could imagine.

I have a feeling that what i'm trying to do is impossible:
Read from BOTH joomla session values, and the normal server session files, in the same php script. At first i thought to change the session_save_path, but that obviously wouldn't work since joomla handles sessions via databases...
for example:
<?php
define( '_JEXEC', 1 );  
define('JPATH_BASE','/home/examp/public_html/'); 
define( 'DS', DIRECTORY_SEPARATOR );  
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );  
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );  
$App =& JFactory::getApplication('site');  

$getmyname=$_SESSION['joomla_name'];

/*Some code to disengage from joomla sessions, and then back to normal sessions on the server*/

$_SESSION['user_value_a']=$getmyname;
?>
I only need the joomla session values right before passing them over to the 'server side', and then i never need to touch joomla again. right now, i have it so that there is a page that sets a cookie=$_SESSION['joomla_name']; , and then it redirects to another page, and then $_SESSION['user_value_a']= the cookie that was previously set. It was the only thing i could think of to work around this, but like i said, cookies are too open to vulnerabilities
 
Report to moderator   Logged Logged  
 
Last Edit: 2009/12/20 21:27 By empirebattles.
  The administrator has disabled public write access.
#1124
admin (Admin)
Admin
Posts: 422
graph
User Offline Click here to see the profile of this user
Re:Session variables not passing through 8 Months, 3 Weeks ago Karma: 9  
It is not impossible, just needs a bit of experimenting. I've don't know if you can change the session handler mid session. I'd assume you can close the session session_write_close(), then restart it again with session_start() and use the filesystem.

Then just rewrite all the data from Joomla into the new session.

eg:

// after the Joomla stuff

// copy the session
$session = $_SESSION;

session_write_close();
session_start();

foreach($session as $name=>$value) $_SESSION[$name] = $value;
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#1125
empirebattles (User)
Fresh Boarder
Posts: 5
graphgraph
User Offline Click here to see the profile of this user
Re:Session variables not passing through 8 Months, 3 Weeks ago Karma: 0  
yeah... i thought about doin that, and when i tried it, it gave me
Fatal error: session_start() [<a href='function.session-start'>function.session-start</a>]: Failed to initialize storage module: user (path: /tmp) in *path of file and line #*
which lead me to the conclusion that the session couldn't be re-declared half way down the page....i'm still playin around with it, but i keep getting the failed to initialize storage module error.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#1126
admin (Admin)
Admin
Posts: 422
graph
User Offline Click here to see the profile of this user
Re:Session variables not passing through 8 Months, 3 Weeks ago Karma: 9  
Looks like you can't change the session module after you have written to it. The module is either user or files. User is when you set a session_save_handler() or custom functions to handle the session. Files is when the default PHP session handler writes it to files.

However, you can change the session_save_handler() mid way to use your own custom handler.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop

Joomla Downloads

DownloadsDownload our free Joomla! Components, Modules and Plugins.