Access Denied for every login
We have had our Drupal site up and running for months. Suddenly, yesterday, we started having problems where it gives anyone who tries to log in an "Access Denied" page with a lot of error messages (see below). As far as I know, no updates have been done to the Drupal software, no updates have been done to the database, no updates have been done to the server. Just one day it worked just like it has for months, and the next day, nothing.
I cannot log in as any user. I can create a new user, and it sends me the information, but it won't let me log in.
Here is the error message we are getting.
----
Access Denied
* warning: array_keys() [function.array-keys]: The first argument should be an array in {address withheld}/modules/user/user.module on line 361.
* warning: implode() [function.implode]: Bad arguments. in {address withheld}/modules/user/user.module on line 361.
* user warning: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 query: SELECT DISTINCT(p.perm) FROM role r INNER JOIN permission p ON p.rid = r.rid WHERE r.rid IN () in {address withheld}/includes/database.mysql.inc on line 172.
* warning: array_keys() [function.array-keys]: The first argument should be an array in {address withheld}modules/block/block.module on line 644.
* warning: implode() [function.implode]: Bad arguments. in {address withheld}/modules/block/block.module on line 644.
* user warning: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ') OR r.rid IS NULL) ORDER BY b.region, b.weight, b.module' at l query: SELECT DISTINCT b.* FROM blocks b LEFT JOIN blocks_roles r ON b.module = r.module AND b.delta = r.delta WHERE b.theme = 'slash' AND b.status = 1 AND (r.rid IN () OR r.rid IS NULL) ORDER BY b.region, b.weight, b.module in {address withheld}/includes/database.mysql.inc on line 172.
You are not authorized to access this page.
------------------------------
I have spent the last three hours going through the Drupal forum with post after post with suggestion after suggestion, and nothing I have tried works.
The site is at http://www.eastofindy.com.
The site can be read, but it won't let anyone log in to add any content or change anything.

It kind of looks like there
It kind of looks like there might be something wrong with your role table. What is the contents of your role table?
Can you verify that you have at least two rows
rid, name
1, anonymous user
2, authenticated user
What other steps have you tried? Have you enabled any new modules recently? Tried dumping your cache? Tried emptying the sessions table?
I do have those two entries
I do have those two entries in the Role table.
1 anonymous user
2 authenticated user
3 Administrator
4 Bloggers
5 Moderators
We have not enabled any new modules in months.
As for what I have tried....
I tried editing the includes/bootstrap.inc
I have tried editing the modules/user/user.module
I have tried editing index.php
I have tried editing sites/default/settings.php
I've tried database scripts
All of those edits were made based on suggestions I read in the forums (I must have read hundreds of posts this afternoon). There were definitely other edits I made based on suggestions, but I don't remember what they were off hand. I might be able to retrace my steps and figure it out.
I've also tried to restore the site from backups I made just a few days ago. (I'm currently running on the backup from the software... so everything I tried is essentially gone, but only one seemed to make a difference... editing the bootstrap.inc file broke the site entirely.)
And now, I have tried emptying the cache table (with only one entry) and the sessions table (with thousands of entries). Unless the suggestion about cache was referring to web browser cache, in which case not only have I emptied it on both browsers on the computer, but also tried multiple computers.
The weird thing is, this site was fine until yesterday afternoon.
Could you check and see if
Could you check and see if there is anything in the data column of the user table for the user that you are trying to log in as?
Drupal expects this column to contain a serialized array of all the users roles. And it appears that when you reach /modules/user/user.module on line 361 where it needs this information it has either been unset by another module, or never existed in the first place.
In case you haven't seen it already there is a thread that talks about this here. http://drupal.org/node/114074
Also, could you tell us what contributed modules you're using.
Data fields
Yes, the data fields for all of the users have something in them except for User "0", which has "NULL" in that field.
And yes, I did see that link and tried to make the appropriate changes to the bootstrap.inc as seen in comment 8. That was the change that completely broke the site until I undid the change. Another thing recommended in that threat was disabling the Bio module, but I don't have that module.
As for contributed modules, without being able to log in as administrator, I don't remember exactly which modules are included and which are contributed, and I'm not even sure how to tell which ones are active, but here is a list of all modules in the modules folder.
abuse
ad
addtofavorites
aggregator
akismet
block
blog
blogapi
blook
captcha
chatroom
color
comment
contact
drupal
filter
flag_content
form_store
forum
help
legacy
legal
locale
menu
node
path
ping
poll
profile
search
statistics
system
taxonomy
throttle
tracker
upload
watchdog
There were a couple of modules, like abuse, flag_content, and watchdog, that I installed to see how they work, but only one is active. I think it is the "Flag_content" that is active. I just never uninstalled the unused ones.
Same problem
We have the same problem on our website, would be grateful for suggetions for solving it!
Just out of curiosity, what
Just out of curiosity, what version of Drupal are you running.
Can you login as the user with UID = 1, but not any other user? Or you just can't login period?
5.1, and no
I'm using 5.1, which I realize is a little old.
And no, I can't log in as user 1, or any other user. I've read some posts where User 1 could log in, but nobody else, but in my case, User 1 is also locked out.
Could you try upgrading to
Could you try upgrading to Drupal 5.7 on a dummy site and see if that fixes. It looks like there was a patch committed that may fix this problem. http://drupal.org/node/165642
Barring that, what happens if you try the fix in this comment. http://drupal.org/node/165642#comment-688851
Is your site on a shared
Is your site on a shared server plan? If so check with your hosting company to see what changes they have made. Often sudden problems, with no changes being made to Drupal, are a result of some change the host company pushed down.
If you run your own server(s), did you make any changes to it.
Also check to see if your database is corrupted.
Neither of those may lead to a resolution but they are things that should be looked into, if only to rule them out.
It is on a shared server,
It is on a shared server, although they claim they haven't done any changes.
In the meantime, I created a new folder and tried installing Drupal 5.1 on it, using new database tables, but I had the same problem immediately after install. So I deleted it and tried to install 5.7 instead, but now I'm getting an "incompatible environment" error when I try to install. So it must be something on their end.
Moved the site
I moved the site to a new server (files and database both). Other than a few tweaks here and there to adjust to the new location, the site runs perfectly.
Thanks to everyone for all your help, but in the end, it was the hosts fault.
Glad you got it working! Any
Glad you got it working!
Any idea what was changed on your host incase other people encounter a similar problem in the future, or to see if it's something we can figure out how to prevent from becoming an issue.
Our host did finally admit
Our host did finally admit that they have made some changes to PHP "over recent months", but that nobody else has reported any problems. Of course, I have a feeling we are the only ones running Drupal. Most of the others on this particular host run either WordPress or PHPbb (as well as the host's proprietary software).