Bridge logs users out of SMF, but not Joomla?

Started by Cocoon, April 15, 2006, 11:22:06 AM

Previous topic - Next topic

Cocoon

Joomla: 1.0.8
SMF: 1.0.7
Bridge: Orstio 3.19a stable

Hiya.

Have installed the bridge, and it is doing everything it should be... but...

I have removed all the native 'logout' links from SMF and Joomla, but when users click the 'logout' link in the Bridge login module, they are logged out of SMF, but NOT out of Joomla?

Have I missed something?
Cocooned in Code from dusk 'til dawn.

Browse safe, Browse Happy

HoTmetal

I had this little issue too. Well it would log you out of joomla, but part of the site would still normally not seen by guests will still show up as links, just not assesable. I think its a cookie problem, because when I  clear them, it goes away.


Cocoon

Thanks Orstio, but I have already done this (when I installed the bridge), and am still getting the problem.
Cocooned in Code from dusk 'til dawn.

Browse safe, Browse Happy

Orstio

You realize there are instructions there for both the login and the logout?  There are two places in MOS_SMF.php to change code...

Cocoon

#5
Yes.

I have followed all the steps in the Readme to alter the code, and am still having the problem.

lines 317-384:


if ($remember=="yes") {
$lifetime = time() + 32536000;
setcookie( "usercookie[username]", $username, $lifetime, "/" );
setcookie( "usercookie[password]", $passwd, $lifetime, "/" );
$sessionCookieName = md5( 'site'.$GLOBALS['mosConfig_live_site'] );
setcookie ($sessionCookieName,"",-3600, "/" );

// For Joomla 1.0.8 compatibility
global $_VERSION;

if (isset($_VERSION) && $_VERSION->DEV_LEVEL >= '8'){
$remCookieName = mosMainFrame::remCookieName_User();
$remCookieValue = mosMainFrame::remCookieValue_User( $username ) . mosMainFrame::remCookieValue_Pass( $passwd );
setcookie( $remCookieName, $remCookieValue, $lifetime, '/' );
}
}
//mosCache::cleanCache('com_content');

}

mysql_select_db($db_name);

// Just log you back out if it's in maintenace mode and you AREN'T an admin.
if (empty($maintenance) || allowedTo('admin_forum')){
$_SESSION['ID'] = $ID_MEMBER;
redirectexit('action=mambo_login;sa=check;id=' . $ID_MEMBER);
}
else
redirectexit('action=logout;sesc=' . $sc);

}

function MOS_Login2($username=NULL,$passwd=NULL)
{



}

