Symptom: I cant log in even though I entered the correct username and password. It just reloads the page with the log in, and also shows that I am logged in my member's online block.

Solution: In user.module, comment out
sess_regenerate();
return 'user/'. $user->uid;

so that it looks like

//sess_regenerate();
//return 'user/'. $user->uid;

This was also a common problem under 4.7 and I know that people have filed bug reports, but nothing has been done about it in 4.7, and now it seems that the same bug is in 5.0. I'm off to go see if someone has filled a 5.0 bug report. Does anyone know why this bug has not been dealt with? Its quite an old one actually.

Anyway, I would be interested to know how many other people have had the same problem, so feel free to post

Nick

Comments

Acert93’s picture

Yeah, this has been ongoing for as long as I have been using Drupal. There is a long thread about this here:

http://drupal.org/node/6696

A developer had commented that without specific ways to reproduce the error there was nothing they could do, even though a fair number of people have the issue. It just "happens" when logging in. Hope this gets resolved in future versions :)

deathgod’s picture

If they cant reproduce the bug, then they refuse to fix it? Yet they still admit that the bug exists? And there is a ready made solution for it? Anywy, every drupal Installation I done has this issue.

DevElCuy’s picture

I can't log in.
I used "request a new password", then I got an email with a "one time log in link".
By now is the only way :(

<?
$signature = '
(3 John 1:2)
Dear friend, I pray that you may enjoy good health and that all may go well with you, even as your soul is getting along well.';

echo $signature;
?>

--
develCuy
Hiring the next generation front-end devs, contact Dilygent

4hoo’s picture

I've tried many times these days still get "Access denied" page each time.

The symptoms is :
Install drupal successfully, when I create the first account and just after click to submit and get the "access deny" page even though I got email later with the user name and password inside.
I only have windows XP firewalls and tried turn it and other anti-virus software off, no luck.
I tried other methods from this forum but still not work.

I've tried on the following combinations:
One combination:
Windows2000ProSP4
PHP5.0.5
Apache 2.0.54
Mysql 4.1.15
PHPMyAdmin 2.6.4
I've tried each available version of Drupal(4.6, 4.7, 5.0Rc). but no luck at all.

another combination:
WindowsXPpro
PHP5.2.0
Apache 2.2.3
Mysql 5.0.27
PHPMyAdmin 2.7.0
I've also tried each available version of Drupal(4.6, 4.7, 5.0Rc). but no luck at all.

now since each version of Drupal not work so I decide just stick with the 5.0 rc version.
went through all the solutions provided from this forum but just not work.

Anybody please help. what should I do? Many thanks

Rolf van de Krol’s picture

I had the same problem, after a upgrade of PHP. This patch was the solution for me: http://drupal.org/node/93945

4hoo’s picture

Mine not work.

The symptoms is :
Install drupal successfully, create the first account or another new account just get the "access
denied" page.
another thing I found is: the C:\Temp folder is empty no matter how many times I create account or request password. Is this related with the problem?

Drupal 5.x
WindowsXPpro
PHP5.2.0
Apache 2.2.3
Mysql 5.0.27
PHPMyAdmin 2.7.0

UPDATE: problem solved. It is the php.ini file.
I modified the line "session.cookie_path = \" in php.ini file and remove the "\".
so the line should look like "session.cookie_path = "

snav’s picture

Hi,

I had the exactly same problem as Nick. I followed the solution and it worked. I also tried uncommenting the second line and it still works on my end. So in the end, this is what the user.module file looked like @ around LINE 957.

//sess_regenerate();
return 'user/'. $user->uid;

I'm curious, what else will be affected by commenting out this line?

Nav.

rufferto@mac.com’s picture

Hi,

I had the same problem while using Safari after I updated to 5.1. I could get in with another browser but login from Safari would send me to "Access denied".

//sess_regenerate();
return 'user/'. $user->uid;

This change worked for me. I noticed after logging in that the all my previous logins were recorded as successful. Also a little browsing in the MySQL database sessions table showed that there were numerous sessions attributed to my IP address. I think there is a bug that somehow stops Drupal from recognizing the session cookie saved in Safari. I hope someone more familiar with PHP and Drupal can come up with a definitive solution before the next time I upgrade.

rosgar’s picture

//sess_regenerate();
return 'user/'. $user->uid;

I almost throw my computer trying to figure out what's wrong with my site. Lol, just kidding!

Anyway, I can login again.

ggevalt’s picture

Deathgod,

For this.... "Symptom: I cant log in even though I entered the correct username and password. It just reloads the page with the log in, and also shows that I am logged in my member's online block.

Solution: In user.module, comment out
sess_regenerate();
return 'user/'. $user->uid;"

I thank you profusely.
Tonight I did a fantastico install of a test version of Drupal 5.1. I operate a 4.7.5 Drupal site that had been working fine. I got the 5.1 site to work for purposes of getting familiar with 5.1 as a do planning for major revision of site. HOWEVER, when I left 5.1 and went back to use working site, I could NOT login for the life of me. Using Firefox I could not enter with any of my test identities either. And could not even get in using UID 1. Finally I was able to get in via UID 1 on Internet Explorer and the log showed that I had "successfuly" logged on numerous times.

I then used your SOLUTION! BINGO it worked. I was able to log in just fine. I tried breaking it, I could not. Each time it took, even when I closed Firefox and started up again, when I logged out, etc. It took each time on the first time.
Thanks. Now I will see if it resolves the other annoying little Drupal quirk, ie, logging in but having to do it a second time so that it "takes."

FYI, for yucks, and to do the math on this problem that seems to be plaguing a lot of folks, I reinstalled Drupal 5.1 in another folder again. I used the same login and password as the other installation AND the same login and password I use for the working site. I logged into the new site. I logged out of the working site and tried to log in again; it would NOT let me log in to the working site. I closed the 5.1 location; I was able to log in without problem.

So I wonder if there is another issue, ie password recall or incompatibility (computer brain warp) when there is more than one site using drupal with same user login name and password on the same server?

I don't know. What I do know is that your solution bailed me. Thanks.

geoff gevalt
http://www.youngwritersproject.org

JStarcher’s picture

hmmm very interesting. I've been trying to debug an external login script I made and this *may* fix it! I chdir to drupal and bootstrapped it, then used user_authentication($name, $pass);

It is the weirdest thing ever. Sometimes it will login just fine, others not. Cleared browser cache, cookies, perma cookies, nothing helps. There doesn't seem to be ANY pattern either.

I'll see what I can come up with.

Thanks!

carotid’s picture

I am eager to know how to solve this problem

Dan DG’s picture

I have a problem with this issue as well.

I am a recent convert to Drupal and have now built several sites, using it. The latest I have set up and spent a few hours configuring and now I am completely unable to log back in, entirely negating all the work I have done :(

I was extremely happy with Drupal prior to this, but it seems to be a big problem.

konst’s picture

I think I've observed the same problem today. Strangely enough, it appeared from nowhere.
I have RHEL3 with manually installed php 4.3.2, and I've upgraded to Drupal 5.1 about a month ago. Everything went fine, users could happily log in and out.
About a day or two ago another admin of the site has updated mysql to version 5. He might have upgraded some other packages at the same time, but as far as I understood nothing except mysql was really affected.
What is sure is that none of the drupal files was touched.

Nonetheless, I found out today that Drupal refuses to log me in. After some live-http-headering I discovered that although Drupal authenticated me correctly, it refused to let the browser know of the changed session id in the PHPSESSID cookie.

This lead me inside the sess_regenerate (that's where the session id is being changed), where I ended up changing the code

  if (isset($_COOKIE[session_name()])) {
     setcookie(session_name(), '', time() - 42000, '/');
  }
  
  session_regenerate_id();

with

  session_regenerate_id();
  setcookie(session_name(), session_id(), time() + 36000, '/');

and it seemed to fix the problem.
I'm not really sure whether I did the right thing, the solution where you just switch the regeneration of the session id off seems quite reasonable too, but I'm just sharing the experience in the hope it provides additional clues to someone.

konst’s picture

Aha, it's the PHP version that has created the problem in the first place. I actually had PHP 4.4.1 before when everything worked. It was probably accidentally re-downgraded to 4.3.2 and that's when the problem appeared.

Webluke-at-webluke.net’s picture

I have 2 sites running Drupal 5.1 on the same server one works the other doesn't not sure what the difference on them not much just a few different mods. The server they are on is running 4.4.4 so not sure if it has to do with version so much. I also too only am able to login after doing the password reset, and tried with different computers and browsers (FF2, IE6).

FlemmingLeer’s picture

This problem occured on a 4.7.6 site, but I found out via:
http://drupal.org/node/37702#comment-115939
that Illegal set of Collations was the problem.

Try using your phpmyadmin and check the users table and other tables.

They should all be the same. The person with this solution uses a czech version for his set of collations: utf8_czech_ci

I changed table USERS from latin_swedish_ci to utf8_dansh_ci and then I was able to login again without changing or editing username and password.

I suspect that the mysql version was changed on the server, but I´m not certain.

If you use english. utf8_general_ci; should be your set of collations in the above links code.

EagleX’s picture

and still, I cant get it to work!
ACCESS DENIED!
I tried changing user.module, collation, everything,
nothing helps...
WIN XP
Apache 2.2.4
php 5.2.1.1
drupal 5.1

THIS IS DRIVING ME CRAZY!

dziemecki’s picture

In settings.php, around line 139, where it says:

/**
 * We try to set the correct cookie domain. If you are experiencing problems
 * try commenting out the code below or specifying the cookie domain by hand.
 */

... do that. It worked for me.

Dan Ziemecki
Mangling other people's code since 1997.

Z2222’s picture

I've only had this problem on one site. It was running 4.7 and still had the problem when I upgraded to 5.1. Other Drupal sites on the same server still worked. It was definitely a cookie issue because to login I would have to delete the cookie and then it would let me login.

I commented out that code and now it seems to work...

Z2222’s picture

Update: still cannot login without clearing cookies -- Drupal 5.1
The site is here.

Tpainton-1’s picture

I have three websites running on the same server.. All are Drupal 5.1. They run in seperte directories.. All seperate installations..

Now one of them has this problem out of the blue.. I login but is just treats me as an anonymous user.. I can't login.. I create new password and login through the onetime login but I still can't access anything..

Is there a solution to this??? I Tried the above techniques and it just doesn't work.. I can't login!

Jay Armstrong’s picture

After using my Drupal site for about a month, mostly from firefox, I began having this issue. Thankfully, I was able to login fine from IE, but that just made me realize that it wasn't a login & password problem. As mentioned above, the site's log shows multiple successful logins but the front page keeps looping back to the login prompt. Going directly to http://site.com/?q=user/1 simply gives an access denied error, so I don't think I'm completely logging in.

I tried two of the solutions:

1. http://drupal.org/node/6696 (didn't help)
which tells you to add a line to index.php

2. The patch in this thread (this worked for me)
commenting out two lines in user.module:

//sess_regenerate();
//return 'user/'. $user->uid;

I also deleted the site cookie many times and flushed the cache while trying different solutions. Good luck to everyone else and I hope we're not blowing open a security gap. D:

Also, the site doesn't seem to be setting cookies (at least in firefox) anymore.

Anonymous’s picture

Same here, started happening with Firefox sometime ago, the only thing I remember was that I closed my site's tab while logged in. When I went to my site again, I was logged out, and couldn't log in anymore. Like the above post mentioned the log shows many successful login attempts. Tried all the solutions mentioned.

Fortunately I'm still able to login using Opera and IE7.

Tpainton-1’s picture

All of sudden everything started working again. Not sure why. I'm not complaining. I'm not sure which fix (if any) solved the problem as I used them all.

Anonymous’s picture

It would seem emptying everything (cache, etc.) on the browser, and then running a cleaning software (I used CCleaner) fixed this problem for me.

kudzai’s picture

My Drupal is version 5.3. I set up the same website (using the same database) on two test sites and a live version.
Test site 1: Linux, PHP5,
Test site 2: Windows IIS, PHP4.4.4 (Server API = ISAPI)
Live site: Windows IIS, PHP4.4.1, ( Server API = CGI/FastCGI )

The test sites had no problems. The live site logged me in successfully ( from the watchdog entries ), and immediately denied me access.

I tried adding the line to index.php (http://drupal.org/node/6696) - no success.

Commenting out the sess_regenerate() line worked for me. My code in user.module::user_login_submit() was like:

//sess_regenerate();
return 'user/'. $user->uid;

Thanks for the tip.

TheCarrMan’s picture

I can't log in either. These were my steps. I took out the Adsense Id beside my profile.. Then the next page displayed was the front page, but I was logged off... Then I tried to log on.. It doesnt recogzize my Name nor my Email when trying to recover my password.. Nothing happens... ARRRRGGUHHH... Alot of these PHP programs are doing this... What is with this.. I know its free, but by all means, I spent alot of time on this setting it up, and now Im hoping atleast to wait a day so I can log in again... I got rid of WORD PRESS cause it was doing it alot to me.. Now This one.. But seriously This program was better than all the ones I have used... BIG respects to this Software, but please fix this problem... Its the only fall back... Thank You Alex.

kristm’s picture

deathgod's solution worked for me.

I had problem with not being able to log in after fresh installation of Drupal 5.2 (I had no problem with 4.7.7).

My host's settings:

PHP built On: Windows NT SERVER4 5.0 build 2195
Database Version: 4.0.27-standard
PHP Version: 4.3.6
Web Server: Microsoft-IIS/5.0

Problem:
Unable to log in after fresh installation of Drupal 5.2. You're getting back to login page with no error message at all. Tried many other solutions but none of them actually worked until i tried this one.

Thanks again!

ximo’s picture

This problem has persisted and is still present in Drupal 6. I've tried all suggestions listed here, and this one solved it:

In /modules/user/user.module, in the function user_login_submit(), roughly around line 975, comment out this line:
sess_regenerate();

So that it reads:
//sess_regenerate();

Don't comment out the line below, it returns the ID of the logged in user, which is fine.

This was tested on IIS/5.0 on Windows NT.

A better solution though, would be to ditch IIS and go with the most widely used HTTP server, Apache.

Joakim Stai – Kollegorna

DevElCuy’s picture

This is a trick to get rid of this annoying bug.
1. Go to yoursite.com/user/logout
2. Login :)

And that is.

$signature = '
(3 John 1:2)
Dear friend, I pray that you may enjoy good health and that all may go well with you, even as your soul is getting along well.';

echo $signature;

--
develCuy
Hiring the next generation front-end devs, contact Dilygent

1websitedesigner’s picture

Hi,

Just tried what you suggested and it came up with an invalid page, however if I go to:

1. yoursite.com/user/login

It then lets me login!

Website design, website promotion and SEO

cbarnett’s picture

Looking at the tables in my database with phpMyAdmin, I see two tables listed as 'in use', 'sessions' and 'search_index'.

I see all the tables, other than those two, listed as 'utf8_general_ci', but the summary line at the bottom of the page says 'latin1_swedish_ci'. Go figure.

When I check the information on the two tables listed as 'in use' I get this message:
#145 - Table './drupal/
' is marked as crashed and should be repaired

I ran the repairs on the tables one at a time, and did a full export as backup before I did it, but that seems to have solved the problem... for now ;-)

I'll get back to you, if it fails again. Either way, running with a crashed table probably isn't a good idea.

Carey
====================================
I'm willing to put up with you, if you're willing to put up with me.

rubymuse’s picture

In MySQL, use "REPAIR TABLE table_name".
In my case it was "REPAIR TABLE sessions", and the problem was gone.

Marc Kawecki’s picture

I had this problem under Drupal 6 and tried everything listed without success, then deleted the php.ini file that I had created in /public_html/. This fixed my problem. I have not tried to figure out which part of php.ini was causing the problem, as I don't need it, anyhow. Hope this information saves someone the frustration that this problem caused me.

larryjhs’s picture

I have noticed a whole thread of posts on this, but none seem to help : http://drupal.org/node/105114 This has only happened in the past 48 hours or so, so if might be some upgrade at their end.

It may well be a the server end, they have had a look, but they don't support 3rd party software :(

The server is running Apache version 1.3.41 (Unix) PHP version 5.2.5
MySQL version 4.1.22-standard

I try to log in

mysite.com/user/

it won't accept my p/w do I ask for a new temp p/w, which I log in with, and put in a new p/w. But then it doesn't accept that and I am locked out.

the posts mentioned commenting out

Solution: In user.module, comment out
sess_regenerate();
return 'user/'. $user->uid;

so that it looks like

//sess_regenerate();
//return 'user/'. $user->uid;

but this code is not in my version of user.module.

Another post, way down the list suggested to delete php.ini. I don't believe I have a php.ini file to delete (where would it be??) as the last person on this commented.

Does anyone have any ideas about how to get in. Obviously the next step is to upgrade to 6.1, but I can't do that properly (uninstalling extra modules etc), until I can get in.

I am rather desparate, as I need to update content!!

hankpalan.com’s picture

Ok, I had a user have this problem, but I couldn't replicate it. Until now....

Whenever any user including admin's goes to edit their user account, it firsts goes back to the user login as if they weren't already logged in. After re-logging in it comes back with Access Denied...even for admin's.

I have D6.1 running on apache server. Like larryjhs said, I don't have the same user.module code that seems to work for other people, nor do I have a php.ini file.

This problem only seems to happen under the edit tab in the user account.

Wedding Videography - www.rusticred.com
Web Presence Management and Design - www.hankpalan.com

doodz’s picture

It's surely a server configuration issue of some kind, but we are experiencing a similar problem on a fresh D5.16 install.

Everything went fine until we logged out, then from that point, any login attempt by using "www.yoursite.com/admin" just get us back to this url "www.yoursite.com/?destination=admin" and the front page is displayed. No error, but when trying to get to admin, access denied and login is aked again.

The trick which consists in visiting "www.yoursite.com/user/logout" then loging in the resulting page works, and allows us to log in again but next logout re-triggers the above problem...

So far we have tested all suggested solutions but nothing works.

As we have strictly no problem in local under easyPHP or WAMP, I'm pretty sure it's due to a server configuration problem or conflict .

EDIT!

After further testing, it appears that login in via "www.yoursite.com/user/login" works perfectly. This means two things:
1) our problem might not be exactly the one described in the thread above
2) this problem happens when trying to login after an "access denied" by using the login box on that page