I got a bit of a problem. Users can log in, but they are immediately logged out. The funny thing is that I've got two almost identical Drupal sites on the same host, and they're seeing this problem at all. One thing separetes them, though: the new site is built locally and then uploaded. My two other sites were built on the host. This goes for all users except the admin user.

Status report

Drupal	6.19
Access to update.php	Protected
Configuration file	Protected
Cron maintenance tasks	Last run 10 min 12 sec ago
You can run cron manually.
Database updates	Up to date
File system	Writable (public download method)
MySQL database	5.0.77
PHP	5.2.12
PHP memory limit	250M
PHP register globals	Disabled
Unicode library	PHP Mbstring Extension
Update notifications	Not enabled
Update notifications are not enabled. It is highly recommended that you enable the update status module from the module administration page in order to stay up-to-date on new releases. For more information please read the Update status handbook page.
Web server	Apache

I have deactivated all modules except for core. This has no effect on my problem.

My local server is all the same, except:

MySQL database	5.1.37
PHP	5.2.10
PHP memory limit	125M

Under admin/reports/dblog the login and logut is logged like this:

user	09/20/2010 - 07:08	Session closed for Testbruker.	Testbruker	
user	09/20/2010 - 07:08	Session opened for Testbruker.	Testbruker

I feel like I've tried everything I can think of, and every solution the forum could give me. I've tested every browser from FF to IE, and on different computers on different networks and different operating systems. I've tried to clear cookies , sessions and so on.

Any ideas?

Topics I've found that are similar to mine

Comments

Codeblind’s picture

In settings.php there is a commented out setting: # $cookie_domain = 'example.com';

Check the docblock above it to see if it may apply to you.

Sivert Almvik’s picture

Yes, I've tried that too ;-) No change.

Codeblind’s picture

Did you disable "Access content" for the node module in user permissions section? It has to be enabled for Anonymous and Authenticated users.

Sivert Almvik’s picture

Tried that too. It didn't do anything.

I'm starting to think that it is perhaps better to kill the existing DB and start all over again.

Thank you for your replies, btw :)

Sivert Almvik’s picture

Tried erasing the DB and installing it all over again, but same thing happens again.

Users gets logged out immediately after login.

davidbessler’s picture

Did you ever find a solution for this? I have the same problem with the same dblog entries.

Codeblind’s picture

Try flushing your cookies.

I was having problems with erratic logouts after pushing sites from development to production. If that fixes the issue, you might want to use this code. It flushes any outdated cookies created by Drupal.

/**
* Purge all user cookies for website if the VERSION cookie value does not match $version.
*
* DRUPAL INSTALL: Place this code in settings.php immediately after the $cookie_domain.
* You may pass the $cookie_domain variable directly into the second argument. If you
* have not set the $cookie_domain value in settings.php, you must still supply a 
* a value to this function because it uses it to set its own cookie.
*
* @param STRING $version
*    If the value of VERSION does not match $version or is not set, all cookies
*    will be destroyed and a VERSION cookie will be set or updated.
*
* @param STRONG $cookie_domain
*   The cookie domain used on the site. This should match the value in settings.php.
*
* @author Erik Smith <http://sittinginoblivion.com/contact>
* @version 1.0
* @date December 15th, 2010
*/
function flushCookies($version, $cookie_domain) {
    if (!$_COOKIE['VERSION'] || $_COOKIE['VERSION'] !== $version) {
        foreach($_COOKIE as $k => $v) {
            setcookie($k, '', time()-3600);
            // Make a second pass to clear out cookies that use a cookie domain setting.  
            setcookie($k, '', time()-3600, '/', $cookie_domain);        
        }
        $expire = time()+60*60*24*30*365;
        setcookie('VERSION', $version, $expire, '/', $cookie_domain);
    }
}

Then call it like this...

flushCookies('1.0', $cookie_domain);

Whenever you make a change that may be causing cookie related troubles, update the first argument to something new.

sibany’s picture

got it FIXED was from WATCHDOG! hey igot same problem but i cant seem to fix it

it just kick any superadmin i create or any user

running drupal 6.22 it happened after i run the update!

------------------------------------------------------------------------------------

under admin/reports/dblog

same report you had/have

Please let me know how to fix it!

Thanks
M.sibany

Josh The Geek’s picture

Was this ever solved? I am having the same issue. In my setup I am syncing the website and its data between two computers with Dropbox. I can log in just fine on my Mac, but on a Linux machine I can't log in and I get the aforementioned notices in the log.