function MOS_Logout()
{
global $db_prefix, $sourcedir, $ID_MEMBER, $context, $db_name, $scripturl;
    global $acl, $mosConfig_live_site, $database, $mosConfig_db, $mosConfig_dbprefix;

// Make sure they aren't being auto-logged out.

require_once($sourcedir . '/Subs-Auth.php');
mysql_select_db($db_name);

// If you log out, you aren't online anymore :P.
db_query("
DELETE FROM {$db_prefix}log_online
WHERE ID_MEMBER = $ID_MEMBER
LIMIT 1", __FILE__, __LINE__);
$_SESSION['log_time'] = 0;

// Empty the cookie! (set it in the past, and for ID_MEMBER = 0)
setLoginCookie(-3600, 0);
setcookie( "usercookie[username]", "", -3600, "/" );
setcookie( "usercookie[password]", "", -3600, "/" );
$sessionCookieName = md5( 'site'.$GLOBALS['mosConfig_live_site'] );
setcookie ($sessionCookieName,"",-3600, "/" );

if (isset($_VERSION) && $_VERSION->DEV_LEVEL >= '8'){
         $lifetime = time() - 86400;
         $remCookieName = mosMainFrame::remCookieName_User();
         setcookie( $remCookieName, ' ', $lifetime, '/' );
}
Cocooned in Code from dusk 'til dawn.

Browse safe, Browse Happy


Orstio

This line:

         setcookie( $remCookieName, ' ', $lifetime, '/' );

Should probably be this, but I don't see why that would matter:

         setcookie( $remCookieName, '', $lifetime, '/' );

There is more to the MOS_Logout function after that, yes?

Also, what are you using to edit the file?

Cocoon

#8
There is more to the Logout.  I didn't change anything other than the two sections in the readme, and didn't want to post too much unnecessary code.  here is whole function:


function MOS_Logout()
{
global $db_prefix, $sourcedir, $ID_MEMBER, $context, $db_name, $scripturl;
    global $acl, $mosConfig_live_site, $database, $mosConfig_db, $mosConfig_dbprefix;

// Make sure they aren't being auto-logged out.

require_once($sourcedir . '/Subs-Auth.php');
mysql_select_db($db_name);

// If you log out, you aren't online anymore :P.
db_query("
DELETE FROM {$db_prefix}log_online
WHERE ID_MEMBER = $ID_MEMBER
LIMIT 1", __FILE__, __LINE__);
$_SESSION['log_time'] = 0;

// Empty the cookie! (set it in the past, and for ID_MEMBER = 0)
setLoginCookie(-3600, 0);
setcookie( "usercookie[username]", "", -3600, "/" );
setcookie( "usercookie[password]", "", -3600, "/" );
$sessionCookieName = md5( 'site'.$GLOBALS['mosConfig_live_site'] );
setcookie ($sessionCookieName,"",-3600, "/" );

if (isset($_VERSION) && $_VERSION->DEV_LEVEL >= '8'){
         $lifetime = time() - 86400;
         $remCookieName = mosMainFrame::remCookieName_User();
         setcookie( $remCookieName, ' ', $lifetime, '/' );
}

mysql_select_db($mosConfig_db);

if (!isset($_REQUEST['returnurl'])){
$sql= mysql_query("SELECT params FROM {$mosConfig_dbprefix}modules WHERE module='mod_smf_login'");
$result = mysql_fetch_array($sql);
    $paramlist = $result[0];
    $paramslogin = mosParseParams($paramlist);
    $returncheck = $paramslogin->logout;
} else { $returncheck = $_REQUEST['returnurl']; }

   if (empty($_SESSION['return']) && empty($returncheck))
  $returncheck="1";


switch ($returncheck){
  case "0";
  $_SESSION['logout_url'] = $GLOBALS['mosConfig_live_site'];
  break;

  case "1";
  $_SESSION['logout_url'] = $scripturl;
  break;

  case "2";
  $_SESSION['logout_url'] = $_SESSION['return'];
  break;
}

mysql_select_db($db_name);

// Off to the merry board index we go!
if (empty($_SESSION['logout_url']))
redirectexit('', true, $context['server']['needs_login_fix']);
else
{
$temp = $_SESSION['logout_url'];
unset($_SESSION['logout_url']);

redirectexit($temp, false, $context['server']['needs_login_fix']);
}
}


I use SuperEdi (http://www.wolosoft.com/en/superedi/).

EDIT: SMF is unwrapped... does this make a difference here?
Cocooned in Code from dusk 'til dawn.

Browse safe, Browse Happy

Cocoon

I just started again with the MOS_SMF.php file - took it out of the install package, and re-edited it using the README.

No joy - same problem... me confused  ???

Any more ideas?
Cocooned in Code from dusk 'til dawn.

Browse safe, Browse Happy

Orstio

QuoteI just started again with the MOS_SMF.php file - took it out of the install package, and re-edited it using the README.

Install the package first.  Then go to your SMF /Sources directory, and modify MOS_SMF.php.

If you are modifying the file locally, make sure it is actually uploading to the SMF /Sources directory correctly.

Cocoon

I have done that.

Uninstalled and re-installed package, then downloaded file, modified it, uploaded it, re-downloaded it to check.  File is good.

I'm confused. ???
Cocooned in Code from dusk 'til dawn.

Browse safe, Browse Happy

Advertisement: