简体   繁体   English

如何清除登录到joomla前端和后端的同一用户的数据库会话?

[英]How to clear session from database for same user logged into frontend and backend of joomla?

I have a user logged in admin panel(backend) and frontend of the joomla site. 我有一个用户登录了joomla网站的管理面板(后端)和前端。 I checked the session table in DB and found that a session has been created for that user. 我检查了数据库中的会话表,发现已为该用户创建了会话。 I just deleted that row from DB and when I goto admin panel(backend), the user is logged out, which is correct. 我刚刚从数据库中删除了该行,当我转到管理面板(后端)时,用户已注销,这是正确的。 But when I goto frontend of the site, the user is not logged out. 但是当我转到站点的前端时,该用户没有注销。 So my question is "Is separate session maintained for frontend and backend for same user?" 所以我的问题是“是否为同一用户的前端和后端维护了单独的会话?” If it so then why I didn't find the 2 session rows in session table of DB? 如果是这样,那为什么我在数据库的会话表中找不到2个会话行呢? Is frontend session stored in separate table? 前端会话是否存储在单独的表中?

Also is there a way such that when I click on logout button, I logged out from both backend and frontend of the site? 还有一种方法,当我单击注销按钮时,我同时从网站的后端和前端注销了吗?

I think this is due to the fact that removing the row from the #__session table does not fully clear the session. 我认为这是由于以下事实:从#__session表中删除该行并没有完全清除该会话。 When manually logging out, the Session class is called and the session is destroyed, for example: 手动注销时,将调用Session类,并且会话将被破坏,例如:

$session = JFactory::getSession();
$session->destroy();

Doing this also sets the session state to destroyed : 这样做还将会话状态设置为destroyed

$this->_state = 'destroyed';

So you'll need to use PHP for this rather than removing tables from the database 因此,您需要为此使用PHP,而不是从数据库中删除表

The front and back ends are two separate and independent applications. 前端和后端是两个独立的应用程序。 So you can be logged into either or both and have separate sessions. 因此,您可以登录到这两者之一,也可以分别登录。 It is possible to share a session also but that requires some work. 也可以共享一个会话,但这需要一些工作。 What's odd to me is that you only saw one session in the table. 对我来说奇怪的是,您在表中只看到一个会话。 Are you positive? 你积极吗? Did you check the client value? 您检查客户价值了吗?

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

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