Ver Mensaje Individual
  #1 (permalink)  
Antiguo 12/06/2012, 08:59
marce_vampira
 
Fecha de Ingreso: junio-2012
Ubicación: En Chile :D
Mensajes: 44
Antigüedad: 11 años, 11 meses
Puntos: 0
problemas para mostrar nombre luego del login

Hola chicos y chicas, soy nueva por aca y tengo un pequeño problema.

Tengo una pagina, la cual luego de loguearse discrimina entre los atributos de usuario. Entre los 3 tipos de usuarios, el segundo me muestra una pagina con 2 iframe dentro de unas tablas, en el iframe superior llama a una pagina X donde en teoria me deberia mostrar el nombre del usuario que se logueo.

Todo lo estoy haciendo con DW CS6.

Este es la pagina que se muestra luego de ingresar, en la cual si solicito el nombre con la variable de sesion "MM_Username" me muestra todo ok.

Código PHP:
<?php
//initialize the session
if (!isset($_SESSION)) {
  
session_start();
}

// ** Logout the current user. **
$logoutAction $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset(
$_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
  
$logoutAction .="&"htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset(
$_GET['doLogout'])) &&($_GET['doLogout']=="true")){
  
//to fully log out a visitor we need to clear the session varialbles
  
$_SESSION['MM_Username'] = NULL;
  
$_SESSION['MM_UserGroup'] = NULL;
  
$_SESSION['PrevUrl'] = NULL;
  unset(
$_SESSION['MM_Username']);
  unset(
$_SESSION['MM_UserGroup']);
  unset(
$_SESSION['PrevUrl']);
    
  
$logoutGoTo "index.php";
  if (
$logoutGoTo) {
    
header("Location: $logoutGoTo");
    exit;
  }
}
?>
<?php
if (!isset($_SESSION)) {
  
session_start();
}
$MM_authorizedUsers "tecnico";
$MM_donotCheckaccess "false";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers$strGroups$UserName$UserGroup) { 
  
// For security, start by assuming the visitor is NOT authorized. 
  
$isValid False

  
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
  // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
  
if (!empty($UserName)) { 
    
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
    // Parse the strings into arrays. 
    
$arrUsers Explode(","$strUsers); 
    
$arrGroups Explode(","$strGroups); 
    if (
in_array($UserName$arrUsers)) { 
      
$isValid true
    } 
    
// Or, you may restrict access to only certain users based on their username. 
    
if (in_array($UserGroup$arrGroups)) { 
      
$isValid true
    } 
    if ((
$strUsers == "") && false) { 
      
$isValid true
    } 
  } 
  return 
$isValid
}

$MM_restrictGoTo "clientes.php";
if (!((isset(
$_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers$_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
  
$MM_qsChar "?";
  
$MM_referrer $_SERVER['PHP_SELF'];
  if (
strpos($MM_restrictGoTo"?")) $MM_qsChar "&";
  if (isset(
$_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0
  
$MM_referrer .= "?" $_SERVER['QUERY_STRING'];
  
$MM_restrictGoTo $MM_restrictGoTo$MM_qsChar "accesscheck=" urlencode($MM_referrer);
  
header("Location: "$MM_restrictGoTo); 
  exit;
}
?>
<!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>
<LINK REL="Shortcut Icon" HREF="http://www.optchile.cl/icono.ico"> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>
<style type="text/css">
<!--
.Estilo1 {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 10px;
}
-->
</style>
<?php
// onmouseover ="window.open('nada.php','seleccion');window.open('nada.php','down');"
?>
<link href="css/barralogo.css" rel="stylesheet" type="text/css" />
</head>

<body>



<span class="Estilo1">
</span><span class="Estilo1">
<table width="955" border="0" align="center">
  <tr align="center">
    <td width="145" height="59" align="center" valign="top">&nbsp;</td>
    <td width="753" align="center" valign="top"><table width="745" align="center">
      <tr>
        <td align="center" valign="middle"><iframe src="tecnico.php" name="arriba" width="745" marginwidth="0" height="50" marginheight="0" align="center" scrolling="no" frameborder="0" id="arriba">
        <div align="center">Tu navegador no soporta frames!!</div>
        </iframe></td>
      </tr>
    </table></td>
    <td width="43" valign="top"><div align="right"><a href="<?php echo $logoutAction ?>">[x]Cerrar<br />
Sesi&oacute;n&nbsp;</a></div></td>
  </tr>
  <tr align="center">
    <td colspan="3" valign="middle"><iframe src="nada.php" name="down" width="950" marginwidth="0" height="600" marginheight="0" align="center" scrolling="Auto" frameborder="0" id="down">
    <div align="center">Tu navegador no soporta frames!!</div>
    </iframe></td>
  </tr>
</table>
</span>
</body>
</html>
Y esta es la pagina tecnico.php

Código PHP:
<?php require_once('Connections/localhost.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  if (
PHP_VERSION 6) {
    
$theValue get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  
$theValue function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch (
$theType) {
    case 
"text":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;    
    case 
"long":
    case 
"int":
      
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case 
"double":
      
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case 
"date":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;
    case 
"defined":
      
$theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
      break;
  }
  return 
$theValue;
}
}

$colname_Recordset1 "-1";
if (isset(
$_SESSION['MM_Username'])) {
  
$colname_Recordset1 $_SESSION['MM_Username'];
}
mysql_select_db($database_localhost$localhost);
$query_Recordset1 sprintf("SELECT nombre, usuario FROM usuarios WHERE usuario = %s"GetSQLValueString($colname_Recordset1"text"));
$Recordset1 mysql_query($query_Recordset1$localhost) or die(mysql_error());
$row_Recordset1 mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 mysql_num_rows($Recordset1);
?>
<!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>Documento sin título</title>
</head>

<body>
<table width="740" align="center">
  <tr>
    <td align="center" valign="middle">Bienvenido  <?php echo $row_Recordset1['nombre']; ?> - <?php echo $row_Recordset1['usuario']; ?></td>
  </tr>
</table>
</body>
</html>
<?php
mysql_free_result
($Recordset1);
?>
Me podrian echar una manito porfa que estoy pegada en esto y no se que hacer :(