after login I can't do anything

General questions about CMSimple
cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: after login I can't do anything

Post by cmb » Mon Mar 12, 2012 11:06 pm

Hi Rob,

the most important thing is, that the problem is solved and you can go ahead with the website. :)

About editing the files: you can use whatever editor you prefer. The only requirement for the editor: it has to give the option to store the files as UTF-8 without BOM. I guess all but the simplest editors allow to do so (famous exception: Windows Notepad), perhaps even the editor of your FTP client (you can have a look at its options). Or perhaps you can choose another editor as editor for your FTP client (as is described for FileZilla/Notepad++ here: http://linhost.info/2008/01/notepad-and-filezilla-tip/).

I for myself like editing files online on my server too, instead of download, edit, upload. Fortunately I can do this with my familiar editor (Komodo Edit -- probably a bit heavyweight for occasional editing) by "Open Remote File". A nice alternative too.

Christoph
Christoph M. Becker – Plugins for CMSimple_XH

roze
Posts: 270
Joined: Tue Jun 03, 2008 7:13 am
Location: NL
Contact:

Re: after login I can't do anything

Post by roze » Tue Jun 10, 2014 8:08 pm

again the same issue :cry:

I made a fresh upload cmsimple 443

the default password works.
when I want to change it in the CMS setting, the back-end menu disappears.

I didn't change anything in a file. Can someone give me advise?

www.psychologiedommelen.nl
Rob Zeijen,

Valkenswaard (NL)

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: after login I can't do anything

Post by cmb » Tue Jun 10, 2014 8:34 pm

roze wrote:when I want to change it in the CMS setting, the back-end menu disappears.
The problem is that the login cookies are not sent back to the server, so effectively you are not logged in at all.

The details are that the path the cookies are valid for, is wrong. It is /psychologiedommelen/, but it shoud be /. (When I change the cookie this way in the browser manually, I stay logged in.) It is arguable whether this is a deficiency of CMSimple 4.x or of your server's setup. I assume, however, that CMSimple_XH would work on your server.

Anyway, you can use the following quick fix: remove all CMSIMPLE_ROOT parameters to setcookie() in cmsimple/login.php (there are 5 occurences). For instance change line 113 from

Code: Select all

        setcookie('status' . str_replace('.','xc6oMd3Rs689',str_replace('index.php','',$sn)), 'adm', 0, CMSIMPLE_ROOT);
to

Code: Select all

        setcookie('status' . str_replace('.','xc6oMd3Rs689',str_replace('index.php','',$sn)), 'adm', 0);
This should suffice to be able to log in. However, besides that you might not be able to run multiple CMSimple installations on that domain, there might be other issues caused by CMSIMPLE_ROOT being defined wrong. So maybe it's better to simply fix CMSIMPLE_ROOT instead of fixing the setcookie() calls. Replace line 53 in cmsimple/cms.php

Code: Select all

define('CMSIMPLE_ROOT', $cmsimpleRootVarNew);
with

Code: Select all

define('CMSIMPLE_ROOT', '/');
Note, that this way you definitely can't have more than one CMSimple installation on this domain.
Christoph M. Becker – Plugins for CMSimple_XH

Gert
Posts: 3078
Joined: Fri May 30, 2008 4:53 pm
Location: Berlin
Contact:

Re: after login I can't do anything

Post by Gert » Tue Jun 10, 2014 8:36 pm

Gert Ebersbach | CMSimple | Templates - Plugins - Services

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: after login I can't do anything

Post by cmb » Tue Jun 10, 2014 9:00 pm

Thanks for looking up the old thread. :)
roze wrote:With my "old" cmsimple_XH I had acces to the backend after login in haptonomiedommelen.nl
One might regard the change in CMSimple 4 as a regression bug.
Christoph M. Becker – Plugins for CMSimple_XH

roze
Posts: 270
Joined: Tue Jun 03, 2008 7:13 am
Location: NL
Contact:

Re: after login I can't do anything

Post by roze » Tue Jun 10, 2014 9:42 pm

Thankx,

I used this workaround:

Code: Select all

Replace line 53 in cmsimple/cms.php
CODE: SELECT ALL
define('CMSIMPLE_ROOT', $cmsimpleRootVarNew);
with
CODE: SELECT ALL
define('CMSIMPLE_ROOT', '/');
Rob Zeijen,

Valkenswaard (NL)

Gert
Posts: 3078
Joined: Fri May 30, 2008 4:53 pm
Location: Berlin
Contact:

Re: after login I can't do anything

Post by Gert » Tue Jun 10, 2014 10:12 pm

cmb wrote:One might regard the change in CMSimple 4 as a regression bug.
No :!:

If the site is called "www.anything.tld" - $_SERVER['SCRIPT_NAME'] has to be "/index.php", and not "/anything/index.php".

