SimplePortal

Support => English Support => Topic started by: Rupurudu! on April 19, 2015, 10:13:14 PM

Title: Can't vote, Can't login through the portal
Post by: Rupurudu! on April 19, 2015, 10:13:14 PM
Edit: Issue is solved, here's the solution:
I fixed the issue myself. Here's how to fix this if you are having the same issue:

Most of the hosting providiers and even most of the pre-compiled php servers now include a security extension named "Suhosin Extension"

It's messing with SMF's session system by invalidating SMF's session cookies, which is critical to SimplePortal.

Here's the code to disable it, add it to "php.ini":
Code: [Select]
; Turn off Suhosin's session encrption.  SMF is a big boy, it doesn't need its hands held.
suhosin.session.encrypt = Off
; Also turn off the cookie encryption. It's probably not needed, but better safe than sorry.
suhosin.cookie.encrypt= Off

Note that this will only disable session and cookie encryption, other parts of the extension works without issues.

Hello,

I'm having some issues with my SimplePortal installation. I can't do anything interactive on the portal page.

For example, If I put a poll block to the portal page and try to use my vote from the poll page, I can't. It simply goes back to the portal page without saving my vote.

Or When I want to login from the portal page, It just says "Password Incorrect" even my password is correct. (I checked multiple times.)

You can visit our website to see the issue: http://forums.untamedheart.us/

