quando l'ho fatto io per un sito, nel menù del mio sito, avevo inserito questo codice
Codice:
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
if ( !$userdata['session_logged_in'] )
{
$template->assign_block_vars('switch_user_logged_out', array());
}
else
{
$template->assign_block_vars('switch_user_logged_in', array());
}
define('SHOW_ONLINE', true);
$template->set_filenames(array(
'body' => 'portal_body.tpl')
);
//
// Avatar On Index MOD
//
$avatar_img = '';
if ( $userdata['user_avatar_type'] && $userdata['user_allowavatar'] )
{
switch( $userdata['user_avatar_type'] )
{
case USER_AVATAR_UPLOAD:
$avatar_img = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $userdata['user_avatar'] . '" alt="" border="0" />' : '';
break;
case USER_AVATAR_REMOTE:
$avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $userdata['user_avatar'] . '" alt="" border="0" />' : '';
break;
case USER_AVATAR_GALLERY:
$avatar_img = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $userdata['user_avatar'] . '" alt="" border="0" />' : '';
break;
}
}
// Check For Anonymous User
if ($userdata['user_id'] != '-1')
{
$welcome = "Bentornato";
$name_link = "<b>".$userdata['username']."</b>";
$u_login_logout = 'login.'.$phpEx.'?logout=true&sid=' . $userdata['session_id'];
}
else
{
$welcome = "Benvenuto";
$name_link = $lang['Guest'];
}
//
// END: Avatar On Index MOD
//
$uffa = $userdata['user_id'];
$richesta = mysql_query("SELECT * FROM user WHERE id = $uffa ") or die(mysql_error());
$poba = mysql_fetch_array($richesta);
if ($poba[level] == 1) {
$livello = "amministratore";
}else {
$livello = "";
}
$template->assign_vars(array(
'WELCOME_TEXT' => $welcome,
'U_NAME_LINK' => $name_link,
'U_PORTAL' => append_sid("portal.$phpEx?g=main"),
'U_SEND_PASSWORD' => append_sid("profile.$phpEx?mode=sendpassword"),
'U_LOGIN_LOGOUT' => append_sid($u_login_logout),
'PROFILO_FORUM' => append_sid("profile.$phpEx?mode=editprofile&" . $userdata['user_id']),
'PROFILO' => "?g=profilo&id=$userdata[user_id]",
'REGISTRATI' => "?g=registrati",
'FOTO' => "?g=foto&id=$userdata[user_id]",
'VIEW_PROFILO' => "?g=user&id=$userdata[user_id]",
'AVATAR_IMG' => $avatar_img,
'LIVELLO' => $livello)
);
if( $userdata['session_logged_in'] )
{
$sql = "SELECT COUNT(post_id) as total
FROM " . POSTS_TABLE . "
WHERE post_time >= " . $userdata['user_lastvisit'];
$result = $db->sql_query($sql);
if( $result )
{
$row = $db->sql_fetchrow($result);
$lang['Search_new'] = $lang['Search_new'] . " (" . $row['total'] . ")";
}
}
$template->pparse('body');
poi, nella dir /templates/nomedelthema/ ho iserito un file portalbody.tpl con questo codice
Codice:
<table width="100%" cellspacing="0" cellpadding="0" border="0" align="center">
<tr>
<td class="catHead" height="25" align="center"><span class="genmed">{WELCOME_TEXT} {U_NAME_LINK}</span></td>
</tr>
<tr>
<td valign="top">
<!-- BEGIN switch_user_logged_in -->
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<tr><td>
<span class="gensmall"><center><br />{AVATAR_IMG}</center>
</td> </tr>
<tr>
<td> </td>
</tr>
<tr>
<td><a href="{PROFILO}" class="gensmall">Edita il Profilo</a><br>
<a href="{VIEW_PROFILO}" class="gensmall">Guarda il Profilo</a><br>
<a href="{PROFILO_FORUM}" class="gensmall">Dati del forum</a><br>
<a href="{FOTO}" class="gensmall">Le mie foto</a><br>
<a href="{U_LOGIN_LOGOUT}" class="gensmall">Logout</a><br>
{LIVELLO}
</td>
</tr>
</table>
<!-- END switch_user_logged_in -->
<!-- BEGIN switch_user_logged_out -->
<form method="post" action="login.php">
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<tr>
<td class="row1"><span class="gensmall" style="line-height=150%">
<input type="hidden" name="redirect" value="{U_PORTAL}" />
Utente:<br /><input class="unnamed1" type="text" name="username" size="20" /><br />
Password:<br /><input class="unnamed1" type="password" name="password" size="20" /><br />
<input class="text" type="checkbox" name="autologin" /> Ricordami<br/>
<input type="submit" class="unnamed1" name="login" value="Login" /><br /><br /><a href="{U_SEND_PASSWORD}" class="gensmall">Hai perso la password?</a><br /><a href="{REGISTRATI}" class="gensmall">Registrati ora!!</A><br /> </span></td>
</tr>
</table>
</form>
<!-- END switch_user_logged_out -->
</td></tr></table>
ed infine, ho aperto il file login.php e seguito questa procedura
Codice:
#
#-----[ OPEN ]------------------------------------------
#
login.php
#
#-----[ FIND ]-----------------------------------
#
redirect(append_sid("index.$phpEx", true));
#
#-----[ REPLACE WITH ]---------------------------
#
redirect(append_sid("portal.$phpEx", true));
#
#-----[ FIND ]-----------------------------------
#
$url = ( !empty($HTTP_POST_VARS['redirect']) ) ? $HTTP_POST_VARS['redirect'] : "index.$phpEx";
#
#-----[ REPLACE WITH ]---------------------------
#
$url = ( !empty($HTTP_POST_VARS['redirect']) ) ? $HTTP_POST_VARS['redirect'] : "portal.$phpEx";
#
#-----[ FIND ]-----------------------------------
#
redirect(append_sid("index.$phpEx", true));
#
#-----[ REPLACE WITH ]---------------------------
#
redirect(append_sid("portal.$phpEx", true));
#
#-----[ FIND ]-----------------------------------
#
$url = ( !empty($HTTP_POST_VARS['redirect']) ) ? $HTTP_POST_VARS['redirect'] : "index.$phpEx";
#
#-----[ REPLACE WITH ]---------------------------
#
$url = ( !empty($HTTP_POST_VARS['redirect']) ) ? $HTTP_POST_VARS['redirect'] : "portal.$phpEx";
#
#-----[ FIND ]-----------------------------------
#
redirect(append_sid("index.$phpEx", true));
#
#-----[ REPLACE WITH ]---------------------------
#
redirect(append_sid("portal.$phpEx", true));
ovvero ho sostituito tutti gli index.$phpEx con portal.$phpEx (che è la pagina a cui volevo venissero reindirizzati dopo il login)
spero di esserti stato d'aiuto