feature #383, dedicated function to delete sessions

This commit is contained in:
plegall 2016-02-12 17:44:27 +01:00
parent 2561928b80
commit 25edfc2663
2 changed files with 17 additions and 5 deletions

View file

@ -405,11 +405,7 @@ DELETE FROM '.$table.'
}
// purge of sessions
$query = '
DELETE FROM '.SESSIONS_TABLE.'
WHERE data LIKE \'%pwg_uid|i:'.(int)$user_id.';%\'
;';
pwg_query($query);
delete_user_sessions($user_id);
// destruction of the user
$query = '

View file

@ -260,4 +260,20 @@ function pwg_unset_session_var($var)
return true;
}
/**
* delete all sessions for a given user (certainly deleted)
*
* @since 2.8
* @param int $user_id
* @return null
*/
function delete_user_sessions($user_id)
{
$query = '
DELETE
FROM '.SESSIONS_TABLE.'
WHERE data LIKE \'pwg_uid|i:'.(int)$user_id.';%\'
;';
pwg_query($query);
}
?>