Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+3 votes
443 views
in Q2A Core by
Inserted a code from another page in admin section.
I can not enter any command of administration.

How can I remove that admin / layout code?

1 Answer

+3 votes
by
selected by
 
Best answer

Funny thing. You must have broken the HTML and now you can't access the site. I had thought of a similar situation 2 years ago: https://github.com/q2a/question2answer/pull/211#issuecomment-93860274 "if you rely on the UI to turn safe mode on then it is not so safe :)" => Definitely, I agree with myself :)

Anyway, your issue can easily be fixed:

1. Connect to the database using PHPMyAdmin or whatever tool you are using

2. Run this SQL query:

SELECT * FROM qa_options WHERE title LIKE 'custom%';

3. Take note of the title of the row that contains the broken HTML code in the content field. For example, if you have messed with this setting "Custom HTML in <head> section of every page" you'll need to take note of custom_in_head.

4. Run this SQL query: (warning, if you do things the wrong way you might seriously mess with the configuration of the site... I take no responsibility here! Even worse, you're following advice from a random guy from the internet who is telling you that you might seriously break things if you do):

UPDATE qa_options SET content = '' WHERE title = 'custom_in_head';

...