Error with Website Membership plugin

18 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: May 30, 2020   (RSS)

By andreasml - April 5, 2020

Hi

I have a website built in Wordpress. I also use the CMSB to run a database on a different folder of the website. I have been using the Website Membership plugin (WMP) to let users signup and log in the database, for more than one year now. Up to a couple months ago, everything ran smoothly. Nevertheless, the last few weeks I have come across a serious problem. If a user is logged in the database and tries to open any page of the website, the website freezes and the following message appears:

Currently, Fatal error: setPrefixedCookie: Can't set cookie(loginsession, ==QfxIzM3kDM2gTNxojIzNXZjNWQ0NXYsJCLiMWYlVzN3ATY5czM1UDMzADNwMmN4ITYyIDNlNDMkZTN4MTY0MWMkdDJxEGazRiI6ICazFGSkJ3b3N3chBnIsICbtNXYlJHZuFmI6ISZtFmbyV2c1Jye), headers already sent! Output started in /var/www/vhosts/vascularregistry.gr/httpdocs/wp-includes/class.wp-styles.php line 287. in /var/www/vhosts/vascularregistry.gr/httpdocs/registry/lib/common.php on line 742

When the user logs off everything runs again well. 

Similarly, when I deactivate the WMP both CMSB and the website run well. However, this way, users cannot sign up or log in the database through the website as they used to do previously. 

The versions of CMSB and PhP are 3.50 and 7.3.16, respectively.

I have seen some similar topics in the Forum but I have not managed to sort it out. 

Any help would be much appreciated. 

Kind regards,

Andreas Lazaris

By andreasml - April 5, 2020

A short followup

I deactivated all the plugins from the wordpress website, and the problem comes back whenever i want to run a .php file (eg /user-login.php) from within the website. 

Regards

Andreas

By daniel - April 7, 2020

Hi Andreas,

This portion of the error leads me to believe that some portion of WordPress is being loaded and outputting page content before CMSB is loaded:

Output started in /var/www/vhosts/vascularregistry.gr/httpdocs/wp-includes/class.wp-styles.php line 287

CMSB can't set the user's session after page output has started, so if WP is loading first then that will cause issues. I'm not entirely sure why this would have worked for a time, but I do know some server settings can mitigate this issue but not prevent it completely.

Given this, my first thing to look at would be how you are including CMSB on the website - are you using CMSB on WP pages or vice-versa?

Thanks,

Daniel
Technical Lead
interactivetools.com

By andreasml - April 7, 2020

Hi Daniel,

The website is in WP. The CMSB is in a different folder and there is no direct connection between these two. I just run the two php files (user-login.php and user-signup.php) from two different pages of the WP website.

Thanks,

Andreas 

By daniel - April 8, 2020

Hi Andreas,

That's a very curious issue - could you send a 2nd level support request (https://www.interactivetools.com/support/request/) with the CMS/FTP details as well as a user login that can be used to demonstrate the issue? As we haven't seen a lot of interaction between WP and CMSB before, I think it would be easier to troubleshoot this first-hand.

Thanks!

Daniel
Technical Lead
interactivetools.com

By andreasml - April 8, 2020

Hi Daniel

Thank you for your quick response. I have sent a 2nd level support request.

Regards

Andreas

By andreasml - May 26, 2020

Hi again,

I have been trying to solve this issue using all the tricks I have read in the Forum and have been told by the 2nd level support. The final one was to change the "Output buffering" in .user.ini and php.ini files from "Off" to "4096", but again the same message appears when I am logged in CMSB and at the same time I call a webpage from the WP website that contains any php script:

E_USER_ERROR: setPrefixedCookie: Can't set cookie(loginsession, ==Qf1UDN4ATNwkTNxojIzNXZjNWQ0NXYsJCLiMWYlVzN3ATY5czM1UDMzADNwMmN4ITYyIDNlNDMkZTN4MTY0MWMkdDJxEGazRiI6ICazFGSkJ3b3N3chBnIsICbtNXYlJHZuFmI6ISZtFmbyV2c1Jye), headers already sent! Output started in /var/www/vhosts/vascularregistry.gr/httpdocs/wp-includes/class.wp-styles.php line 287.
/var/www/vhosts/vascularregistry.gr/httpdocs/registry/lib/common.php (line 742)
https://vascularregistry.gr/dashboard/

It is really quite annoying as the page freezes and I am able to do nothing at all. Is there anything else I could do? 

Regards

Andreas

By daniel - May 26, 2020

Hi Andreas,

I'm sorry to hear that this issue keeps troubling you.

the same message appears when I am logged in CMSB and at the same time I call a webpage from the WP website that contains any php script:

