[pLog-svn] r3324 - plog/trunk/class/net/http/session

Mark Wu markplace at gmail.com
Fri May 12 04:46:30 GMT 2006


Hi Oscar:

The user ask he want to integrate his application with Lifetype in Chinese
forum.

He already done in the user authentication  and he want more advanced
integration like sessions and cookies..

So, I just show him the code I list in previous.

The code works well in 1.0, because the session name is "plogsession" ...

But failed in 1.1, because the session name is differet per script ...

So ... I think we should change the session nameing rule to what I proposed
here.

Mark

> -----Original Message-----
> From: plog-svn-bounces at devel.lifetype.net 
> [mailto:plog-svn-bounces at devel.lifetype.net] On Behalf Of 
> Oscar Renalias
> Sent: Friday, May 12, 2006 12:40 PM
> To: plog-svn at devel.lifetype.net
> Subject: Re: [pLog-svn] r3324 - plog/trunk/class/net/http/session
> 
> What's session integration?
> 
> On 12 May 2006, at 07:27, Mark Wu wrote:
> 
> > After change to the code I suggested, I can run sessiontest.php 
> > without any problem ...
> >
> > So,... I will suggest we use this new rules. How do you think?
> >
> > Mark
> >
> >> -----Original Message-----
> >> From: Mark Wu [mailto:markplace at gmail.com]
> >> Sent: Friday, May 12, 2006 11:16 AM
> >> To: 'plog-svn at devel.lifetype.net'
> >> Subject: RE: [pLog-svn] r3324 - plog/trunk/class/net/http/session
> >>
> >> Hi Jon:
> >>
> >> I just try this, it is a little bit weird...
> >>
> >> Through the new session naming rules, if the script name is 
> >> different. Then, the session name is different.
> >>
> >> So, the index.php, admin.php have different session name, is it 
> >> right? That means If I want to integrate the session, I 
> have to know 
> >> which script that user use.
> >>
> >> I think there is only one session per install.
> >>
> >> So, should we use the base_url as the session name, like the
> >> following:
> >>
> >> $baseUrl = $config->getValue('base_url'); $sessionName = "LT"
> >> . preg_replace("/[^a-zA-Z0-9]/", "", $baseUrl);
> >>
> >> How do you think?
> >>
> >> ======
> >> Why I see this? Because I just want to test the session 
> integration 
> >> through the following code, and it seems not work:
> >>
> >> Sessiontest.php
> >> <?php
> >>     if (!defined( "PLOG_CLASS_PATH" )) {
> >>         define( "PLOG_CLASS_PATH", dirname(__FILE__)."/");
> >>     }
> >>     include_once( PLOG_CLASS_PATH."class/dao/users.class.php" );
> >>     include_once(
> >> PLOG_CLASS_PATH."class/net/http/session/sessioninfo.class.php" );
> >>     include_once(
> >> 
> PLOG_CLASS_PATH."class/net/http/session/sessionmanager.class.php" );
> >>     include_once(
> >> PLOG_CLASS_PATH."class/net/http/httpvars.class.php" );
> >>
> >>     SessionManager::init();
> >>     $session = HttpVars::getSession();
> >>     $sessionInfo = $session["SessionInfo"];
> >>     $userInfo = $sessionInfo->getValue( "userInfo" );
> >>     echo $userInfo->getId();
> >>     echo $userInfo->getUsername();
> >> ?>
> >>
> >> The ssession name of this script LTDWWWlifetype11sessiontestphp. :(
> >>
> >> Mark
> >>
> >>> -----Original Message-----
> >>> From: plog-svn-bounces at devel.lifetype.net
> >>> [mailto:plog-svn-bounces at devel.lifetype.net] On Behalf Of 
> >>> jondaley at devel.lifetype.net
> >>> Sent: Thursday, May 04, 2006 1:32 AM
> >>> To: plog-svn at devel.lifetype.net
> >>> Subject: [pLog-svn] r3324 - plog/trunk/class/net/http/session
> >>>
> >>> Author: jondaley
> >>> Date: 2006-05-03 17:32:21 +0000 (Wed, 03 May 2006) New
> >> Revision: 3324
> >>>
> >>> Modified:
> >>>    plog/trunk/class/net/http/session/sessionmanager.class.php
> >>> Log:
> >>> never got around to checking this in from 1.0.3 - multiple
> >> installs on
> >>> the same domain do bad things - settings are shared across LT 
> >>> installs, so you basically can't login to both at the same time.
> >>>
> >>> Modified: 
> plog/trunk/class/net/http/session/sessionmanager.class.php
> >>> 
> ===================================================================
> >>> ---
> >>> plog/trunk/class/net/http/session/sessionmanager.class.php	
> >>> 2006-05-02 20:22:14 UTC (rev 3323)
> >>> +++
> >>> plog/trunk/class/net/http/session/sessionmanager.class.php	
> >>> 2006-05-03 17:32:21 UTC (rev 3324)
> >>> @@ -36,7 +36,14 @@
> >>>              $sessionDomain =
> >>> SessionManager::setSessionCookieDomain();
> >>>  		
> >>>  			session_cache_limiter( "" );
> >>> -			session_name( "plogsession" );
> >>> +            $serverVars = HttpVars::getServer();
> >>> +                // append scriptURL to distinguish between
> >>> +                // multiple installs on the same domain
> >>> +                // session_name is not well documented, but
> >>> some people
> >>> +                // say it will fail with non-alphanumerics
> >>> +            $sessionName = "LT" .
> >>> preg_replace("/[^a-zA-Z0-9]/", "", 
> $serverVars['SCRIPT_FILENAME']);
> >>> +            session_name( $sessionName );
> >>> +
> >>>              session_set_cookie_params(0, $sessionPath, 
> >>> $sessionDomain);
> >>>  			session_start();
> >>>
> >>>
> >>> _______________________________________________
> >>> pLog-svn mailing list
> >>> pLog-svn at devel.lifetype.net
> >>> http://devel.lifetype.net/mailman/listinfo/plog-svn
> >
> > _______________________________________________
> > pLog-svn mailing list
> > pLog-svn at devel.lifetype.net
> > http://devel.lifetype.net/mailman/listinfo/plog-svn
> >
> 
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://devel.lifetype.net/mailman/listinfo/plog-svn



More information about the pLog-svn mailing list