Here is my SimplePortal Settings:
(http://i.gyazo.com/e40925ab2adf8bf775d23bf4cdbc963e.png)

And yes, I set $forum_dir setting inside of the PortalStandalone.php in case if you think that's the problem
Title: Re: Can't vote, Can't login through the portal
Post by: Rupurudu! on April 28, 2015, 05:40:01 PM
It's more than 10 days now. Is this forum dead?
Title: Re: Can't vote, Can't login through the portal
Post by: Chen Zhen on April 28, 2015, 05:52:57 PM
Rupurudu!,

  The standalone url appears to be incorrect. You need to use the full url (including http://) and also include the actual standalone file within that url. Click on the question mark to the left of the Standalone text which gives an example.

Regards.
Title: Re: Can't vote, Can't login through the portal
Post by: Rupurudu! on April 28, 2015, 06:55:36 PM
I changed the url to http://untamedheart.us/index.php But my problem is not fixed.

Only thing changed is the Home button on the header menu points to this adress now.

SMF is installed on the http://forums.untamedheart.us/ url and /home/klonfsmj/public_html/forums directory
Portal is installed on the http://untamedheart.us/ url and /home/klonfsmj/public_html directory

Here's the PortalStandalone.php. I renamed it to index.php
Code: [Select]
<?php

/**
 * @package SimplePortal
 *
 * @author SimplePortal Team
 * @copyright 2014 SimplePortal Team
 * @license BSD 3-clause
 *
 * @version 2.3.6
 */

/*

This file here, unbelievably, has your portal within.

In order to use SimplePortal in standalone mode:
+ Go to "SPortal Admin" >> "Configuration" >> "General Settings"
+ Select "Standalone" mode as "Portal Mode"
+ Set "Standalone URL" as the full url of this file.
+ Edit path to the forum ($forum_dir) in this file.

See? It's just magic!

*/

global $sp_standalone;

// Should be the full path!
$forum_dir '/home/klonfsmj/public_html/forums';

// Let them know the mode.
$sp_standalone true;

// Hmm, wrong forum dir?
if (!file_exists($forum_dir '/index.php'))
die('Wrong $forum_dir value. Please make sure that the $forum_value variable points to your forum\'s directory.');

// Get out the forum's SMF version number.
$data substr(file_get_contents($forum_dir '/index.php'), 04096);
if (
preg_match('~\*\s*Software\s+Version:\s+(SMF\s+.+?)[\s]{2}~i'$data$match))
$forum_version $match[1];
elseif (
preg_match('~\*\s@version\s+(.+)[\s]{2}~i'$data$match))
$forum_version 'SMF ' $match[1];

// Call the SSI magic.
require_once($forum_dir '/SSI.php');

// Wireless? We don't support you, yet.
if (WIRELESS)
redirectexit();

// Get our main file.
require_once($sourcedir '/PortalMain.php');

// Re-initialize SP.
sportal_init(true);

// We'll catch you...
writeLog();

// Get the page ready.
sportal_main();

// Here we go!
obExit(true);

?>
Title: Re: Can't vote, Can't login through the portal
Post by: ♦ Ninja ZX-10RR ♦ on April 28, 2015, 06:58:30 PM
This is the official documentation, too :) http://simpleportal.net/index.php?action=docs;area=set_up_standalone_portal
Title: Re: Can't vote, Can't login through the portal
Post by: Chen Zhen on April 28, 2015, 07:19:11 PM
Rupurudu!,

  It is not configured correctly for standalone mode. When logged into the forum I can not even log out when on the home page.
Double check the directory setting again because that will cause this behaviour.

Regards.
Title: Re: Can't vote, Can't login through the portal
Post by: Chen Zhen on April 28, 2015, 07:37:37 PM

Attempt to adjust the cookie settings as suggested by Sinan within this post:
http://simpleportal.net/index.php?topic=12946.msg64374#msg64374
Title: Re: Can't vote, Can't login through the portal
Post by: Rupurudu! on April 28, 2015, 07:40:43 PM
Rupurudu!,

  It is not configured correctly for standalone mode. When logged into the forum I can not even log out when on the home page.
Double check the directory setting again because that will cause this behaviour.

Regards.

I already checked them a few times on the last 10 days. They are correct.

Without the correct $forum_dir value homepage prints out "Wrong $forum_dir value. Please make sure that the $forum_value variable points to your forum's directory." It don't print this, so it's correct.

Without the correct Standalone URL the Home button on the Navbar points out a 404 error. It points out the portal page so it's correct too.


Attempt to adjust the cookie settings as suggested by Sinan within this post:
http://simpleportal.net/index.php?topic=12946.msg64374#msg64374

It's already like that. Without this setting, you always look as a guest on the portal page even when you are logged in.

I'm now starting to think this is a SimplePortal bug. Maybe you should move this to the Bugs section.

Also, please disable moderator approval for me. I don't want to wait for another 10 days for a moderator to approve my messages.
Title: Re: Can't vote, Can't login through the portal
Post by: Chen Zhen on April 28, 2015, 08:57:57 PM
Rupurudu!,

  It's not a bug as it works for others and also I have personally tested it live & locally with no issues.
Imo there must be a forum setting that is not configured correctly that involves the current session.
The only way to figure it out is with trial & error, starting with the most common issues (as you are in the process of doing).
Did you happen to read the rest of the previously mentioned thread that includes an edit to add the session id to the url?


This forum is set to block any of a user's first 5 posts that contain a link due to possible spam.
I do check those that are blocked but unfortunately at times I am preoccupied elsewhere.

Regards.
Title: Re: Can't vote, Can't login through the portal
Post by: Rupurudu! on April 28, 2015, 09:12:33 PM
Rupurudu!,

It's not a bug as it works for others and also I have personally tested it live & locally with no issues.
Imo there must be a forum setting that is not configured correctly that involves the current session.
The only way to figure it out is with trial & error, starting with the most common issues (as you are in the process of doing).
Did you happen to read the rest of the previously mentioned thread that includes an edit to add the session id to the url?
It works for who? Do you have any examples?
And yes, I did read the rest of the mentioned thread. I already have the session variable "sesc=..." on here.

This forum is set to block any of a user's first 5 posts that contain a link due to possible spam.
I do check those that are blocked but unfortunately at times I am preoccupied elsewhere.

Regards.
And this is my 5th post :) Thanks for your support.
Title: Re: Can't vote, Can't login through the portal
Post by: Chen Zhen on April 28, 2015, 09:44:42 PM
Rupurudu!,

  Actually with EhPortal (ported from Simple Portal for SMF 2.1) I had similar issues for the login block although I have not seen too many issues with people using SP on the SMF 2.0.X branch.
Are you willing/able to try some edits to the ../Sources/PortalBlocks.php file?
 