Could you give me an example of the PHP script on a page that triggers the error?

Thanks,

Daniel
Technical Lead
interactivetools.com

By andreasml - May 26, 2020

Hi Daniel

Thank you for your reply. PhP example that triggers the error:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Number of cases</title>
</head>
<body>

<font color=#000000>
Currently, <b>
<?php

// load viewer library
$libraryPath = 'registry/lib/viewer_functions.php';
$dirsToCheck = ['','../','../../','../../../','../../../../'];
foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }

$aorticAneurysm = mysql_count('aortic_aneurysm_disease');
$carotidArtery = mysql_count('carotid_artery_disease');
$lowerLimb = mysql_count('lower_limb_ischemia');

$total = $aorticAneurysm + $carotidArtery + $lowerLimb;

echo mysql_count('hospitals', ['participating_in_hevar' => "Yes"]);
?></b> hospitals participating,

<b>
<?php
// echo $physicians = mysql_count('accounts', ['treating_physician' => "Yes"]);
// $hospitals = mysql_count('accounts', 'hospital');
// $hospitals = mysql_count('accounts', 'SELECT COUNT(DISTINCT hospital)');
$countWhere = 'hospital != ""';
echo mysql_count('accounts', $countWhere);

?> </b>physicians registered,
<b><?php

echo $total;
?></b> cases recorded.


</font>

</body>
</html>

It is not the only one. Another example:

<?php

// load viewer library
$libraryPath = 'registry/lib/viewer_functions.php';
$dirsToCheck = array('/var/www/vhosts/vascularregistry.gr/httpdocs/','','../','../../','../../../');
foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }
if (!@$GLOBALS['WEBSITE_MEMBERSHIP_PLUGIN']) { die("You must activate the Website Membership plugin before you can access this page."); }

// error checking
$errorsAndAlerts = alert();
if (@$CURRENT_USER) { $errorsAndAlerts .= "You are already logged in! <a href='{$GLOBALS['WEBSITE_LOGIN_POST_LOGIN_URL']}'>Click here to continue</a> or <a href='?action=logoff'>Logoff</a>.<br/>\n"; }
if (!@$CURRENT_USER && @$_REQUEST['loginRequired']) { $errorsAndAlerts .= "Please login to continue.<br/>\n"; }

// save url of referring page so we can redirect user there after login
if (!getPrefixedCookie('lastUrl')) { setPrefixedCookie('lastUrl', @$_SERVER['HTTP_REFERER'] ); }
$GLOBALS['WEBSITE_LOGIN_POST_LOGIN_URL'] = PREFIX_URL.'/registry/';
?>


<h3>Login to HEVAR Portal</h3>
<!-- USER LOGIN FORM -->
<?php if (@$errorsAndAlerts): ?>
<div style="color: #C00; font-weight: bold; font-size: 13px;">
<?php echo $errorsAndAlerts; ?><br/>
</div>
<?php endif ?>

<?php if (!@$CURRENT_USER): ?>
<form action="?" method="post">
<input type="hidden" name="action" value="login" />

<table border="0" cellspacing="0" cellpadding="2">
<tr>
<!-- <td>Username</td> -->
<td><input type="text" name="username" value="<?php echo htmlencode(@$_REQUEST['username']); ?>" size="30" placeholder="Username or Email&hellip;" autocomplete="on" /></td>
</tr>
<tr>
<!-- <td>Password</td> -->
<td><input type="password" name="password" value="<?php echo htmlencode(@$_REQUEST['password']); ?>" size="30" placeholder="Password&hellip;" autocomplete="on" /></td>
</tr>

<tr>
<td style="text-align:left">
<br/><input type="submit" name="submit" value="Login" />
<a href="https://vascularregistry.gr/registration/" target=_parent>or sign-up</a><br/><br/>

<?php if (function_exists('fbl_login')): // NOTE: This feature requires the Facebook Login v2+ plugin! ?>
<?php fbl_loginForm_javascript(); ?>
<a href="#" onclick="fbl_login(); return false;">Login with Facebook</a><br/><br/>
<?php endif; ?>

<?php if (@$GLOBALS['TWITTERAPI_ENABLE_LOGIN']): ?>
<a href="<?php echo twitterLogin_getTwitterLoginUrl();?>"
onclick="<?php echo twitterLogin_getTwitterLoginUrl_popupOnClick(); ?>">Login with Twitter</a><br/><br/>
<?php endif ?>

<a href="https://vascularregistry.gr/registry/admin.php?menu=forgotPassword">Forgot your password?</a>

</td>
</tr>
</table>
</form>
<?php endif ?>
<!-- /USER LOGIN FORM -->

Thanks, 

Andreas