Login does not work - Any suggestions?

MJK

Joined: 2008-09-07
Posts: 9
Posted: Sun, 2008-09-07 18:57


Gallery version: 2.2
PHP version: 4.4.7
Webserver: Apache
Database: MySQL 5.0.45
Operating system: Debian
Browser (e.g. Firefox 2.0): Windows Internet Explorer 7

http://www.kales.tv/gallery2/

Hi, When I try to login to my gallery I somehow continue to return to the initial main.php. I have tried deleting all cookies, cleared the cache, retried progressing trough the upgrade process (without errors), but still am not able to log-in to my gallery. Debugging does not give me any errors.

Please find the debug logs attached.

Appreciate any guidance on how-to get this resolved!!

AttachmentSize
debug1.txt13.72 KB
debug 2 -back to main.php_.txt27.46 KB
 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 25936
Posted: Mon, 2008-09-08 18:30

Recently there has been issus with people trying to loggin with IE. We are investigating and in the mean time try FF browser.

Dave

_____________________________________________
Blog & G2 || floridave - Gallery Team

 
dprall

Joined: 2008-09-07
Posts: 15
Posted: Mon, 2008-09-08 19:20

Dave,
I've tried IE 6.0.2900.2180.xpsp_sp2_qfe.070227-2300 and Firefox 3.0.1 on my site from my Corporate XP System. I've also tried IE 7 and FF 3.0.1 from my Windows 2008 Server at home. I even pulled out a Mac OSX 10.4 system with Safari 3.1.1 on it. None of them can login to my system at home. I turned on debugs, but nothing jumped out at me. But I'd be willing to do it again if it would help. It is a 2.3-rc1 system just about every plugin/addon installed for a personal site, with MYSQL 5.0.67, PHP 5.2.6, Apache 2.0.63. Only user is admin.

David

 
MJK

Joined: 2008-09-07
Posts: 9
Posted: Mon, 2008-09-08 21:25

Dave, I have tried logging in trough Firefox, but still experienced the same problem, so it seems my issue is not related to IE7.

Any other ideas on how-to get round this?

Regards,
Martin

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Mon, 2008-09-08 22:17

Martin,

Sorry to butt in.