Title: Re: Can't vote, Can't login through the portal
Post by: Rupurudu! on April 28, 2015, 09:45:40 PM
If they solve my problems, of course I can do.
Title: Re: Can't vote, Can't login through the portal
Post by: Chen Zhen on April 28, 2015, 09:56:38 PM
I can post that edit but first I'd like to point out that the session variable is being done incorrectly.
It is not supposed to be (a5c1b54cadf0601cd705e91d03a733ad being an example session string):
sesc=a5c1b54cadf0601cd705e91d03a733ad

It should look something like this (just an example):
fa5cfb33=a5c1b54cadf0601cd705e91d03a733ad

Within the edit to the code for the session it should have something on the latter part of the uri that looks something like this:
Code: [Select]
$context['session_var'], '=', $context['session_id']

 
Title: Re: Can't vote, Can't login through the portal
Post by: Rupurudu! on April 28, 2015, 10:11:47 PM
Okay, this is what I did:

Before:
Code: [Select]
<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">', $txt['logout'], '</a>';

After:
Code: [Select]
<a href="', $scripturl, '?action=logout;', $context['session_var'], '=', $context['session_id'], '">', $txt['logout'], '</a>';

Now while logging out, it shows /index.php?action=logout;df897cb7=a5c1b54cadf0601cd705e91d03a733ad but I still get "Session verification failed." error.
Title: Re: Can't vote, Can't login through the portal
Post by: Chen Zhen on April 28, 2015, 10:17:21 PM
I can see that it is now configured without sesc but does not seem to be working properly as of yet.

Here is the edit to first see if it works for logging in.

file: ../Sources/PortalBlocks.php

find:
Code: [Select]
<input type="hidden" name="hash_passwrd" value="" />
replace with:
Code: [Select]
<input type="hidden" name="hash_passwrd" value="" />
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
<input type="hidden" name="', $context['login_token_var'], '" value="', $context['login_token'], '" />



Title: Re: Can't vote, Can't login through the portal
Post by: Rupurudu! on April 28, 2015, 10:32:20 PM
Done. But It's not working too. I still see "Password incorrect" while trying to login from the Portal
Title: Re: Can't vote, Can't login through the portal
Post by: Chen Zhen on April 29, 2015, 06:01:27 PM
Quote
SMF is installed on the http://forums.untamedheart.us/ url and /home/klonfsmj/public_html/forums directory
Portal is installed on the http://untamedheart.us/ url and /home/klonfsmj/public_html directory

I just want to be clear about how you set this up.
The above statement says the portal is installed in the /home/klonfsmj/public_html path and that the SMF forum is installed in the /home/klonfsmj/public_html/forums path.
There should not be any SMF nor Simple Portal installed to the /home/klonfsmj/public_html path (less the standalone file) for your set up.

SMF along with Simple Portal should be installed to the /home/klonfsmj/public_html/forums path ONLY.
After which you put the portal standalone file (renamed as index.php) in the /home/klonfsmj/public_html path.
Perhaps you did not word it correctly but I want to double check that it was done properly.

Did you only put the standalone file into the /home/klonfsmj/public_html path or did you actually install (SMF with) Simple Portal into both paths as the above statement seems to imply?
Title: Re: Can't vote, Can't login through the portal
Post by: Rupurudu! on April 29, 2015, 08:36:10 PM
Quote
SMF is installed on the http://forums.untamedheart.us/ url and /home/klonfsmj/public_html/forums directory
Portal is installed on the http://untamedheart.us/ url and /home/klonfsmj/public_html directory

I just want to be clear about how you set this up.
The above statement says the portal is installed in the /home/klonfsmj/public_html path and that the SMF forum is installed in the /home/klonfsmj/public_html/forums path.
There should not be any SMF nor Simple Portal installed to the /home/klonfsmj/public_html path (less the standalone file) for your set up.

SMF along with Simple Portal should be installed to the /home/klonfsmj/public_html/forums path ONLY.
After which you put the portal standalone file (renamed as index.php) in the /home/klonfsmj/public_html path.
Perhaps you did not word it correctly but I want to double check that it was done properly.

