Page 1 of 1

problems logging in and out

Posted: Wed Aug 08, 2007 2:03 am
by pez
I've installed cms made simple and installer told me sessions were not enabled marking as a yellow ball, it was strange because currently session are enabled in my php5 installation but as it was just a warning I proceed to install and installation finished all right.

(note: I know sessions are enabled because phpinfo() says that and I see session files are created when I access cms pages)

I can access my cms installation but when following the link to log in administration section I got the login page and after introducing right user and password it redirects to the same page (login page) once and another.

If I edit admin/login.php in a way I send data to browser at the begining of file (for example: echo("one"); ) then login page writes a pair of warnings saying it cannot modify header information because header is already sent but now it logs in correctly redirect me to admin page.

Now, when I try to log out it doesn't rediret me to login page, standing in admin page no matter how many times I click on logout. But If I delete the cookie of the site then I can logout redirecting me properly to login page.

Any idea of what is the problem?

thanks

Re: problems logging in and out

Posted: Thu Aug 09, 2007 4:53 am
by pez
I really have no idea about this problem. Is it a bug?

Sessions are working fine in php5 installation, I've done a short php script to test it and all is ok.  Use_trans_sid is activated, may this be the problem?  is CMS made simple prepared to use trans sid?

I'm lost about this situacion CMSMS seems not to update session vars so it cannot redirect properly when logging in or logging out

Re: problems logging in and out

Posted: Thu Aug 09, 2007 1:41 pm
by Pierre M.
Hello,

About sessions : session files created are a good hint to say sessions are set up OK. But there are a dozen or so php.ini settings about sessions and cookies. Please review all of them carefully, not just session path.

Sorry to ask this, but you haven't written your (supported?) browser accepts session cookies. Please check this.

Do you have another session enabled PHP-SQL app running OK, like phpBB ?

To investigate further (if needed), we will need more information from you, as explained in the sticky thread about asking questions : versions, hosting provider, operating system, webserver, PHP engine, database engine, installation method, steps OK, not green lights, etc.

Pierre M.

Re: problems logging in and out

Posted: Fri Aug 10, 2007 3:10 pm
by pez
Ok, sorry because I had to read that sticky post first. Let me rewrite the question:

Environment:

I'm using Linux Debian 4.0 testing with kernel 2.6.21.3,  cms made simple 1.1, mysql 5.0.32-7, php5 version 5,2,3-1, webserver cherokee 0.5.5.dfsg-2 using php as cgi, browsers used iceweasel, opera (both on linux)

CMS Made Simple is installed in my own computer, as a virtual host defined in Cherokee conf file and with hostname defined in hosts file. Installation finished ok with only yellow ball warning about sessions. All browsers tested support sessions (iceaweasel (firefox) and opera)

Installation process:

Check page (the one checking items and making it with red, yellow or green balls) says all is ok (green balls) except sessions wich are marked with yellow ball.  This is strange because sessions are enabled in php.ini, but check page says this is not a needed feature and let you continue with installation, so I proceed with installation and it finished ok, that is successfully. I can view my cms home page.

The problem:

After installation you get a cms home page with a welcome text, in forth paragraph you can read 'If you are right now on your own default install, you can probably just click this link.' when clicking on link you are redirected to a login page asking for user and password, there I try to login as 'admin' ('admin' is the user I set up in installation process as admin user), type in right user name and password but login page does not rediret me to admin page but redirects again to login page, and this for ever and ever

I can hack this behaviour if I edit file admin/login.php and include a sentence to send text to browser first, for example "echo 'hello';". Doing this login page now redirects properly when loging in as admin.
But now standing at admin page when I try to logout it doesn't redirect me to login page but still continues redirecting me to admin home page.
I can only force redirection from admin page to login page after a logout if I remove session file from session path defined in php.ini OR if i delete the cookie from the cms made simple site.

How to reproduce:

1 - write url to your installation of cms made simple in your browser
2 - cms home page appear, now go to the link 'this link' in text 'you can probably just click this link.' just before title 'Learning CMS Made Simple'
3 - you go to login page 'Admin access to cms made simple' and you are requested to type in user and password
4 - type in user and password you've set up for admin access in your installation process and push send button
5 - you should be redirected to admin home page but you got trapped in login page (login.php)

More info:

I have tested phpBB version 3,0-RC4 and working ok, I also have coded a tiny php test 's.php' and running ok:

Code: Select all

<?php
session_start();

if (!isset($_SESSION['name'])) {
        $_SESSION['name'] = 'a_name';
        $_SESSION['count'] = 0;
} else {
        echo $_SESSION['name'];
        $_SESSION['count']++;
}
echo $_SESSION['count'];
?>

session id: <?php echo SID ?>
first time I load page s.php with no session file created and no cookies from this site, it shows:
0 sesion id: PHPSESSID=e71c88f839deb4f58d8c69cb4a2c42d7

