added: 'remember me' flag when logging
added: the session file sessions can still be available between starting and stopping the cmslu system git-svn-id: svn://ttmath.org/publicrep/cmslu/trunk@529 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -20,6 +20,12 @@ void SessionContainer::Clear()
|
||||
}
|
||||
|
||||
|
||||
SessionContainer::TableSize SessionContainer::Size()
|
||||
{
|
||||
return table.size();
|
||||
}
|
||||
|
||||
|
||||
SessionContainer::Iterator SessionContainer::Begin()
|
||||
{
|
||||
return table.begin();
|
||||
@@ -71,18 +77,22 @@ return i->second;
|
||||
|
||||
|
||||
|
||||
void SessionContainer::DelFirstByTimeInterval(time_t interval)
|
||||
void SessionContainer::DelFirstByTimeInterval(time_t interval, bool skip_remember_flag)
|
||||
{
|
||||
IndexTime::iterator i = index_time.begin();
|
||||
IndexTime::iterator iold;
|
||||
time_t limit = std::time(0) - interval;
|
||||
|
||||
for( ; i != index_time.end() && i->second->last_time < limit ; )
|
||||
while( i != index_time.end() && i->second->last_time < limit )
|
||||
{
|
||||
long id = i->second->id;
|
||||
iold = i;
|
||||
++i; // incrementing before deleting old one
|
||||
|
||||
if( skip_remember_flag && iold->second->puser && iold->second->remember_me )
|
||||
// don't delete sessions which have 'remember_me' flag (and a user is logged)
|
||||
continue;
|
||||
|
||||
if( iold->second->puser )
|
||||
data.last.UserLogout(iold->second->puser->id, iold->second->id);
|
||||
|
||||
|
Reference in New Issue
Block a user