[Chameleon] can you access session variables from main application .php file?

Paul Spencer pspencer at dmsolutions.ca
Sat Mar 5 09:39:11 EST 2005


Chameleon uses a different session handler than the default PHP one, you 
are likely starting a new session when hitting the Chameleon application 

You have two choices at this point.  You can either:

1) start a normal php session, make a copy of the variables you need, 
close the session and start a chameleon session:

if (isset($_REQUEST['something'])) //indicates coming from application
   $var1 = $_SESSION['var1'];

//this starts Chameleon's session
include_once( 'path-to-chameleon.php' );

if (isset($var1))
   $_SESSION['var1'] = $var1;

2) modify your application to use Chameleon's session handler

include_once( 'path-to-chameleon/htdocs/common/session.php' );

I didn't go look this up so I may have the wrong function names, but if 
you look in session.php you'll find it.



Ken Sanderson wrote:
> Hello all. Can you access session variables from the application php file?
> I have a widget that I have built that adds a user specified point to a 
> map, based on their user click, and then pops up a form that collects 
> information for the point and stores it in a database. When the user 
> first clicks on the map to add a point it checks to see if a username 
> session variable has been set. If so then it goes right to the data 
> entry form, if not then it goes to a login form. This works well and 
> havent had any problems with it.
> I have now added some code to the application php page and I want to 
> access that username session variable to see if a login has been done 
> already or not and if so what the username is. However it doesnt seem to 
> be able to see the session variable. Can I not access a session variable 
> from a page other than the one it was created on?
> Not great with session scripting so any insight would be helpful.
> Thanks,
> Ken
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/chameleon

|Paul Spencer                           pspencer at dmsolutions.ca   |
|Applications & Software Development                              |
|DM Solutions Group Inc                 http://www.dmsolutions.ca/|

More information about the Chameleon mailing list