Roundcube Community Forum

Release Support => Pending Issues => Topic started by: gnarl on July 12, 2007, 11:49:28 AM

Title: after successful login, the login page just reloads.
Post by: gnarl on July 12, 2007, 11:49:28 AM
After successfully logging in the login page is reloaded. URL shows "http://webmail.domain.com/?_task=mail"

System: Win2k3, IIS6, PHP 5.2.3, MySQL 5.1.19-beta, hmailserver 4.4-b270

I know that the SQL connection is working b/c I can create a new user in hmail, login as that user, and roundcube's db tables get updated for the new user. I also get a failed login if I use a non-existant hmail user.

There are no logged errors for IIS, PHP, or MySQL, but I can generate them by using bogus data or bad settings in various places.

I've tried everything that I can think of, and my guess is that it this a PHP issue somewhere. But I am new enough to PHP to not have the knowledge to look into it in any depth.

I put in a ticket, and it was suggested that it was prolly a session issue, which is where my thought process was leading. I am just out of ideas for what to look at next. Anyone have any suggestions?
Title: Re: after successful login, the login page just reloads.
Post by: SKaero on July 12, 2007, 11:53:23 AM
Is there any data in the session table?
Title: Re: after successful login, the login page just reloads.
Post by: gnarl on July 12, 2007, 12:27:35 PM
yup...it even matches the cookie. They're obviously getting created.
cookie...

sessid
2nslcsf99smc0lhku5d4ekscc5
webmail.domain(changed).com/
1024
3687872768
29869217
288057360
29869215
*

session table data...

2nslcsf99smc0lhku5d4ekscc5    
2007-07-12 09:09:46    
2007-07-12 09:09:46    
192.168.10.2    
user_lang|s:5:"en_US";auth_time|i:1184256586;temp|b:1;task|s:4:"mail";
Title: Re: after successful login, the login page just reloads.
Post by: rknetwork on July 12, 2007, 11:53:13 PM
Quote from: gnarl
After successfully logging in the login page is reloaded. URL shows "http://webmail.domain.com/?_task=mail"

Exactly same issue. Same IIS, PHP and MySQL.

Also: mysql5_initial.sql, mysql_initial.sql, mysql_update.sql scripts wont work.

Sounds like a major bug...
Title: Re: after successful login, the login page just reloads.
Post by: gnarl on July 12, 2007, 11:57:26 PM
What happens to the scripts?

They ran fine for me after I turned off strict mode.

I'm assuming that not using strict mode has nothing to do with my problem since that is the default install behavior for the *nix's.
I'd love for someone to tell me I'm wrong though. This is driving me nuts.
Title: Re: after successful login, the login page just reloads.
Post by: SKaero on July 13, 2007, 12:03:36 AM
Quote
Also: mysql5_initial.sql, mysql_initial.sql, mysql_update.sql scripts wont work.
That would be a error on your end, that means you don't have access to the database.
Title: Re: after successful login, the login page just reloads.
Post by: gnarl on July 13, 2007, 02:18:43 PM
OK...this is fixed now. I don't know how.
I am very confused and more than a little nervous about it.

I went through my php.ini and changed a bunch of settings and it started to work.
I then went back and reverted to the ini file from b4 I made any changes, so that I could checklist my way back to whichever setting was causing the problem.

Guess what? The previous php.ini now works. Go figure...
Title: Re: after successful login, the login page just reloads.
Post by: rknetwork on July 21, 2007, 04:11:43 PM
Quote from: SKaero
Quote
Also: mysql5_initial.sql, mysql_initial.sql, mysql_update.sql scripts wont work.
That would be a error on your end, that means you don't have access to the database.

All privileges are given.

===============
User 'webmail'@'localhost' - Database webmail : Edit Privileges

Database-specific privileges
Database    Privileges    Grant    Table-specific privileges
webmail    ALL PRIVILEGES    No    No
===============

C:\Documents and Settings\Administrator>mysql -u webmail -p
Enter password: ************************

mysql> connect webmail
Connection id:  363
Current database: webmail

mysql> source D:\Websites\Server\roundcubemail\SQL\mysql5.initial.sql
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.03 sec)

ERROR 1101 (42000): BLOB/TEXT column 'preferences' can't have a default value
Query OK, 0 rows affected, 1 warning (0.02 sec)

Query OK, 0 rows affected, 1 warning (0.05 sec)

Query OK, 0 rows affected, 1 warning (0.01 sec)

Query OK, 0 rows affected, 1 warning (0.03 sec)

Query OK, 0 rows affected (0.00 sec)

mysql> source D:\Websites\Server\roundcubemail\SQL\mysql.update.sql
ERROR 1091 (42000): Can't DROP 'body'; check that column/key exists
ERROR 1060 (42S21): Duplicate column name 'html_signature'
Title: Re: after successful login, the login page just reloads.
Post by: gnarl on July 21, 2007, 04:25:14 PM
Ahh...Try going into your my.ini and turn off SQL strict mode.
mySQL 5 seems to enable strict mode by default with the windows install.

Title: Re: after successful login, the login page just reloads.
Post by: rknetwork on July 21, 2007, 05:59:45 PM
Quote from: gnarl
OK...this is fixed now. I don't know how.
I am very confused and more than a little nervous about it.
Guess what? The previous php.ini now works. Go figure...

I got it...

; Initialize session on request startup.
session.auto_start = 1

Set to 0 and roundcubemail works!