Did you only put the standalone file into the /home/klonfsmj/public_html path or did you actually install (SMF with) Simple Portal into both paths as the above statement seems to imply?
Sorry. Of course I installed Simpleportal on SMF's directory.

This is what I did:

I installed SimplePortal from SMF's Package Manager.

Then I changed these settings:

Enable local storage of cookies = Disabled
Use subdomain independent cookies = Enabled
Portal Mode = Standalone
Standalone URL = http://untamedheart.us/index.php

Then I moved PortalStandalone.php file to /home/klonfsmj/public_html and renamed it index.php.

Here is the list of the stuff I have on the /home/klonfsmj/public_html
Code: [Select]
forums (Folder)
error_log
.htaccess
index.php (renamed PortalStandalone.php)
php.ini
Title: Re: Can't vote, Can't login through the portal
Post by: Chen Zhen on April 29, 2015, 09:18:57 PM
Default login cookies length (in minutes) -1
Use database driven sessions = Enabled
browsers to go back to cached pages = Enabled

Are the above session/cookie settings enabled?
Title: Re: Can't vote, Can't login through the portal
Post by: Rupurudu! on April 29, 2015, 09:22:47 PM
Default login cookies length (in minutes) -1
Use database driven sessions = Enabled
browsers to go back to cached pages = Enabled

Are the above session/cookie settings enabled?
Yes, they are enabled.
Title: Re: Can't vote, Can't login through the portal
Post by: Chen Zhen on April 29, 2015, 09:49:56 PM
Server Settings -> Database and Paths

Do you have something entered within the inputs for the following.. ?? :
Database username to use in SSI mode
Database password to use in SSI mode

