pyrokenesis wrote: Does anyone know how to redirect to a page of your choice when logging out (i.e. the referrer), as at the moment you are redirected to the forum index page?
Any takers?
Code: Select all
<?php
// Change the below for your root
$phpbb_root_path = '../forum/';
define('IN_PHPBB', true);
//
// phpBB related files
//
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/bbcode.' . $phpEx);
//
// start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
if($userdata['session_logged_in'])
{
// Do something because the user is logged in.
}
else
{
// User not logged in, so do something else. Perhaps weep into pillow. Or offer a login box.
}
Code: Select all
<?php
// Change the below for your root
$phpbb_root_path = '../forum/';
define('IN_PHPBB', true);
//
// phpBB related files
//
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/bbcode.' . $phpEx);
//
// start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
if($userdata['session_logged_in'])
{
// Do something because the user is logged in.
}
else
{
// User not logged in, so do something else. Perhaps weep into pillow. Or offer a login box.
}
?>
Code: Select all
global mainsite_sid, mainsite_userid;
Code: Select all
if (isset($mainsite_id) && is_numeric($mainsite_id))
{
$sql= "SELECT forum_user_id FROM mainsite_user_table WHERE mainsite_user_id=".(int)$mainsite_id;
if ( $result = $db->sql_query($sql) ) {
$row= $db->sql_fetchrow($result);
$sessiondata= array('autologinid'=>'', 'userid'=>$a_row['forum_user_id_fk']);
}
else { $sessiondata= array(); }
$session_id= $mainsite_sid; /**/
$session_method= SESSION_METHOD_COOKIE; /**/
}
Code: Select all
global mainsite_sid, mainsite_userid;
Code: Select all
if (isset($mainsite_id) && is_numeric($mainsite_id))
{
$sql= "SELECT forum_user_id FROM mainsite_user_table WHERE mainsite_user_id=".(int)$mainsite_id;
if ( $result = $db->sql_query($sql) ) {
$a_row= $db->sql_fetchrow($result);
$sessiondata= array('autologinid'=>'', 'userid'=>$row['forum_user_id']);
$userdata = session_begin($a_row['forum_user_id'], $user_ip, $thispage_id);
}
else { $sessiondata= array(); }
$session_id = isset ($userdata['session_id']) ? $userdata['session_id'] : $mainsite_sid;
}
What do you need to know? Specific questions are more helpful.ch8rt wrote:Is anyone willing to explain this to someone who has never done this kind of thing before. Also am I right in thinking that phpbb uses id numbers rather than user name, meaning new members would have to somehow be added in manually? Or would someone registering to both the forum and the mainsite with the same username automatically be able to do this?