looking at your debug logs it appears that the session data set by your login (in the first debug text the userId for your session is set to 6, the admin user) is not being read back in correctly (the same session id is coming back with userId 5, the guest user, in the second debug txt. I'm not sure why at this point.

If you get a debug trace like that next time, you can look in the g2_sessionsMap db table and see if the userId is being written correctly. I'm sure you can figure out how the table is keyed, and link that with the cookie-value you can recover from your browser. That will tell you if it's a problem in the writing, or threading.

Also try simplifying the login process, first, by disabling the userAlbums module.

BTW Gallery 2.2 is very old at this stage, so if that's what you're using there will have been many bug-fixes in the intervening months (to 2.2.5). You should definitely upgrade (after backup), as soon as you get this sorted.

 
dprall

Joined: 2008-09-07
Posts: 15
Posted: Mon, 2008-09-08 23:24

On my system looking at g2_sessionMap db table it is empty. I deleted the cookies to see if that corrected anything, and the cookie hasn't been recreated. This is using Firefox. The system locked up after I added more memory. Have removed the memory and it is happy again, but I'm thinking the lockup might have caused some minor issues with the database. I have 11GB of pictures, but can recreate everything if necessary, but I would rather work through this. Any help appreciated. I have debugging enabled and logging to a file. The site is http://gallery.prall.org I've attempted to login via both Firefox 3.0.1 and IE6 as admin but no luck from either.

AttachmentSize
debug.zip25.74 KB
 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 25936
Posted: Tue, 2008-09-09 01:34

MJK, got you PM and see the issue now.
It looks to me like your sessions are not being saved properly.
I would like to test sessions storing and retrieval.
please add these two files to your server. Rename them without the .txt extension.
Browse to session_test.php and on reload you should see the session change its value.
then click the link, the last line should read: Session variable "abc": 1234

Dave

_____________________________________________
Blog & G2 || floridave - Gallery Team

AttachmentSize
session_test_handler.php_.txt302 bytes
session_test.php_.txt602 bytes
 
MJK

Joined: 2008-09-07
Posts: 9
Posted: Tue, 2008-09-09 18:08

Dave,
Both files are uploaded.

Output session_test.php:
Session created.

Session id regenerated: 1
Session variable "abc" set: 1234
Session id: b1781156c120e55c53aa3bcedc24f806

Follow the link to test the session variable storing:
Check session variable storing

Output after clicking the link:
Session Info.

Session id: b1781156c120e55c53aa3bcedc24f806
Session variable "abc": 1234

Seems to work ok?

Regards,
Martin

 
MJK

Joined: 2008-09-07
Posts: 9
Posted: Tue, 2008-09-09 18:36

Alec,
Tried to logon with the admin user-id once more and when I checked the g2_sessionsMap db table the session ID as in the first debug log was there. Then checked the cookie on my PC and that holds the same session ID.

Did this once more, got a different g_id which showed up in the g2_sessionMap table and also in the updated version of the cookie.

So updating the table as well as the cookie goes ok.

There are a lot of different g-id sessions in g2_sessionMap for both g_userId 5 & 6. Not sure if that is an issue?

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Tue, 2008-09-09 21:55
Quote:
Did this once more, got a different g_id which showed up in the g2_sessionMap table and also in the updated version of the cookie.

So updating the table as well as the cookie goes ok.

When you've logged in as the admin user, you should see the userId column for the row which matches your cookie contents as 6, not as 5 - that's what you need to verify.
If that's the case, the question is why is that value not being read back in on the next page load.

There will be lots of dead sessions, don't worry about it - they get removed eventually.

 
MJK

Joined: 2008-09-07
Posts: 9
Posted: Tue, 2008-09-09 22:38

Alec, the sessions in the table as well as the cookie match as 6.

Any idea what can cause it to break after this point?

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Wed, 2008-09-10 09:10
Quote:
Any idea what can cause it to break after this point?

Nope - but this would be my next thing to check ...

Add a new debug line to your GallerySession.class file, if your on 2.3RC1 at line 867, after the session data is read in from the db

		    $gallery->debug('ARM: Loaded session data: user id is ' . $this->_userId .'<br>');

(you can use your initials instead of mine if you like!) so the whole section looks like this:

	    if ($results->resultCount()) {
		$pSession = $results->nextResult();
		if ($pSession[3] > $inactiveCutoff && $pSession[2] > $lifetimeCutoff) {
		    /* A session exists and it's valid */
		    $this->_userId = (int)$pSession[0];
		    $this->_remoteIdentifier = unserialize($pSession[1]);
		    $this->_creationTime = (int)$pSession[2];
		    $this->_modificationTime = (int)$pSession[3];
		    $this->_sessionData = unserialize($pSession[4]);
		    $this->_loadedSessionData = $this->_getSerializedSession();

		    $this->_isPersistent = true;
		    $gallery->debug('ARM: Loaded session data: user id is ' . $this->_userId .'<br>');

and check the debug log at the bottom of the page after you log in. If you get "ARM: Loaded session data: user id is 6" that's good, if you get "ARM: Loaded session data: user id is 5" or something else - then I'd start to look at the caching, to see if the session contents - while correct in the db - are being cached wrongly.

EDIT: I guess the session caching is off the hook because ... there isn't any. It's always read direct from the db, as far as I can tell. Let's see what that test shows up.

 
dprall

Joined: 2008-09-07
Posts: 15
Posted: Wed, 2008-09-10 13:32

It was actually line 865 that I added this line to. I'm pretty sure I installed 2.3rc1. Here is what I get when attempting to login as admin using Firefox 3.0.1:
2008-09-10 09:24:36 [c90cffdfa7c5a49329d3b4f779dd4acd] dprall: Loaded session data: user id is 5<br>
2008-09-10 09:24:55 [c90cffdfa7c5a49329d3b4f779dd4acd] dprall: Loaded session data: user id is 5<br>
2008-09-10 09:26:38 [c90cffdfa7c5a49329d3b4f779dd4acd] dprall: Loaded session data: user id is 5<br>
2008-09-10 09:26:42 [c90cffdfa7c5a49329d3b4f779dd4acd] dprall: Loaded session data: user id is 5<br>
2008-09-10 09:26:46 [c90cffdfa7c5a49329d3b4f779dd4acd] dprall: Loaded session data: user id is 5<br>

So the user id is returning 5 and not 6. So I guess I need some clue as to where in the cache to be looking. Would this be in the data.gallery.base cache directory? Is there an easy way to clear the cache contents?

David

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Wed, 2008-09-10 13:49

David,

I don't think the session data is cached - so I would continue to investigate on the db front. Just to confirm, I would set

$this->_userId = 6;

in that code, and see if that logs you in as admin. (You'll probably want to remove that line quick, after verifying it works.)

I'll have a dig in the code and see if I can find any more test-points to see what's happening. You're welcome to have a look too...

 
dprall

Joined: 2008-09-07
Posts: 15
Posted: Wed, 2008-09-10 14:13

I will try that and see how it goes. I'm not real good with MySQL. I ran a check against the database and it says everything is ok. I have phpMyAdmin installed but it won't let me modify anything, so I'm still attempting to figure that out as well.

Did the above, and it throws me to the login window without the user and password boxes, but site admin was available. Click on site admin and I get "The administration session has expired, please re-authenticate to access the administration area." I reauth and it throws me to the main.php, where Site Admin is available, but I am now in an endless circle, still says it has expired.

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Wed, 2008-09-10 14:30

OK... that sounds reasonable. I wasn't suggesting setting the userId as a workaround, just to see if it moved the problem on a bit - so we can count that as success.

I had a thought about why you might be getting the wrong results back from the db. Try adding this (one) extra line to the file, in context:

	    $gallery->debug('ARM: There were '. $results->resultCount() . ' possible rows in the session table.<br>');
	    if ($results->resultCount()) {
		$pSession = $results->nextResult();

The correct answer is 1...

 
dprall

Joined: 2008-09-07
Posts: 15
Posted: Wed, 2008-09-10 16:38

2008-09-10 10:36:58 [c90cffdfa7c5a49329d3b4f779dd4acd] dprall: There were 1 possible rows in the session table.<br>
2008-09-10 10:36:58 [c90cffdfa7c5a49329d3b4f779dd4acd] dprall: Loaded session data: user id is 6<br>

The above is with Firefox 3.0.1. Using IE6.0.2900.2180.xpsp_sp2_qfe.070227-2300 I get no log messages from this debug when I attempt to login. So I assume that IE is being sent somewhere else in the code.

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Wed, 2008-09-10 17:43
dprall wrote:
2008-09-10 10:36:58 [c90cffdfa7c5a49329d3b4f779dd4acd] dprall: There were 1 possible rows in the session table.<br>
2008-09-10 10:36:58 [c90cffdfa7c5a49329d3b4f779dd4acd] dprall: Loaded session data: user id is 6<br>

The above is with Firefox 3.0.1. Using IE6.0.2900.2180.xpsp_sp2_qfe.070227-2300 I get no log messages from this debug when I attempt to login. So I assume that IE is being sent somewhere else in the code.

Some others were/are investigating a possible issue with logging in from IE - although it should take you through the same code path. There's no browser-specific code in that area, as far as I'm aware. (I'm not sure if there's any in Gallery at all.)

The 'user id is 6' is healthy, that should have logged you in correctly - did it? previously it was giving a result of 5 (which is the guest user), am I correct?

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Wed, 2008-09-10 18:33

Something really wierd ... now *I* can't login from IE(7) either, and that's on G2.2.5. Also the shopping-cart isn't working. Which also uses the session features. So I will investigate that on my own site and let you know what find!

- that now seems to have sorted itself out and is behaving correctly now. So a glitch at one end or the other.

 
MJK

Joined: 2008-09-07
Posts: 9
Posted: Wed, 2008-09-10 19:06

Alec,
Made the update as suggested with my initials;

Quote:
if ($results->resultCount()) {
$pSession = $results->nextResult();
if ($pSession[3] > $inactiveCutoff && $pSession[2] > $lifetimeCutoff) {
/* A session exists and it's valid */
$this->_userId = (int)$pSession[0];
$this->_remoteIdentifier = unserialize($pSession[1]);
$this->_creationTime = (int)$pSession[2];
$this->_modificationTime = (int)$pSession[3];
$this->_sessionData = unserialize($pSession[4]);
$this->_loadedSessionData = $this->_getSerializedSession();

$this->_isPersistent = true;
$gallery->debug('MJK: Loaded session data: user id is ' . $this->_userId .'<br>');

However as per attached I do not see anything coming back in the debug logs...?

AttachmentSize
Debug-4-back to main.php_.txt28.89 KB
Debug-3-Login Redirect.txt9.08 KB
Debug-2-Loginscreen.txt15.12 KB
Debug-1-main.php_.txt28.89 KB
 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Wed, 2008-09-10 19:37

I'm confusing myself (and probably everyone else) by trying to help two people with similar but almost certainly different problems in the same thread.

MJK: you're using Gallery 2.2, correct? That's really old, numerous bugs have been fixed in the nearly-two-years since it was released. From your log it appears that your session is not being reloaded at all. I don't think I can help much further, not least because I don't have a copy of Gallery 2.2 to refer to and I'm not familiar with it. In your shoes I would be considering backing up the database, the g2 and g2_data directories and upgrading to 2.2.5.

dprall: you're using 2.3RC1, correct? if you're reliably getting this:

2008-09-10 10:36:58 [c90cffdfa7c5a49329d3b4f779dd4acd] dprall: Loaded session data: user id is 6<br>

This is contradictory to your previous post where you reported

2008-09-10 09:24:36 [c90cffdfa7c5a49329d3b4f779dd4acd] dprall: Loaded session data: user id is 5<br>

So I don't know where we stand.

2.3RC1 also has a defect where entering incorrect credentials at the "The administration session has expired, please re-authenticate to access the administration area." page doesn't give an error message but throws you back to the main page. That's been fixed in the latest SVN code.

 
MJK

Joined: 2008-09-07
Posts: 9
Posted: Wed, 2008-09-10 20:28

Alec, I am on 2.2.5.

I seem to be a bit further now.
After login the session-id is still 5, however after the redirect it then moves correctly to 6.
..however strangely enough I then still only see the plain main.php.

Send you a priv message with login details. Would you be able to have a quick look to see what is going on?

Regards,
Martin

 
MJK

Joined: 2008-09-07
Posts: 9
Posted: Wed, 2008-09-10 20:40

This is the section where it seems to go wrong;

(mysqlt): SELECT g_userId, g_remoteIdentifier, g_creationTimestamp, g_modificationTimestamp, g_data FROM g2_SessionMap WHERE g_id='f029a605b966c1601d540693ca0d70e5'
--------------------------------------------------------------------------------
MJK: Loaded session data: user id is 6
controller , view Loading plugin core Class not defined, trying to include it. file_exists(/hermes/bosweb/web152/b1520/sl.kalesnua/public_html/gallery2/modules/core/module.inc) core plugin successfully instantiated file_exists(/home/users/web/b1520/sl.kalesnua/gallery2/g2data/versions.dat) file(/home/users/web/b1520/sl.kalesnua/gallery2/g2data/versions.dat, ) navigation: Jumping back from xa6d84afa to xc9fdf70c navigation: deleting xa6d84afa file_exists(/hermes/bosweb/web152/b1520/sl.kalesnua/public_html/gallery2/modules/httpauth/classes/HttpAuthPlugin.class) file_exists(/home/users/web/b1520/sl.kalesnua/gallery2/g2data/cache/module/httpauth/0/0/0.inc) getParameter id.anonymousUser for core plugin [1221078629] can't guarantee 5 -- extending! file_exists(/home/users/web/b1520/sl.kalesnua/gallery2/g2data/cache/entity/0/0/5.inc) Loading plugin core core plugin successfully instantiated Check the version of the core plugin file_exists(/home/users/web/b1520/sl.kalesnua/gallery2/g2data/cache/module/_all/0/0/GalleryPluginHelper_fetchPluginStatus.inc) The version of the core plugin is ok file_exists(/hermes/bosweb/web152/b1520/sl.kalesnua/public_html/gallery2/modules/core/ShowItem.inc) getParameter acceleration for core plugin getParameter id.anonymousUser for core plugin getParameter id.anonymousUser for core plugin getParameter id.adminGroup for core plugin
--------------------------------------------------------------------------------
(mysqlt): SELECT g_userId FROM g2_UserGroupMap WHERE g_userId=5 AND g_groupId=3 LIMIT 1

 
dprall

Joined: 2008-09-07
Posts: 15
Posted: Wed, 2008-09-10 20:43
Quote:
dprall: you're using 2.3RC1, correct? if you're reliably getting this:

2008-09-10 10:36:58 [c90cffdfa7c5a49329d3b4f779dd4acd] dprall: Loaded session data: user id is 6<br>

This is contradictory to your previous post where you reported

2008-09-10 09:24:36 [c90cffdfa7c5a49329d3b4f779dd4acd] dprall: Loaded session data: user id is 5<br>

So I don't know where we stand.

2.3RC1 also has a defect where entering incorrect credentials at the "The administration session has expired, please re-authenticate to access the administration area." page doesn't give an error message but throws you back to the main page. That's been fixed in the latest SVN code.

Sorry about that. I am getting 5, the 6 is from hacking the GallerySessions.class and hard coding 6. So it sounds like I need to pull down the latest SVN.

Thank you, David

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Wed, 2008-09-10 22:59

MJK: just a thought - try removing and deleting *entirely* the httpauth plugin. It does appear to go pear-shaped in between the two points you highlighted, and immediately before this sus bit - "getParameter id.anonymousUser for core plugin" - is some call to the httpauth module.

dprall: probably not a bad idea, if you are already on 2.3RC1. T

 
dprall

Joined: 2008-09-07
Posts: 15
Posted: Thu, 2008-09-11 05:02

I just copied all of the SVN over my current install. No changes. Can't login as admin still. I put the additional session debugs in, but I am getting none of them in the debug log.

David

 
MJK

Joined: 2008-09-07
Posts: 9
Posted: Thu, 2008-09-11 20:18

Removed the httpauth plugin, but still the issue is not resolved;

Quote:
file_exists(/home/users/web/b1520/sl.kalesnua/gallery2/g2data/cache/module/_all/0/0/GalleryStorage_describeMap.inc)
--------------------------------------------------------------------------------
(mysqlt): SELECT g_userId, g_remoteIdentifier, g_creationTimestamp, g_modificationTimestamp, g_data FROM g2_SessionMap WHERE g_id='cf5ed20cb13d2e1f399fc71b660eecd0'
--------------------------------------------------------------------------------
MJK: Loaded session data: user id is 6
controller , view Loading plugin core Class not defined, trying to include it. file_exists(/hermes/bosweb/web152/b1520/sl.kalesnua/public_html/gallery2/modules/core/module.inc) core plugin successfully instantiated file_exists(/home/users/web/b1520/sl.kalesnua/gallery2/g2data/versions.dat) file(/home/users/web/b1520/sl.kalesnua/gallery2/g2data/versions.dat, ) navigation: Jumping back from xa481cc06 to xe9054fde navigation: deleting xa481cc06 getParameter id.anonymousUser for core plugin [1221164110] can't guarantee 5 -- extending! file_exists(/home/users/web/b1520/sl.kalesnua/gallery2/g2data/cache/entity/0/0/5.inc) Loading plugin core core plugin successfully instantiated Check the version of the core plugin file_exists(/home/users/web/b1520/sl.kalesnua/gallery2/g2data/cache/module/_all/0/0/GalleryPluginHelper_fetchPluginStatus.inc) The version of the core plugin is ok file_exists(/hermes/bosweb/web152/b1520/sl.kalesnua/public_html/gallery2/modules/core/ShowItem.inc) getParameter acceleration for core plugin getParameter id.anonymousUser for core plugin getParameter id.anonymousUser for core plugin getParameter id.adminGroup for core plugin
--------------------------------------------------------------------------------
(mysqlt): SELECT g_userId FROM g2_UserGroupMap WHERE g_userId=5 AND g_groupId=3 LIMIT 1