The real reason for that problem is the wrong handling of multiple domains on "not multiple domain capable" webspace. The result is a wrong $_SERVER['SCRIPT_NAME']. That may cause further problems, when ever $_SERVER['SCRIPT_NAME'] is used in a script, maybe a plugin.

That's why it is the better way to fix $_SERVER['SCRIPT_NAME'] at first in the cms.php:

Code: Select all

$_SERVER['SCRIPT_NAME'] = str_replace('/psychologiedommelen', '', $_SERVER['SCRIPT_NAME']);
$_SERVER['PHP_SELF'] = str_replace('/psychologiedommelen', '', $_SERVER['PHP_SELF']); 
... for that crazy server, this way also subsites and second languages will work,

Gert

PS: Hi Rob,

please ask your Provider, why $_SERVER['SCRIPT_NAME'] is "/psychologiedommelen/index.php" on http://www.psychologiedommelen.nl - and not "/index.php", as is should.

Same problem with other server variables ...
Gert Ebersbach | CMSimple | Templates - Plugins - Services

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: after login I can't do anything

Post by cmb » Wed Jun 11, 2014 10:50 am

Gert wrote:If the site is called "www.anything.tld" - $_SERVER['SCRIPT_NAME'] has to be "/index.php", and not "/anything/index.php".
RFC 3875, section 4.1.13:
4.1.13. SCRIPT_NAME

The SCRIPT_NAME variable MUST be set to a URI path (not URL-encoded)
which could identify the CGI script (rather than the script's
output). The syntax is the same as for PATH_INFO (section 4.1.5)

SCRIPT_NAME = "" | ( "/" path )

The leading "/" is not part of the path. It is optional if the path
is NULL; however, the variable MUST still be set in that case.

The SCRIPT_NAME string forms some leading part of the path component
of the Script-URI derived in some implementation-defined manner. No
PATH_INFO segment (see section 4.1.5) is included in the SCRIPT_NAME
value.
This is vague, and so does not disallow "/anything/index.php" here.

The PHP manual even says:
'SCRIPT_NAME'
Contains the current script's path. This is useful for pages which need to point to themselves. The __FILE__ constant contains the full path and filename of the current (i.e. included) file.
According to this "definition" SCRIPT_NAME is likely to be set correctly on Rob's domain (depending on DOCUMENT_ROOT).
Gert wrote:The real reason for that problem is the wrong handling of multiple domains on "not multiple domain capable" webspace. The result is a wrong $_SERVER['SCRIPT_NAME']. That may cause further problems, when ever $_SERVER['SCRIPT_NAME'] is used in a script, maybe a plugin.
There are, however, solutions that don't rely on SCRIPT_NAME for these purposes (i.e. URL construction).
Gert wrote:That's why it is the better way to fix $_SERVER['SCRIPT_NAME'] at first in the cms.php:

Code: Select all

$_SERVER['SCRIPT_NAME'] = str_replace('/psychologiedommelen', '', $_SERVER['SCRIPT_NAME']);
$_SERVER['PHP_SELF'] = str_replace('/psychologiedommelen', '', $_SERVER['PHP_SELF']);
ACK. At least that's better than my former suggestion to fix CMSIMPLE_ROOT.
Christoph M. Becker – Plugins for CMSimple_XH

roze
Posts: 270
Joined: Tue Jun 03, 2008 7:13 am
Location: NL
Contact:

Re: after login I can't do anything

Post by roze » Thu Jul 24, 2014 10:02 pm

I've installed CMSimple 4.4.4 Released: 2014-07-21

for a website http://www.praktijkdommelen.com

I've changed in cms.php (because of the problems above):

Code: Select all

$_SERVER['SCRIPT_NAME'] = str_replace('/praktijkdommelen', '', $_SERVER['SCRIPT_NAME']);
$_SERVER['PHP_SELF'] = str_replace('/praktijkdommelen', '', $_SERVER['PHP_SELF']);
later I've tried

Code: Select all

Replace line 53 in cmsimple/cms.php
CODE: SELECT ALL
define('CMSIMPLE_ROOT', $cmsimpleRootVarNew);
with
CODE: SELECT ALL
define('CMSIMPLE_ROOT', '/');
in both situations I get a blanco page when I want to login (i've already changed the password)

Is there a solution?
Rob Zeijen,

Valkenswaard (NL)

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: after login I can't do anything

Post by cmb » Thu Jul 24, 2014 10:18 pm

roze wrote:in both situations I get a blanco page when I want to login (i've already changed the password)
Have you tried CMSimple_XH 1.6.2? I suppose that it'll work on your server without the need for any (repeated) customizations.
Christoph M. Becker – Plugins for CMSimple_XH

Post Reply