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

Mark Wu markplace at gmail.com
Fri May 12 03:16:23 GMT 2006


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



More information about the pLog-svn mailing list