Developers: please fix...
Title: Re: after successful login, the login page just reloads.
Post by: rknetwork on July 21, 2007, 06:29:19 PM
Quote from: gnarl
Ahh...Try going into your my.ini and turn off SQL strict mode.
mySQL 5 seems to enable strict mode by default with the windows install.

That worked.

Thanks.
Title: Re: after successful login, the login page just reloads.
Post by: gnarl on July 26, 2007, 04:31:35 PM
Quote from: gnarl
OK...this is fixed now. I don't know how.
I am very confused and more than a little nervous about it.

I went through my php.ini and changed a bunch of settings and it started to work.
I then went back and reverted to the ini file from b4 I made any changes, so that I could checklist my way back to whichever setting was causing the problem.

Guess what? The previous php.ini now works. Go figure...

Well...as I feared might happen, this has started again.

I still think it is a session problem of some kind.

It's clearly Roundcube specific as I have no problem with b2e or phpbb.

Any idea's?
Title: Login problem
Post by: gnarl on July 26, 2007, 05:43:52 PM
I think I have a different login problem now.

After a successful login, the login page just reloads.
I know I can connect to both the mail and roundcube db's. If I create a new user in hmailserver and log into roundcube, that user will be created in the roundcube db.

Both the php and roundcube sessions get written to the files directory and the cookie, but the roundcube session doesn't get written to the roundcube db.

Do I have something set wrong in php?
Title: Re: Login problem
Post by: gnarl on July 27, 2007, 02:46:44 AM
Quote from: gnarl
I think I have a different login problem now.

After a successful login, the login page just reloads.
I know I can connect to both the mail and roundcube db's. If I create a new user in hmailserver and log into roundcube, that user will be created in the roundcube db.

Both the php and roundcube sessions get written to the files directory and the cookie, but the roundcube session doesn't get written to the roundcube db.

Do I have something set wrong in php?

Ok...I got it to write the session data back to the db by dropping and re-creating the db.

Now I have session data in the db that matches the cookie, but I am still seeing just the login page after a successful login. No errors in any logs.

Win2k3, PHP 5.2.3, mySQL 5.1.19, Roundcube rc-1
Title: Re: Login problem
Post by: SKaero on July 27, 2007, 05:19:48 AM
Hmm I think you maybe having this problem: http://roundcubeforum.net/forum/index.php?topic=1853.0
Title: Re: Login problem
Post by: gnarl on July 27, 2007, 12:25:55 PM
Maybe. It's consistent though.
I'm going to try strategically placing some echo's into the code and see if I can't narrow down where it's failing.

I'll post back if I find anything.
Title: Re: Login problem
Post by: gnarl on July 28, 2007, 06:33:37 AM
Well, putting breaks in the code just confirmed what I already thought.
The session was getting hosed.

I found this http://roundcubeforum.net/forum/index.php?topic=1660.0 (http://roundcubeforum.net/forum/index.php?topic=1660.0) thread and commenting the below suggested lines from index.php, at least lets me log in.

  // create new session ID
  unset($_SESSION['temp']);
  sess_regenerate_id();

I foresee this becoming a problem as a long-term fix, but for now, I'm ok with it.
I don't see anything blatantly wrong with the code, but I'm not one to argue with results.
Someone who's more familiar with roundcube's code should probably take a look at the session verification and see what would cause it to kill valid sessions.
Title: Re: after successful login, the login page just reloads.
Post by: gnarl on July 28, 2007, 03:30:58 PM
Cross-posted...My bad...

interim solution here. http://roundcubeforum.net/forum/index.php?topic=1953.0 (http://roundcubeforum.net/forum/index.php?topic=1953.0)
Title: Re: after successful login, the login page just reloads.
Post by: SKaero on July 28, 2007, 05:44:41 PM
Merge Topics ;)
Title: Re: after successful login, the login page just reloads.
Post by: yinrunning on September 20, 2007, 04:01:51 PM
is the user table for RC supposed to have something in it after a fresh install??? mine is blank, and I can't login even though my hMail logging clearly shows a successful login followed by an immediate logout. the Session in DB and the Cookie are both being created...
Title: Re: after successful login, the login page just reloads.
Post by: Melted on October 31, 2007, 03:49:43 AM
Quote from: rknetwork
I got it...

; Initialize session on request startup.
session.auto_start = 1

Set to 0 and roundcubemail works!

Developers: please fix...

Just wanted to bump this. I had tried Roundcube on several unix boxes trying to get it to work with the login-loop on each. This solved the issue for me.

It would be nice to have it work without changing the php.ini file... other than that, great software.
Title: Re: after successful login, the login page just reloads.
Post by: micha on November 12, 2007, 06:24:53 AM
Maybe this is the problem what you are searching for:
http://roundcubeforum.net/forum/index.php?topic=2376.msg9459

Micha
Title: Re: after successful login, the login page just reloads.
Post by: elephant on November 12, 2007, 11:52:06 AM
I found a fix for this problem.
In program/include/session.inc one can see:

Code: [Select]
$cookie = session_get_cookie_params();
 setcookie(session_name(), $random, $cookie['lifetime'], $cookie['path']);

However, $cookie['lifetime'] means cookie lifetime in seconds and using it like this sets cookie expiration
to a few seconds after 1/1/1970, 00:00:00

the line should be:
Code: [Select]
setcookie(session_name(), $random, time()+$cookie['lifetime'], $cookie['path']);

it worked well under Firefox and Safari.