Mejorado! (20-dic-07) Bueno pues esto es similar a como ya se tenia planteado en el loginform de phpbb2
Probado con phpBB3 Gold Released
hacemos dos scripts que vamos a subir al root de nuestra web
1. sesiones.php
2. login.php
a continuacion no se olviden de cambiar su path de servidor las url y las direcciones hacia sus instalaciones de phpbb3
sesiones.php
Código PHP:
<?php
define('IN_PHPBB', true); // se define que se va a usar phpbb.
$phpbb_root_path = '/usr/local/psa/home/vhosts/tudominio.com/httpdocs/phpbb3/'; // el path directo del servidor a phpbb3, varia algo dependiendo del servidor, si hay errores con esto en el mismo error sale el path correcto.
$phpbb_url_path = 'http://www.tudominio.com/phpbb3/'; // la url hacia tu phpbb3
$phpEx = substr(strrchr(__FILE__, '.'), 1); // tipo de extension
include($phpbb_root_path . 'common.' . $phpEx); // incluimos el common.php que es muy importante para la bd
include($phpbb_root_path . 'config.' . $phpEx); //include de config.php importante tambien en bd usuarios y pass
// iniciamos sesion
$user->session_begin();
$auth->acl($user->data);
?>
login.php
Código PHP:
<?php
if($user->data['is_registered'])
{
//en phpbb3_ suponemos que el prefijo de la tabla es phpbb3_
$avvy = "SELECT * FROM phpbb3_users WHERE user_id =" . $user->data['user_id'];
$result = mysql_query($avvy) or die (mysql_error());
while($row = mysql_fetch_array($result))
{
$link = $row['user_avatar'];
$width = $row['user_avatar_width'];
$height = $row['user_avatar_height'];
}?>
<a href="<?php echo $phpbb_url_path?>memberlist.php?mode=viewprofile&u=<?php echo $user->data['user_id'];?> " target="_self"></a>
<table width="145" height="392" border="0" cellpadding="0" cellspacing="0" >
<tr>
<td align="center" valign="top">
<table width="145" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center">Hola <a href="<?php echo $phpbb_url_path?>memberlist.php?mode=viewprofile&u=<?php echo $user->data['user_id'];?> " target="_self"> <?php echo $user->data['username'];?> </a>!</td>
</tr>
</table>
<table width="135" height="255" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="250" align="center" valign="middle"><img src="<?php echo $phpbb_url_path?>download/file.php?avatar=<? echo $link?> " border="0" width="<? echo $width?> " height=" <? echo $height?>" alt='Avatar' /></td>
</tr>
</table>
<table width="145" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" valign="middle" class="Estilo5"><span class="Estilo20"><a href="<?php echo $phpbb_url_path?>ucp.php" >Visita tu<br />
Panel de control</a><br />
<?php echo( "<a href=" . $phpbb_url_path . 'ucp.php?mode=logout&redirect=../index.php' . '&sid=' . $user->data['session_id'] . " >Cerrar Sesion</a>");?>.</td>
</tr>
</table>
<table width="145" height="72" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td align="center" valign="top">0</td>
</tr>
</table></td>
</tr>
</table>
<?php
} else {
?>
<table width="145" height="392" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="145" align="center" valign="top"><p>
<form action="<?php echo $phpbb_url_path?>ucp.php?mode=login" target="_top" method="post" enctype="multipart/form-data">
<img src="http://www.tudominio.com/avatar-default.jpg" alt="." width="135" height="250" /> Usuario:
<input name="username" type="text" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; WIDTH: 110px; BORDER-BOTTOM: 0px" value="" size="10" />
<br />
Contraseña:<br />
<input type="password" name="password" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; WIDTH: 110px; BORDER-BOTTOM: 0px" size="10" maxlength="32" >
<br />
<input type="checkbox" name="autologin" id="autologin" class="checkbox" value="ON" />
Autologin
<input type="hidden" name="redirect" value="../index.php">
<div><a href="<?php echo $phpbb_url_path?>ucp.php?mode=register" title="Léete las condiciones y decide si quieres pertenecer a esta comunidad." >Soy nuevo</a></div>
<div><a href="<?php echo $phpbb_url_path?>ucp.php?mode=sendpassword" title="Danos tu nombre de usuario y tu correo electrónico y te mandamos una nueva" >Recordar password </a></div>
<input type="submit" value=" Entrar " name="login" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; WIDTH: 60px; BORDER-BOTTOM: 0px">
</form></td>
</tr>
</table>
<?php }
?>
ahora bien se puede integrar de dos maneras
por iframe directo en el sitio donde queremos lo cual no lo recomiendo:
en login.php(el que acabamos de crear)
hasta arriba antes de <?php
ponemos esta linea
Código PHP:
<?php include("sesiones.php"); ?>
Código HTML:
<IFRAME style="WIDTH: 145px; HEIGHT: 392px" marginHeight=0 src="http://www.tudominio.com/login.php" frameBorder=0 scrolling=no> </IFRAME>
repito no lo recomiendo.
Ahora la otra forma y la mejor.
metemos el include de sesiones.php antes que ningun codigo en nuestra pagina php que queremos darle sesion por decirlo asi,
y colocamos el include de login.php en la parte que queramos de nustro archivo php el ejemplo aso:
index.php
Código PHP:
<?php include("sesiones.php"); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Eder Duran G. Saludos. </title>
</head>
<body>
login de phpbb3
<?php include("login.php"); ?>
</body>
</html>
Saludos, si hay dudas pregunten ..... Eder Duran G.











