Website Membership - Logoff

4 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: June 15, 2011   (RSS)

By pothompson - June 14, 2011

I've found an issue with a site I'm working on that has the Website Membership installed.

For parts of the site to work, I'm relying on the $_SESSION array but have found that if somebody logs off, or enters and incorrect login for a login form attached to the Website Membership plugin, a function is invoked called 'user_eraseLoginSession', found in login_functions.php

The function is as follows:

function user_eraseLoginSession() {
if ($_SESSION) { session_destroy(); }
$_SESSION = array();
$CURRENT_USER = false;
}

The problem as I see it is that this removes the entire session and so any other session variables that were stored are also lost.

Is there a way that this function can be changed so as just to remove the relevant session variables?

Thanks, Paul.

Re: [Jason] Website Membership - Logoff

By pothompson - June 14, 2011

Hi Jason,

Thanks for the reply. It's pretty much what I've done, I've created a new function as follows:

function _websiteLogin_user_eraseLoginSession() {
@$_SESSION['wl_username'] = '';
@$_SESSION['wl_passwordHash'] = '';
@$LOGGED_IN = false;
}

And I call this from the plugin instead of calling the standard _user_eraseLoginSession().

However, my concern is why you're destroying the session completely as opposed to just initialising the variable like I've done. Is there a reason for this?

I understand what you say about re-coding to not use session variables but I think the issue centres more around the _user_eraseLoginSession() code removing more than just the login session. I often inherit code from existing sites and re-coding isn't likely to be practical.

Thanks, Paul.

Re: [pothompson] Website Membership - Logoff

By Jason - June 15, 2011

Hi Paul,

The reason we're destroying the entire $_SESSION array is to be as secure as possible. You are right, however, as it does cause problems if you are storing other pieces of information in the $_SESSION array. This is something we can look at changing for a future release.

Thanks
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/