28/07/2005, 07:06
|
| | Fecha de Ingreso: julio-2004
Mensajes: 51
Antigüedad: 20 años, 4 meses Puntos: 0 | |
yoseman respecto a este codigo q pusiste no se si es cosa d q sta mal o es cosa mia pro kuando me logeo salgo en la lista de usuarios conectados pero donde deberia poner perfil y eso m sale el formulario de login
Código:
<?
$volver="../index.php";
define('IN_PHPBB', true);
$phpbb_root_path = (dirname($_SERVER['PHP_SELF'])=="/foro") ? './' : 'foro/'; //PATH DEL FORO RESPECTO DEL SCRIPT
if (!function_exists("init_userprefs"))
{
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
global $db, $board_config;
global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $SID;
$cookiename = $board_config['cookie_name'];
$cookiepath = $board_config['cookie_path'];
$cookiedomain = $board_config['cookie_domain'];
$cookiesecure = $board_config['cookie_secure'];
}
// determinamos si cookie activada sino propagamos sid por url
if ( !(isset($HTTP_COOKIE_VARS[$cookiename . '_sid']) || isset($HTTP_COOKIE_VARS[$cookiename . '_data'])) )
{
output_add_rewrite_var('sid', $userdata['session_id']);
}
//
// Generate logged in/logged out status
//
if ( $userdata['session_logged_in'] )
{
$u_login_logout = 'login.'.$phpEx.'?logout=true&sid=' . $userdata['session_id'];
$l_login_logout = $lang['Logout'] . ' [ ' . $userdata['username'] . ' ]';
}
else
{
$u_login_logout = 'login.'.$phpEx;
$l_login_logout = $lang['Login'];
}
$s_last_visit = ( $userdata['session_logged_in'] ) ? create_date($board_config['default_dateformat'], $userdata['user_lastvisit'], $board_config['board_timezone']) : '';
//
// Get basic (usernames + totals) online
// situation
//
$logged_visible_online = 0;
$logged_hidden_online = 0;
$guests_online = 0;
$online_userlist = '';
$l_online_users = '';
$user_forum_sql = ( !empty($forum_id) ) ? "AND s.session_page = " . intval($forum_id) : '';
$sql = "SELECT u.username, u.user_id, u.user_allow_viewonline, u.user_level, s.session_logged_in, s.session_ip
FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s
WHERE u.user_id = s.session_user_id
AND s.session_time >= ".( time() - 300 ) . "
$user_forum_sql
ORDER BY u.username ASC, s.session_ip ASC";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain user/online information', '', __LINE__, __FILE__, $sql);
}
$userlist_ary = array();
$userlist_visible = array();
$prev_user_id = 0;
$prev_user_ip = $prev_session_ip = '';
while( $row = $db->sql_fetchrow($result) )
{
// User is logged in and therefor not a guest
if ( $row['session_logged_in'] )
{
// Skip multiple sessions for one user
if ( $row['user_id'] != $prev_user_id )
{
$style_color = '';
if ( $row['user_level'] == ADMIN )
{
$row['username'] = '<b>' . $row['username'] . '</b>';
$style_color = 'style="color:#' . $theme['fontcolor3'] . '"';
}
else if ( $row['user_level'] == MOD )
{
$row['username'] = '<b>' . $row['username'] . '</b>';
$style_color = 'style="color:#' . $theme['fontcolor2'] . '"';
}
if ( $row['user_allow_viewonline'] )
{
$user_online_link = '<a href="' . $phpbb_root_path.append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '"' . $style_color .'>' . $row['username'] . '</a>';
$logged_visible_online++;
}
else
{
$user_online_link = '<a href="' . $phpbb_root_path.append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '"' . $style_color .'><i>' . $row['username'] . '</i></a>';
$logged_hidden_online++;
}
if ( $row['user_allow_viewonline'] || $userdata['user_level'] == ADMIN )
{
$online_userlist .= ( $online_userlist != '' ) ? (', ' ."<img src=\"./usuario1.gif\">" .$user_online_link) : ("<img src=\"./usuario1.gif\">" .$user_online_link);
}
}
$prev_user_id = $row['user_id'];
}
else
{
// Skip multiple sessions for one user
if ( $row['session_ip'] != $prev_session_ip )
{
$guests_online++;
}
}
$prev_session_ip = $row['session_ip'];
}
$db->sql_freeresult($result);
if ( empty($online_userlist) )
{
$online_userlist = $lang['None'];
}
$online_userlist = ( ( isset($forum_id) ) ? $lang['Browsing_forum'] : $lang['Registered_users'] ) . ' ' . $online_userlist;
$total_online_users = $logged_visible_online + $logged_hidden_online + $guests_online;
if ( $total_online_users > $board_config['record_online_users'])
{
$board_config['record_online_users'] = $total_online_users;
$board_config['record_online_date'] = time();
$sql = "UPDATE " . CONFIG_TABLE . "
SET config_value = '$total_online_users'
WHERE config_name = 'record_online_users'";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update online user record (nr of users)', '', __LINE__, __FILE__, $sql);
}
$sql = "UPDATE " . CONFIG_TABLE . "
SET config_value = '" . $board_config['record_online_date'] . "'
WHERE config_name = 'record_online_date'";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update online user record (date)', '', __LINE__, __FILE__, $sql);
}
}
if ( $total_online_users == 0 )
{
$l_t_user_s = $lang['Online_users_zero_total'];
}
else if ( $total_online_users == 1 )
{
$l_t_user_s = $lang['Online_user_total'];
}
else
{
$l_t_user_s = $lang['Online_users_total'];
}
if ( $logged_visible_online == 0 )
{
$l_r_user_s = $lang['Reg_users_zero_total'];
}
else if ( $logged_visible_online == 1 )
{
$l_r_user_s = $lang['Reg_user_total'];
}
else
{
$l_r_user_s = $lang['Reg_users_total'];
}
if ( $logged_hidden_online == 0 )
{
$l_h_user_s = $lang['Hidden_users_zero_total'];
}
else if ( $logged_hidden_online == 1 )
{
$l_h_user_s = $lang['Hidden_user_total'];
}
else
{
$l_h_user_s = $lang['Hidden_users_total'];
}
if ( $guests_online == 0 )
{
$l_g_user_s = $lang['Guest_users_zero_total'];
}
else if ( $guests_online == 1 )
{
$l_g_user_s = $lang['Guest_user_total'];
}
else
{
$l_g_user_s = $lang['Guest_users_total'];
}
$l_online_users = sprintf($l_t_user_s, $total_online_users);
$l_online_users .= sprintf($l_r_user_s, $logged_visible_online);
$l_online_users .= sprintf($l_h_user_s, $logged_hidden_online);
$l_online_users .= sprintf($l_g_user_s, $guests_online);
//determinamos si usuario logueado para mostrar en link login o logout
$log_in_out=( $userdata['session_logged_in'] ) ? ('<a href="'.$phpbb_root_path.'login.'.$phpEx.'?logout=true&sid=' . $userdata['session_id'].'&redirect='.$volver.'">LOGOUT ['.$userdata['username'].']</a>') : ('LOGIN');
// si usuario logueado mostramos su avatar
if ($userdata['user_id']!=-1)
{
switch ($userdata['user_avatar_type'])
{
case 0 : $ruta_de_avatar = '' ;break;
case 1 : $ruta_de_avatar = "<img src=\"" . $phpbb_root_path .$board_config['avatar_path'] . '/' . $userdata['user_avatar'] . "\">";break;
case 2 : $ruta_de_avatar = "<img src=\"" .$userdata['user_avatar'] . "\" >";break;
case 3 : $ruta_de_avatar = "<img src=\"" . $phpbb_root_path.$board_config['avatar_gallery_path'] . '/' . $userdata['user_avatar'] . "\" >";break;
}
$log_in_out .= "<div align=\"center\">" . $ruta_de_avatar . "<br /><b>" . $userdata['username'] . "</b></div>";
}
else {
$log_in_out .="<div align=\"center\"><b>Usuario anónimo</b></div>";
}
?>
<div align="center">
<?
print $log_in_out."<br /><br /><br />";
if (!$userdata['session_logged_in'])
{
?>
<form action="<?=$phpbb_root_path?>login.php" method="post">
<input type="hidden" name="redirect" value="<?=$volver?>?sid=<?=$userdata['session_id']?>">
Usuario: <input type="text" name="username" size="10" /><br>
Contraseña: <input type="password" name="password" size="10" maxlength="32" /><br />
Entrar automáticamente en cada visita
<input class="text" type="checkbox" name="autologin" />
<input type="submit" class="mainoption" name="login" value="Login" />
</form>
<a href="<?=$phpbb_root_path?>profile.php?mode=register">Registrarse</a>
</div>
<?}
else
{
$sql = mysql_query("SELECT g.group_id, g.group_name, g.group_type, ug.user_pending
FROM " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug
WHERE ug.user_id = " . $userdata['user_id'] . "
AND ug.group_id = g.group_id
AND g.group_single_user <> " . TRUE . "
ORDER BY g.group_name, ug.user_id");
$cont=1;
while($row=mysql_fetch_array($sql))
$grupos.=" <b>".$row['group_name']."</b>,";
if (mysql_num_rows($sql)>0) print "perteneces a los siguientes grupos: ". $grupos;
if ( $userdata['user_new_privmsg'] )
{
$l_message_new = ( $userdata['user_new_privmsg'] == 1 ) ? $lang['New_pm'] : $lang['New_pms'];
$l_privmsgs_text = sprintf($l_message_new, $userdata['user_new_privmsg']);
}
else
{
$l_privmsgs_text = $lang['No_new_pm'];
}
?>
<br>
<a href="<?php echo $phpbb_root_path ?>profile.php?mode=editprofile" >Perfil</a>
<a href="<?php echo $phpbb_root_path ?>privmsg.php?folder=inbox"><?php echo $l_privmsgs_text ?></a> <?
}
?>
<br>--------------------<br>
<br><a href="<?=$phpbb_root_path?>index2.php">foro</a><br>
<?
print $l_online_users."<br>".$online_userlist;?>
|