简体   繁体   English

WordPress自动登录但没有wp-admin访问权限

[英]WordPress automatic login but no wp-admin access

I was given a PHP project based on a WordPress site. 我得到了一个基于WordPress网站的PHP项目。 The thing is, I can't access the wp-admin panel. 问题是,我无法访问wp-admin面板。 I saw a lot of questions about that on StackOverflow, but I couldn't find an answer to mine. 我在StackOverflow上看到了很多与此有关的问题,但找不到我的答案。

Login to WordPress is done through wp-config.php with the MySQL settings (I can see it because when I put wrong credentials I cannot access to the project's internal pages). 使用MySQL设置通过wp-config.php登录到WordPress(我可以看到它,因为当我输入错误的凭据时,我无法访问项目的内部页面)。 I was told I can access to the wp-admin panel by adding wp-admin to the URL. 有人告诉我可以通过将wp-admin添加到URL来访问wp-admin面板。 There is no wp-login.php file as it is an automatic login. 没有wp-login.php文件,因为它是自动登录。

Actually when I put in my URL http://localhost:9999/html/pages/wp-admin (which is the location of my folder wp-admin), I just get the list of subfolders. 实际上,当我输入URL http://localhost:9999/html/pages/wp-admin (这是我的文件夹wp-admin的位置)时,我只得到子文件夹的列表。

I connect well with an administrator account (in the database it is written wp_capabilities | a:1:{s:13:"administrator";b:1;} ) however when I test with the current_user_can('administrator') function, I am not considered as admin. 我与管理员帐户连接良好(在数据库中写为wp_capabilities | a:1:{s:13:"administrator";b:1;} ),但是当我使用current_user_can('administrator')函数进行测试时,我不被视为管理员。 Can you help me by directing me to where to look? 您能帮我指引到哪里看看吗?

As per my comment to the original question, it could seem that you're missing some core files or functionality in your WordPress application. 根据我对原始问题的评论,似乎您在WordPress应用程序中缺少一些核心文件或功能。 One way to solve this is to "manually" update your WordPress. 解决此问题的一种方法是“手动”更新WordPress。

How to manually update WordPress: https://www.wordfence.com/learn/how-to-manually-upgrade-wordpress-themes-and-plugins/ 如何手动更新WordPress: https : //www.wordfence.com/learn/how-to-manually-upgrade-wordpress-themes-and-plugins/

I will also mention that it is generally a bad thing that your website directory is accessible through the browser display. 我还要提到,通过浏览器显示访问您的网站目录通常是一件坏事。 The reason for this is that it will be easy for people with malicious intent to look for security breaches. 这样做的原因是,有恶意的人很容易查找安全漏洞。

One way to prevent this is to edit your .htaccess file to include the following: 防止这种情况的一种方法是编辑.htaccess文件以包括以下内容:

Options -Indexes

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM