|
|
|
View previous topic
::
View next topic
|
| Author |
Message |
ramon fincken Site's programmer
 Get a free globally recognized avatar It's free!
Joined: 03 Aug 2007 Posts: 256 Location: A'dam/Diemen, The Netherlands
|
Posted: Fri May 15, 2009 7:59 pm Post subject: [solution][snipplet] Phpbb3 force user to logout PHP functions/code |
|
|
Here you go !
| Code: | $user->session_kill();
$user->session_begin(); |
This code may also be of interest to integrate all bits and pieces:
| Code: | define('IN_PHPBB', true);
$phpbb_root_path = $include_prefix .'./'; // Your path here
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup(); |
|
|
| Back to top |
|
 |
Google adsense Advertisement
|
Posted: Fri May 15, 2009 7:59 pm Post subject: [solution][snipplet] Phpbb3 force user to logout PHP functions/code |
|
|
Advertisement
|
|
| Back to top |
|
 |
ramon fincken Site's programmer
 Get a free globally recognized avatar It's free!
Joined: 03 Aug 2007 Posts: 256 Location: A'dam/Diemen, The Netherlands
|
Posted: Sun Jun 07, 2009 9:02 pm Post subject: Re: [solution][snipplet] Phpbb3 force user to logout PHP functions/code |
|
|
A function to remove cookies ( and logging out )
| Code: | /**
* Ramon Fincken, for 99% borrowed from phpbb3 code
* Will not delete cookies for search engine bots ( $user->bots )
*/
function delete_cookies()
{
global $config,$user;
$set_time = time() - 31536000;
if($user->is_bot) return;
foreach ($_COOKIE as $cookie_name => $cookie_data)
{
$cookie_name = str_replace($config['cookie_name'] . '_', '', $cookie_name);
// Polls are stored as {cookie_name}_poll_{topic_id}, cookie_name_ got removed, therefore checking for poll_
if (strpos($cookie_name, 'poll_') !== 0)
{
$user->set_cookie($cookie_name, '', $set_time);
}
}
$user->set_cookie('track', '', $set_time);
$user->set_cookie('u', '', $set_time);
$user->set_cookie('k', '', $set_time);
$user->set_cookie('sid', '', $set_time);
// We destroy the session here, the user will be logged out nevertheless
$user->session_kill();
$user->session_begin();
} |
|
|
| Back to top |
|
 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|