which is ok. Further loadings of page s.php show incremented counter and no id (because it is stored in the cookie):
a_name1 sesion id:

If I first load page s.php with no session file but with a cookie from that site stored in my computer I got:
0 sesion id:

which means it gets the session id from the cookie but has no session file so it has no session var saved, that is the reason 'a_name' not appearing.

My php.ini settings about sessions I consider relevant for the problem are this:


session.save_handler = files
session.save_path = /var/lib/php5          # path to store session files, it is a sticky directory for all (permisions: rwx-wx-wt)
                                                              # (also tested changing this to /tmp/sessions (permisions: rwxrwxrwx) with same behaviour)
session.use_cookies = 1                        # php code can use cookies to store session id
session.name = PHPSESSID                 # name for the cookie, but I've checked CMSMS uses CMSSESSIDe75759ff as cookie name
session.auto_start = 0                            # this forces php code to explicity init a session
session.cookie_lifetime = 0                    # this makes cookies alife unti browser is closed
session.use_trans_sid = 1                     # trans sid activated  (also tested setting this to 0 with same behaviour)
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset="              # html tags to be rewritten using trans sid


As you can see I have sessions enabled using path /var/lib/php5 to store session files and also have cookies anabled to store sessions id. Life for a session is for ever (until you close the browser), sessions must be explicity initialized by php code and I'm using trans id to handle trasitively session id's

I think the problem is session file stored by CMS MS login page always contains the redirect url "/admin/login.php" rather than /admin/index.php as it should.

cookie stored:
redirect_url|s:16:"/admin/login.php";





Note:
My full php.ini settings about sessions are this:

session.save_handler = files
session.save_path = /var/lib/php5
session.use_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_divisor     = 100
session.gc_maxlifetime = 1440
session.bug_compat_42 = 1
session.bug_compat_warn = 1
session.referer_check =
session.entropy_length = 0
session.entropy_file =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 1
session.hash_function = 0
session.hash_bits_per_character = 4
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset="

Re: problems logging in and out

Posted: Fri Aug 10, 2007 6:57 pm
by Pierre M.
Hello again,

here are some feelings in response to your post. I hope some are helpfull :

-I don't know "webserver cherokee". As far as I know, it is not a CMSms supported webserver. May be you have just discovered that no one knows its configuration for running CMSms. If you require this particuliar webserver, you have to investigate alone. I hope you can switch to lighty or Apache (may be behind a cherokee proxy if your non CMSms requirements are cherokee only).

-Your browsers "support" sessions : but does your browser accept session coookies ? What do you see in the "cookies" window in Firefox ? Is it the same with phpBB or so ?

-The installer says it all : there is an issue with sessions. I still think the config linking your unsupported webserver and your PHP about sessions is not finished. Let us hope another cherokee webserver user will help you. As you code, you can have a look at the code diagnosing your sessions are not ok with a yellow warning and discover why it is not all green.

Pierre M.

Re: problems logging in and out

Posted: Fri Aug 10, 2007 6:59 pm
by Dr.CSS
Wow, now that's the way to write up your problem... :)

Re: problems logging in and out

Posted: Sat Aug 11, 2007 12:13 am
by pez
Ok, I will test Apache and lighthttp but it should work with cherokee because I'm using PHP as CGI and so it is not server dependant. Anyway I will check.

About browsers both opera and firefox are compatible with sessions. My firefox session window shows two sessions: [glow=red,2,300]cms_language[/glow] and [glow=red,2,300]CMSSESSIDe75759ff[/glow]

attributes of cms_language is:
Name:        cms_language
Content:     en_US
Host:           cmsmadesimple.es
Path:           /admin/
Send For:  Any type of connection
Expires:     at end of session

attributes of CMSSESSIDe75759ff is:
Name:       CMSSESSIDe75759ff
Content:    543b6334ea6a52b5df747a6aaac32117
Host:           cmsmadesimple.es
Path:           /
Send For:  Any type of connection
Expires:     at end of session

opera shows the same info.

Re: problems logging in and out

Posted: Sat Aug 11, 2007 11:34 am
by Pierre M.
Hello again,

I agree a CGI PHP is a safe way. But I'm not able to debug it.

Quickly looking at the Firefox cookies window of a 1.1RC2 (I have no true 1.1 at hand, sorry), I'm seeing 4 cookies, not 2 :
CMSSESSIDalphanum (like you),
cms_language (like you),
cms_admin_user_id, set to "1",
cms_passhash, set with anotheralphanum.

These two missing cookies (with same path as cms_language) may be the clue ? unless 1.1 has much changed since RC2.
What about checking your DNS and hosts/vhosts config ? you have c.es and I have host.domain.fr
Hope this helps

Pierre M.