Usually these can be left blank but I suppose you can enter the identical db login info that your forum is using.
This should force it to use the same db+session for SSI.php (which the standalone is using).
Title: Re: Can't vote, Can't login through the portal
Post by: Rupurudu! on April 29, 2015, 11:47:38 PM
Done. But still the same error.  :(
Title: Re: Can't vote, Can't login through the portal
Post by: Chen Zhen on May 02, 2015, 12:03:50 AM
Rupurudu!,

  The only other thing I can think of at the moment is your .htaccess file somehow being configured to disable cookies for that specific directory or perhaps another one in the forum directory to allow them. To test this just copy the .htaccess file from your /home/klonfsmj/public_html path to your computer's hdd via an FTP application and then delete the original. Test your home page login after that and if it works then you know it is the .htaccess file causing the issue.

  Failing that I have exhausted every idea I can think of for the moment. With appropriate access (ie. FTP & SMF Admin) I could poke around and test some adjustments via trial & error but that is up to you to go that route.

Regards. 
Title: Re: Can't vote, Can't login through the portal
Post by: Rupurudu! on May 02, 2015, 01:37:40 PM
Rupurudu!,

  The only other thing I can think of at the moment is your .htaccess file somehow being configured to disable cookies for that specific directory or perhaps another one in the forum directory to allow them. To test this just copy the .htaccess file from your /home/klonfsmj/public_html path to your computer's hdd via an FTP application and then delete the original. Test your home page login after that and if it works then you know it is the .htaccess file causing the issue.

  Failing that I have exhausted every idea I can think of for the moment. With appropriate access (ie. FTP & SMF Admin) I could poke around and test some adjustments via trial & error but that is up to you to go that route.

Regards.
Here is my .htaccess file, it's not very complicated:
Code: [Select]
DirectoryIndex index.php
ErrorDocument 404 /index.php
suPHP_ConfigPath /home/klonfsmj/public_html
And for the admin access, Did you have Skype (or a chat program like Skype) we can talk?
Title: Re: Can't vote, Can't login through the portal
Post by: Rupurudu! on May 05, 2015, 10:41:03 AM
Bump.
Title: Re: Can't vote, Can't login through the portal
Post by: ccbtimewiz on May 05, 2015, 12:38:17 PM
In summary, you're using Standalone Portal Mode, with the standalone file on the root of your website while your forums are located on the sub-domain "forums".

Under normal conditions it would work if you disable the local storage of cookies, but it seems that wasn't a solution for you. If you're willing to, can you try submitting the information for your portal through this link and see if the problem still occurs?

http://forums.untamedheart.us/index.php?action=portal
Title: Re: Can't vote, Can't login through the portal
Post by: Rupurudu! on May 05, 2015, 06:16:54 PM
In summary, you're using Standalone Portal Mode, with the standalone file on the root of your website while your forums are located on the sub-domain "forums".

Under normal conditions it would work if you disable the local storage of cookies, but it seems that wasn't a solution for you. If you're willing to, can you try submitting the information for your portal through this link and see if the problem still occurs?

http://forums.untamedheart.us/index.php?action=portal
Yes, It works under this mode.
Title: Re: Can't vote, Can't login through the portal
Post by: Rupurudu! on May 06, 2015, 07:41:06 AM
I fixed the issue myself. Here's how to fix this if you are having the same issue:

Most of the hosting providiers and even most of the pre-compiled php servers now include a security extension named "Suhosin Extension"

It's messing with SMF's session system by invalidating SMF's session cookies, which is critical to SimplePortal.

Here's the code to disable it, add it to "php.ini":
Code: [Select]
; Turn off Suhosin's session encrption.  SMF is a big boy, it doesn't need its hands held.
suhosin.session.encrypt = Off
; Also turn off the cookie encryption. It's probably not needed, but better safe than sorry.
suhosin.cookie.encrypt= Off

Note that this will only disable session and cookie encryption, other parts of the extension works without issues.
Title: Re: Can't vote, Can't login through the portal
Post by: ♦ Ninja ZX-10RR ♦ on May 06, 2015, 07:55:26 AM
Glad that you solved and that you posted the solution as well. Thank you!
Title: Re: Can't vote, Can't login through the portal
Post by: Chen Zhen on May 06, 2015, 04:49:33 PM
Rupurudu!,

  My apologies but I have been rather busy as of late and am glad to see that you found a solution.
I wonder if there is another way to do it within PHP without having to configure its settings file for those that do not have access to that file.
There are no available suhosin settings within ini_set() but there are cookies & session settings available.
I am going to attempt to duplicate your issue by enabling those settings on a local test site & try experimenting with other available settings.

Available settings are shown with this command:
Code: [Select]
print_r(ini_get_all());

Regards.
Title: Re: Can't vote, Can't login through the portal
Post by: Rupurudu! on May 08, 2015, 09:11:14 AM
Rupurudu!,

  My apologies but I have been rather busy as of late and am glad to see that you found a solution.
I wonder if there is another way to do it within PHP without having to configure its settings file for those that do not have access to that file.
There are no available suhosin settings within ini_set() but there are cookies & session settings available.
I am going to attempt to duplicate your issue by enabling those settings on a local test site & try experimenting with other available settings.

Available settings are shown with this command:
Code: [Select]
print_r(ini_get_all());

Regards.
Okay. This is the code without the fix applied.
Title: Re: Can't vote, Can't login through the portal
Post by: Chen Zhen on May 08, 2015, 10:31:56 PM
Although the suhosin settings appear in that list of commands, I have read it will not affect it if changed via ini_set().
However it appears adding 1 line within your .htaccess file would have also solved the issue.
Code: [Select]
php_value suhosin.cookie.encrypt 0

What I was previously mentioning was to somehow force the cookie behaviour manually within the standalone file.
I have yet to test the idea.
Title: Re: Can't vote, Can't login through the portal
Post by: Rupurudu! on May 09, 2015, 02:56:04 AM
Although the suhosin settings appear in that list of commands, I have read it will not affect it if changed via ini_set().
However it appears adding 1 line within your .htaccess file would have also solved the issue.
Code: [Select]
php_value suhosin.cookie.encrypt 0

What I was previously mentioning was to somehow force the cookie behaviour manually within the standalone file.
I have yet to test the idea.
The code is wrong. The important one is session.encrypt not the cookie.encrypt.

Code: [Select]
php_value suhosin.session.encrypt 0
php_value suhosin.cookie.encrypt 0

Also, not everyone uses Apache server. I'm using IIS on one of my forums and it don't have .htaccess
SimplePortal 2.3.8 © 2008-2024, SimplePortal