XF 2.2 I can't access the admin panel!

Dkf

Active member
XF 2.2.13

Suddenly, I can't access the admin panel. I'm logged into the forum, but the /admin.php page doesn't show anything. There are no errors displayed, and nothing appears in the browser console either.

I’ve already tried the following:

Disabled:
App for Cloudflare® by DigitalPoint
Security by DigitalPoint

Flushed the Cloudflare cache
Restarted Apache on the server
Deleted all cookies

Nothing helped.

I have two-factor authentication enabled. Could that be the issue?
How can I disable two-factor authentication via MySQL?
 
Solution
The data is ephemeral, the only real consequence to dropping and recreating them is users will have to log in again. You could try restoring them from a backup if you wanted though.

I want to write a few words about what the problem was and how I solved it with the help of ChatGPT.
I am very grateful to it. Without ChatGPT, I don't even know how much time I would have spent searching for the problem. But with it, I managed to fix it in 15 minutes.
I did what it told me, copied the server logs to it, and described exactly what I saw on the screen.

As soon as it saw that there was "Zaraz" in the Network tab, it wrote the following:


What is Zaraz
Zaraz is a Cloudflare script automatically injected into your site. It is...
When you say it doesn't show anything, do you mean it shows a blank white page? If so, that points to a fatal error so you may want to check your server error log for more details. You can also try disabling listeners: https://xenforo.com/docs/xf2/add-ons/#regaining-control-panel-access
No, after entering my username and password, I'm just redirected back to the same page.
No error message is shown. I even tried entering the wrong password — still no error.
I added $config['enableTfa'] = false; to the config file, but it didn’t help. :(

Before adding $config['enableTfa'] = false, I wasn't able to access the two-factor authentication settings in my profile settings.
When I entered the password again to access the settings, nothing happened.
 
That likely points to an issue with something other than 2FA. The flag in the page I linked is:
PHP:
$config['enableListeners'] = false;

You may also want to enable Cloudflare's Development Mode and disable any server-side (config.php) caching.
 
Before adding $config['enableTfa'] = false, I wasn't able to access the two-factor authentication settings in my profile settings.
When I entered the password again to access the settings, nothing happened.
The last time I saw a similar issue it was because the xf_session and xf_session_admin tables were tampered with via phpMyAdmin and the primary key index was removed. You may want to drop and recreate them with the appropriate schema:

SQL:
DROP TABLE IF EXISTS `xf_session`;

CREATE TABLE `xf_session` (
  `session_id` varbinary(32) NOT NULL,
  `session_data` mediumblob NOT NULL,
  `expiry_date` int(10) unsigned NOT NULL,
  PRIMARY KEY (`session_id`),
  KEY `expiry_date` (`expiry_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

DROP TABLE IF EXISTS `xf_session_admin`;

CREATE TABLE `xf_session_admin` (
  `session_id` varbinary(32) NOT NULL,
  `session_data` mediumblob NOT NULL,
  `expiry_date` int(10) unsigned NOT NULL,
  PRIMARY KEY (`session_id`),
  KEY `expiry_date` (`expiry_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
 
  • Love
Reactions: Dkf
The last time I saw a similar issue it was because the xf_session and xf_session_admin tables were tampered with via phpMyAdmin and the primary key index was removed. You may want to drop and recreate them with the appropriate schema:

SQL:
DROP TABLE IF EXISTS `xf_session`;

CREATE TABLE `xf_session` (
  `session_id` varbinary(32) NOT NULL,
  `session_data` mediumblob NOT NULL,
  `expiry_date` int(10) unsigned NOT NULL,
  PRIMARY KEY (`session_id`),
  KEY `expiry_date` (`expiry_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

DROP TABLE IF EXISTS `xf_session_admin`;

CREATE TABLE `xf_session_admin` (
  `session_id` varbinary(32) NOT NULL,
  `session_data` mediumblob NOT NULL,
  `expiry_date` int(10) unsigned NOT NULL,
  PRIMARY KEY (`session_id`),
  KEY `expiry_date` (`expiry_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
Can I take these tables from the backup?
...made yesterday or the day before?
 
The data is ephemeral, the only real consequence to dropping and recreating them is users will have to log in again. You could try restoring them from a backup if you wanted though.
 
The last time I saw a similar issue it was because the xf_session and xf_session_admin tables were tampered with via phpMyAdmin and the primary key index was removed. You may want to drop and recreate them with the appropriate schema:

SQL:
DROP TABLE IF EXISTS `xf_session`;

CREATE TABLE `xf_session` (
  `session_id` varbinary(32) NOT NULL,
  `session_data` mediumblob NOT NULL,
  `expiry_date` int(10) unsigned NOT NULL,
  PRIMARY KEY (`session_id`),
  KEY `expiry_date` (`expiry_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

DROP TABLE IF EXISTS `xf_session_admin`;

CREATE TABLE `xf_session_admin` (
  `session_id` varbinary(32) NOT NULL,
  `session_data` mediumblob NOT NULL,
  `expiry_date` int(10) unsigned NOT NULL,
  PRIMARY KEY (`session_id`),
  KEY `expiry_date` (`expiry_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
It worked. Thank you very much. :love::love::love:(y)(y)(y)(y)
 
The data is ephemeral, the only real consequence to dropping and recreating them is users will have to log in again. You could try restoring them from a backup if you wanted though.
The problem has come back again...
I followed your instructions.
Sometimes I can access the page domain.com/admin.php,
but I can't navigate further through the admin panel menu. :(
 
The data is ephemeral, the only real consequence to dropping and recreating them is users will have to log in again. You could try restoring them from a backup if you wanted though.

I want to write a few words about what the problem was and how I solved it with the help of ChatGPT.
I am very grateful to it. Without ChatGPT, I don't even know how much time I would have spent searching for the problem. But with it, I managed to fix it in 15 minutes.
I did what it told me, copied the server logs to it, and described exactly what I saw on the screen.

As soon as it saw that there was "Zaraz" in the Network tab, it wrote the following:


What is Zaraz
Zaraz is a Cloudflare script automatically injected into your site. It is used for analytics collection and managing third-party scripts.
⚠️ Sometimes it breaks the admin panel, especially in XenForo, because it interferes with requests and JavaScript.


🔥 A very likely cause: Zaraz from Cloudflare
Cloudflare inserts this script as:

www.xenforoforum.com/cdn-cgi/zaraz/s.js

It can:
  • modify request headers,
  • interfere with XHR requests,
  • interfere with cookies or sessions.


I enabled Zaraz probably about a year ago. And yesterday, Cloudflare possibly released an update to Zaraz, and that’s when the problems started.
 
Solution
Back
Top Bottom