You are here:  » Keeping Getting Logged Out of Admin...

Support Forum



Keeping Getting Logged Out of Admin...

Submitted by henryt on Fri, 2010-11-19 00:07 in

Hi everyone,
Does anyone have the issue of keep getting logged out of the admin interface? I have to like log in every 30 secs...its very irritating.

any advice?

Henry

Submitted by support on Fri, 2010-11-19 09:08

Hi Henry,

The login cookie set by admin/login.php does not set an expire period so should persist for the session; so maybe something between your browser and the server is expiring the session early. The first thing to try would be to set an expire period of, say, 1 day. To do this, look for the following code at line 16:

      setcookie("admin",md5($remoteAddr.$config_adminPassword));

...and REPLACE that with:

      setcookie("admin",md5($remoteAddr.$config_adminPassword),86400);

...which will give an expire period of 1 day.

However, the other possibility is that your IP address is changing regularly. If the above doesn't help, remove the address variable from the MD5 hash calculation by replacing the above line with:

      setcookie("admin",md5($config_adminPassword),86400);

...that should definitely fix it for you I'm pretty sure...

Cheers,
David.
--
PriceTapestry.com

Submitted by henryt on Fri, 2010-11-19 10:35

Hi David,
I wished this could fix it...but it din.

I tested using both lines above, but both same result. In fact, it seem to have gotten worse. I cannot even login. I already tested clearing all cookies and logging in again but to no avail.

How can i debug this?

Henry

Submitted by support on Fri, 2010-11-19 10:45

Hello Henry,

I'm sorry that didn't work - I've never come across any problems with the login mechanism before. In admin/admin_header.php add code to dump the contents of $_COOKIE so you can see that something is clearing your cookies when it returns you back to the login page. In admin/admin_header.php, add the following line onto the very end of the file (after the closing PHP tag):

  <?php print_r($_COOKIE); ?>

That should help to see what's happening!

Cheers,
David.
--
PriceTapestry.com

Submitted by henryt on Fri, 2010-11-19 10:56

Hi David,
First off, thanks for the almost instantaneous reply. I really appreciate it. And no need to say sorry...you have been tremendous help. I have never met a software owner that is as helpful as you.

Back to the point, the error generated is as follow:

Array ( [wordpress_test_cookie] => WP Cookie check [wordpress_logged_in_abb1cad83e743e14ca631221a3e62b4f] => wpadmin|1291372544|ff88ec07c3ab1892c5eae7a44c1521ed [wp-settings-1] => editor=html&m5=o&m4=o [wp-settings-time-1] => 1290163120 )

any suggestion?

Henry

Submitted by support on Fri, 2010-11-19 11:35

Hello Henry,

I just realised that a corresponding modification is required in includes/admin.php after removing the IP address from the hash value. In that file, look for the following code very near the end at line 544:

      if ($_COOKIE["admin"] <> md5($remoteAddr.$config_adminPassword))

...and REPLACE that with:

      if ($_COOKIE["admin"] <> md5($config_adminPassword))

(basically the md5 value must match what is being created for the cookie in admin/login.php.

Hope this helps!

Cheers,
David.
--
PriceTapestry.com